Skip to main content

Python SDK to interact with Itzam's API

Project description

PyPI Version PyPI Downloads

Itzam python sdk

itzam logo

Overview

Itzam Python SDK provides a simple interface to interact with the Itzam API for text generation, thread management, model listing, and run inspection.

Installation

pip install itzam

Quick Start

from itzam import Itzam

client = Itzam("your-api-key")
response = client.text.generate(
  workflow_slug="your_workflow_slug",
  input="Hello, Itzam!",
  stream=False
)
print(response.text)

Authentication

You can provide your API key directly or set it as an environment variable:

export ITZAM_API_KEY=your-api-key

Then initialize without arguments:

from itzam import Itzam
client = Itzam()

Features

  • Text Generation: Generate text using your workflows.
  • Threads: Create and manage threads for conversations.
  • Models: List available models and their details.
  • Runs: Inspect previous runs and their metadata.

Usage Examples

See available models

python3 -m itzam.models

Generate Text

response = client.text.generate(
  workflow_slug="your_workflow_slug",
  input="Write a poem about the sea."
)
print(response.text)

Stream Text Generation

for delta in client.text.generate(
  workflow_slug="your_workflow_slug",
  input="Tell me a story.",
  stream=True
):
  print(delta, end="", flush=True)

List Models

models = client.models.list()
for model in models:
  print(model.name, model.tag)

Create a Thread

thread = client.threads.create(
  workflow_slug="your_workflow_slug",
  name="Support Conversation"
)
print(thread.id)

Get a Run

run = client.runs.get("run_id")
print(run.output)

Advanced

You can specify a custom API base URL if needed:

client = Itzam(api_key="your-api-key", base_url="https://itz.am")

Requirements

  • Python 3.10+
  • requests
  • pydantic
  • rich
  • python-dotenv (optional, for environment variable loading)

License

MIT


For more details, see the API documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itzam-1.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

itzam-1.1.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file itzam-1.1.0.tar.gz.

File metadata

  • Download URL: itzam-1.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for itzam-1.1.0.tar.gz
Algorithm Hash digest
SHA256 0344c019faff0a5b9aaa65e5577e65a5ce07760e1cfc75565e63526773203950
MD5 52ceb86a01cb655a0b025e55e470050d
BLAKE2b-256 fc0554fee0c74b134627218e5d8c81fc2efa41270cc6f02795a78933e2cd9a51

See more details on using hashes here.

File details

Details for the file itzam-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: itzam-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for itzam-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b396f63c95369e3a2d879314e211149a7e9fb2f80c8b83b57fbc7487ca36021
MD5 611585d2fee32a6161dc2b46cdfaa17a
BLAKE2b-256 1e92803c1aec79ac87980a4771c3245347efe3553652cde2b7761dbfa3dfc630

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page