Skip to main content

ChatJimmy Python SDK (chatjimmy)

PyPI version Python Versions License: MIT

A developer-friendly, production-grade Python SDK for ChatJimmy — an ultra-fast AI inference platform powered by Taalas Inc.'s custom direct-to-silicon compute hardware running Meta's Llama 3.1 8B.

The SDK offers two intuitive developer experiences:

  1. Simplified Interface: A lightweight, minimal API (client.chat("Hello")).
  2. OpenAI-Compatible Interface: An interface mimicking the official OpenAI Python package (client.chat.completions.create(...)) with full support for streaming and asynchronous calls.


Table of Contents


Features

  • Zero Authentication: No API keys, login credentials, or browser automation required.
  • OpenAI-Compatible API: Seamlessly drop into existing workflows expecting OpenAI-style client.chat.completions.create(...) and ChatCompletion objects.
  • Dual Synchronous & Asynchronous Support: Both ChatJimmy (sync via requests) and AsyncChatJimmy (async via httpx).
  • High-Performance Streaming: Token-by-token and chunk-by-chunk streaming with zero internal sentinel token leaks.
  • Hardware Telemetry: Direct access to Taalas silicon execution metrics (TTFT, decode tokens/sec, prefill tokens/sec, compute latency).
  • Multi-Turn Context: Automatic conversation tracking and session management.
  • Attachment Support: Upload and analyze text documents or code snippets up to 50KB.
  • Resilient Networking: Connection pooling with automatic exponential backoff retries on transient network errors.

Installation

Install the package via pip:

pip install chatjimmy

Or install with development dependencies:

pip install chatjimmy[dev]

Quick Start

1. Simplified Interface

from chatjimmy import ChatJimmy

client = ChatJimmy()

response = client.chat("What is the capital of Japan?")
print(response)
# Output: The capital of Japan is Tokyo.

2. OpenAI-Compatible Interface

from chatjimmy import ChatJimmy

client = ChatJimmy()

completion = client.chat.completions.create(
    model="llama3.1-8B",
    messages=[
        {"role": "system", "content": "You are a concise, helpful tutor."},
        {"role": "user", "content": "Explain transformers in machine learning in one sentence."},
    ]
)

print(completion.choices[0].message.content)
print(f"Usage: {completion.usage.total_tokens} total tokens")

Model Discovery

Discover supported models using either the OpenAI-style resource or direct helper:

from chatjimmy import ChatJimmy

client = ChatJimmy()

# OpenAI-style model list
models = client.models.list()
for model in models:
    print(f"Model: {model.id} (Owner: {model.owned_by})")

# Retrieve specific model
model_info = client.models.retrieve("llama3.1-8B")
print("Retrieved:", model_info.id)

Multi-Turn Conversations

By default, ChatJimmy tracks conversation history automatically:

from chatjimmy import ChatJimmy

client = ChatJimmy()

# First turn
r1 = client.chat("Hello! My name is Arthur Dent and my favorite number is 42.")
print("Assistant:", r1)

# Second turn (context is preserved)
r2 = client.chat("What is my name and favorite number?")
print("Assistant:", r2)
# Output remembers Arthur Dent and 42!

# Reset history at any time
client.reset_conversation()

Real-Time Streaming

OpenAI-Compatible Streaming

from chatjimmy import ChatJimmy

client = ChatJimmy()

stream = client.chat.completions.create(
    model="llama3.1-8B",
    messages=[{"role": "user", "content": "Write a short poem about silicon processors."}],
    stream=True,
)

for chunk in stream:
    delta = chunk.choices[0].delta.content
    if delta:
        print(delta, end="", flush=True)

# Access hardware stats from completed stream
if stream.stats:
    print(f"\n\nSpeed: {stream.stats.decode_rate:.0f} tokens/second")

Simplified Token Streaming

from chatjimmy import ChatJimmy

client = ChatJimmy()

for token in client.chat_stream("Count from 1 to 5"):
    print(token, end="", flush=True)

Asynchronous Client (AsyncChatJimmy)

For asynchronous applications (e.g., FastAPI, Discord bots, async workers), use AsyncChatJimmy.

Async Chat Completions

import asyncio
from chatjimmy import AsyncChatJimmy

async def main():
    async with AsyncChatJimmy() as client:
        # Simplified async call
        resp = await client.chat("Hello from async!")
        print(resp.text)

        # OpenAI-style async completion
        comp = await client.chat.completions.create(
            model="llama3.1-8B",
            messages=[{"role": "user", "content": "What is 12 * 12?"}],
        )
        print("Answer:", comp.choices[0].message.content)

asyncio.run(main())

Async Streaming

import asyncio
from chatjimmy import AsyncChatJimmy

async def main():
    async with AsyncChatJimmy() as client:
        stream = await client.chat.completions.create(
            model="llama3.1-8B",
            messages=[{"role": "user", "content": "Count from 1 to 5"}],
            stream=True,
        )
        async for chunk in stream:
            content = chunk.choices[0].delta.content
            if content:
                print(content, end="", flush=True)

asyncio.run(main())

Concurrent Requests with asyncio

import asyncio
from chatjimmy import AsyncChatJimmy

async def query_city(city: str):
    async with AsyncChatJimmy() as client:
        resp = await client.chat(f"What is the capital of {city}?")
        return city, resp.text.strip()

async def main():
    cities = ["Japan", "France", "Germany", "Italy"]
    tasks = [query_city(c) for c in cities]
    results = await asyncio.gather(*tasks)

    for city, answer in results:
        print(f"{city}: {answer}")

asyncio.run(main())

File Attachments (Up to 50KB)

ChatJimmy accepts file attachments containing source code or text:

from chatjimmy import ChatJimmy, Attachment

client = ChatJimmy()

# Attach a local file
response = client.chat(
    "Review this script for performance bugs.",
    attachment="script.py",
)
print(response)

# Attach raw text in-memory
attachment = Attachment.from_text("def add(a, b): return a + b", name="math.py")
response = client.chat("What does this code do?", attachment=attachment)
print(response)

Hardware Performance Metrics

ChatJimmy operates on custom hardware developed by Taalas Inc. Each response provides fine-grained hardware execution statistics:

response = client.chat("Explain quantum entanglement.")

if response.stats:
    print(f"Time to First Token:   {response.stats.ttft * 1000:.2f} ms")
    print(f"Decode Generation Rate:{response.stats.decode_rate:.0f} tokens/s")
    print(f"Prefill Rate:          {response.stats.prefill_rate:.0f} tokens/s")
    print(f"Total Compute Time:    {response.stats.total_time * 1000:.2f} ms")
    print(f"Total Tokens:          {response.stats.total_tokens}")
    print(f"Exit Reason:           {response.stats.reason}")
Metric Field Description Typical Value
stats.ttft Time To First Token in seconds ~0.0008s – 0.0015s (sub-2ms)
stats.decode_rate Output token generation speed 15,000 – 18,500 tokens/s
stats.prefill_rate Context / prompt processing speed 14,000 – 21,000 tokens/s
stats.device_compute_time Pure on-chip execution time < 0.05s for 800 tokens

Configuration & Networking

from chatjimmy import ChatJimmy

client = ChatJimmy(
    base_url="https://chatjimmy.ai",  # Override base URL if proxied
    model="llama3.1-8B",             # Default model ID
    top_k=8,                         # Top-K sampling (1 to 8)
    system_prompt="Be concise.",     # Default system instruction
    timeout=45.0,                    # Timeout in seconds
    max_retries=3,                   # Retries on 429, 502, 503, 504
    headers={"X-Custom": "Header"},  # Extra HTTP headers
    maintain_history=True,           # Auto-manage multi-turn history
)

Error Handling

All SDK exceptions inherit from ChatJimmyError:

from chatjimmy import (
    ChatJimmy,
    ChatJimmyAPIError,
    ChatJimmyConnectionError,
    ChatJimmyTimeoutError,
    ChatJimmyValidationError,
)

client = ChatJimmy(timeout=5.0)

try:
    response = client.chat("Hello!")
except ChatJimmyTimeoutError:
    print("The request or stream timed out.")
except ChatJimmyAPIError as e:
    print(f"Backend HTTP error {e.status_code}: {e.error_message}")
except ChatJimmyConnectionError:
    print("Network connectivity failed.")
except ChatJimmyValidationError as e:
    print(f"Input validation error: {e}")

Testing

Run the test suite:

# Run all unit and live integration tests
python -m pytest -v

# Run only mocked unit tests
python -m pytest -v -m "not live"

# Run only live integration tests
python -m pytest -v -m "live"

Known Limitations

  1. Available Models: The platform is dedicated to llama3.1-8B. Requests specifying other model IDs are mapped to the default model.
  2. Attachment Size Limit: The platform enforces a strict 50KB limit on file attachments.
  3. Context Length: The backend enforces context limits; if reached, the generation terminates with reason "max context limit <N> reached".
  4. Service Availability: Because this library interfaces with a public web endpoint without an SLA, changes to https://chatjimmy.ai may require SDK updates.

License

Distributed under the MIT License.

Metadata

Release files for chatjimmy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for chatjimmy 0.1.0
File Size Uploaded Provenance Actions
chatjimmy-0.1.0.tar.gz 26.1 kB Without provenance Details for chatjimmy-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for chatjimmy 0.1.0
File Interpreter ABI Platform Actions
chatjimmy-0.1.0-py3-none-any.whl Python 3 none any Details for chatjimmy-0.1.0-py3-none-any.whl

Total release size: 48.0 kB

Release files / chatjimmy-0.1.0.tar.gz

Download URL chatjimmy-0.1.0.tar.gz
Size 26.1 kB
Tags Source
SHA-256 checksum
How to use checksums
965ae10a4ea838b19c27e2c787817a05b77a45b41aae6d2a2d8e4798394d7278
BLAKE2b-256 checksum
How to use checksums
63f3224c940ac3b40c5a12d19323dc4777b9938a94be0aac50eab31a68b308b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Release files / chatjimmy-0.1.0-py3-none-any.whl

Download URL chatjimmy-0.1.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3bd321e408e5fc1c8353e406465873c60461c0d9fc47b48bf6a3855865df750e
BLAKE2b-256 checksum
How to use checksums
0a10d54b1d27c82857277eae6f9a8259168d8f50d15a1f42457762f3cddcc816
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.6

Security for chatjimmy 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page