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.2.0.tar.gz (9.6 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.2.0-py3-none-any.whl (13.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for itzam-1.2.0.tar.gz
Algorithm Hash digest
SHA256 d2ed423ef6a938c448c7374646a61c085e34cde6efb17ccac134b609151a7026
MD5 9aed87bb8f3c439a7406be2c81c67363
BLAKE2b-256 0d09cd0221ece14f88de4d9303dd103644a29224f77d6283e09c2caac15969f4

See more details on using hashes here.

File details

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

File metadata

  • Download URL: itzam-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.7 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e98e6855b4a46d9ab0c46fe02fa1edb87aa05faa3442e6ce656a0d1e07628a5
MD5 83b7b8254d378787b7376555493a1ed3
BLAKE2b-256 57a67b0160b3ac25b231db42397a76df248d0e986e4760acf4a6081249feb207

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