chatjimmy 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 ChatJimmy Python SDK Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,425 @@
1
+ Metadata-Version: 2.4
2
+ Name: chatjimmy
3
+ Version: 0.1.0
4
+ Summary: A Python SDK for ChatJimmy's ultra-fast AI inference platform, featuring simplified and OpenAI-compatible interfaces.
5
+ Author-email: Community SDK Contributor <developer@chatjimmy-community.org>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/community-sdks/chatjimmy-python
8
+ Project-URL: Documentation, https://github.com/community-sdks/chatjimmy-python#readme
9
+ Project-URL: Repository, https://github.com/community-sdks/chatjimmy-python.git
10
+ Project-URL: Bug Tracker, https://github.com/community-sdks/chatjimmy-python/issues
11
+ Keywords: chatjimmy,ai,llm,llama3,taalas,inference,fast-inference,openai-compatible,streaming
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Classifier: Operating System :: OS Independent
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests>=2.28.0
29
+ Requires-Dist: httpx>=0.24.0
30
+ Requires-Dist: urllib3>=1.26.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.0.0; extra == "dev"
33
+ Requires-Dist: build>=1.0.0; extra == "dev"
34
+ Requires-Dist: twine>=4.0.0; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ # ChatJimmy Python SDK (`chatjimmy`)
38
+
39
+ [![PyPI version](https://img.shields.io/pypi/v/chatjimmy.svg)](https://pypi.org/project/chatjimmy/)
40
+ [![Python Versions](https://img.shields.io/pypi/pyversions/chatjimmy.svg)](https://pypi.org/project/chatjimmy/)
41
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
42
+
43
+ A developer-friendly, production-grade Python SDK for [ChatJimmy](https://chatjimmy.ai/) — an ultra-fast AI inference platform powered by Taalas Inc.'s custom direct-to-silicon compute hardware running Meta's Llama 3.1 8B.
44
+
45
+ The SDK offers two intuitive developer experiences:
46
+ 1. **Simplified Interface**: A lightweight, minimal API (`client.chat("Hello")`).
47
+ 2. **OpenAI-Compatible Interface**: An interface mimicking the official OpenAI Python package (`client.chat.completions.create(...)`) with full support for streaming and asynchronous calls.
48
+
49
+ ---
50
+
51
+ > [!IMPORTANT]
52
+ > **Community Notice & Disclaimer**: This package is an independent community SDK and is neither an official product of nor affiliated with ChatJimmy or Taalas Inc. It communicates with ChatJimmy's publicly served backend and is subject to its service availability, terms of use, and network rate limits.
53
+
54
+ ---
55
+
56
+ ## Table of Contents
57
+
58
+ - [Features](#features)
59
+ - [Installation](#installation)
60
+ - [Quick Start](#quick-start)
61
+ - [1. Simplified Interface](#1-simplified-interface)
62
+ - [2. OpenAI-Compatible Interface](#2-openai-compatible-interface)
63
+ - [Model Discovery](#model-discovery)
64
+ - [Multi-Turn Conversations](#multi-turn-conversations)
65
+ - [Real-Time Streaming](#real-time-streaming)
66
+ - [OpenAI-Compatible Streaming](#openai-compatible-streaming)
67
+ - [Simplified Token Streaming](#simplified-token-streaming)
68
+ - [Asynchronous Client (`AsyncChatJimmy`)](#asynchronous-client-asyncchatjimmy)
69
+ - [Async Chat Completions](#async-chat-completions)
70
+ - [Async Streaming](#async-streaming)
71
+ - [Concurrent Requests with asyncio](#concurrent-requests-with-asyncio)
72
+ - [File Attachments (Up to 50KB)](#file-attachments-up-to-50kb)
73
+ - [Hardware Performance Metrics](#hardware-performance-metrics)
74
+ - [Configuration & Networking](#configuration--networking)
75
+ - [Error Handling](#error-handling)
76
+ - [Testing](#testing)
77
+ - [Known Limitations](#known-limitations)
78
+ - [License](#license)
79
+
80
+ ---
81
+
82
+ ## Features
83
+
84
+ - **Zero Authentication**: No API keys, login credentials, or browser automation required.
85
+ - **OpenAI-Compatible API**: Seamlessly drop into existing workflows expecting OpenAI-style `client.chat.completions.create(...)` and `ChatCompletion` objects.
86
+ - **Dual Synchronous & Asynchronous Support**: Both `ChatJimmy` (sync via `requests`) and `AsyncChatJimmy` (async via `httpx`).
87
+ - **High-Performance Streaming**: Token-by-token and chunk-by-chunk streaming with zero internal sentinel token leaks.
88
+ - **Hardware Telemetry**: Direct access to Taalas silicon execution metrics (TTFT, decode tokens/sec, prefill tokens/sec, compute latency).
89
+ - **Multi-Turn Context**: Automatic conversation tracking and session management.
90
+ - **Attachment Support**: Upload and analyze text documents or code snippets up to 50KB.
91
+ - **Resilient Networking**: Connection pooling with automatic exponential backoff retries on transient network errors.
92
+
93
+ ---
94
+
95
+ ## Installation
96
+
97
+ Install the package via `pip`:
98
+
99
+ ```bash
100
+ pip install chatjimmy
101
+ ```
102
+
103
+ Or install with development dependencies:
104
+
105
+ ```bash
106
+ pip install chatjimmy[dev]
107
+ ```
108
+
109
+ ---
110
+
111
+ ## Quick Start
112
+
113
+ ### 1. Simplified Interface
114
+
115
+ ```python
116
+ from chatjimmy import ChatJimmy
117
+
118
+ client = ChatJimmy()
119
+
120
+ response = client.chat("What is the capital of Japan?")
121
+ print(response)
122
+ # Output: The capital of Japan is Tokyo.
123
+ ```
124
+
125
+ ### 2. OpenAI-Compatible Interface
126
+
127
+ ```python
128
+ from chatjimmy import ChatJimmy
129
+
130
+ client = ChatJimmy()
131
+
132
+ completion = client.chat.completions.create(
133
+ model="llama3.1-8B",
134
+ messages=[
135
+ {"role": "system", "content": "You are a concise, helpful tutor."},
136
+ {"role": "user", "content": "Explain transformers in machine learning in one sentence."},
137
+ ]
138
+ )
139
+
140
+ print(completion.choices[0].message.content)
141
+ print(f"Usage: {completion.usage.total_tokens} total tokens")
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Model Discovery
147
+
148
+ Discover supported models using either the OpenAI-style resource or direct helper:
149
+
150
+ ```python
151
+ from chatjimmy import ChatJimmy
152
+
153
+ client = ChatJimmy()
154
+
155
+ # OpenAI-style model list
156
+ models = client.models.list()
157
+ for model in models:
158
+ print(f"Model: {model.id} (Owner: {model.owned_by})")
159
+
160
+ # Retrieve specific model
161
+ model_info = client.models.retrieve("llama3.1-8B")
162
+ print("Retrieved:", model_info.id)
163
+ ```
164
+
165
+ ---
166
+
167
+ ## Multi-Turn Conversations
168
+
169
+ By default, `ChatJimmy` tracks conversation history automatically:
170
+
171
+ ```python
172
+ from chatjimmy import ChatJimmy
173
+
174
+ client = ChatJimmy()
175
+
176
+ # First turn
177
+ r1 = client.chat("Hello! My name is Arthur Dent and my favorite number is 42.")
178
+ print("Assistant:", r1)
179
+
180
+ # Second turn (context is preserved)
181
+ r2 = client.chat("What is my name and favorite number?")
182
+ print("Assistant:", r2)
183
+ # Output remembers Arthur Dent and 42!
184
+
185
+ # Reset history at any time
186
+ client.reset_conversation()
187
+ ```
188
+
189
+ ---
190
+
191
+ ## Real-Time Streaming
192
+
193
+ ### OpenAI-Compatible Streaming
194
+
195
+ ```python
196
+ from chatjimmy import ChatJimmy
197
+
198
+ client = ChatJimmy()
199
+
200
+ stream = client.chat.completions.create(
201
+ model="llama3.1-8B",
202
+ messages=[{"role": "user", "content": "Write a short poem about silicon processors."}],
203
+ stream=True,
204
+ )
205
+
206
+ for chunk in stream:
207
+ delta = chunk.choices[0].delta.content
208
+ if delta:
209
+ print(delta, end="", flush=True)
210
+
211
+ # Access hardware stats from completed stream
212
+ if stream.stats:
213
+ print(f"\n\nSpeed: {stream.stats.decode_rate:.0f} tokens/second")
214
+ ```
215
+
216
+ ### Simplified Token Streaming
217
+
218
+ ```python
219
+ from chatjimmy import ChatJimmy
220
+
221
+ client = ChatJimmy()
222
+
223
+ for token in client.chat_stream("Count from 1 to 5"):
224
+ print(token, end="", flush=True)
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Asynchronous Client (`AsyncChatJimmy`)
230
+
231
+ For asynchronous applications (e.g., FastAPI, Discord bots, async workers), use `AsyncChatJimmy`.
232
+
233
+ ### Async Chat Completions
234
+
235
+ ```python
236
+ import asyncio
237
+ from chatjimmy import AsyncChatJimmy
238
+
239
+ async def main():
240
+ async with AsyncChatJimmy() as client:
241
+ # Simplified async call
242
+ resp = await client.chat("Hello from async!")
243
+ print(resp.text)
244
+
245
+ # OpenAI-style async completion
246
+ comp = await client.chat.completions.create(
247
+ model="llama3.1-8B",
248
+ messages=[{"role": "user", "content": "What is 12 * 12?"}],
249
+ )
250
+ print("Answer:", comp.choices[0].message.content)
251
+
252
+ asyncio.run(main())
253
+ ```
254
+
255
+ ### Async Streaming
256
+
257
+ ```python
258
+ import asyncio
259
+ from chatjimmy import AsyncChatJimmy
260
+
261
+ async def main():
262
+ async with AsyncChatJimmy() as client:
263
+ stream = await client.chat.completions.create(
264
+ model="llama3.1-8B",
265
+ messages=[{"role": "user", "content": "Count from 1 to 5"}],
266
+ stream=True,
267
+ )
268
+ async for chunk in stream:
269
+ content = chunk.choices[0].delta.content
270
+ if content:
271
+ print(content, end="", flush=True)
272
+
273
+ asyncio.run(main())
274
+ ```
275
+
276
+ ### Concurrent Requests with asyncio
277
+
278
+ ```python
279
+ import asyncio
280
+ from chatjimmy import AsyncChatJimmy
281
+
282
+ async def query_city(city: str):
283
+ async with AsyncChatJimmy() as client:
284
+ resp = await client.chat(f"What is the capital of {city}?")
285
+ return city, resp.text.strip()
286
+
287
+ async def main():
288
+ cities = ["Japan", "France", "Germany", "Italy"]
289
+ tasks = [query_city(c) for c in cities]
290
+ results = await asyncio.gather(*tasks)
291
+
292
+ for city, answer in results:
293
+ print(f"{city}: {answer}")
294
+
295
+ asyncio.run(main())
296
+ ```
297
+
298
+ ---
299
+
300
+ ## File Attachments (Up to 50KB)
301
+
302
+ ChatJimmy accepts file attachments containing source code or text:
303
+
304
+ ```python
305
+ from chatjimmy import ChatJimmy, Attachment
306
+
307
+ client = ChatJimmy()
308
+
309
+ # Attach a local file
310
+ response = client.chat(
311
+ "Review this script for performance bugs.",
312
+ attachment="script.py",
313
+ )
314
+ print(response)
315
+
316
+ # Attach raw text in-memory
317
+ attachment = Attachment.from_text("def add(a, b): return a + b", name="math.py")
318
+ response = client.chat("What does this code do?", attachment=attachment)
319
+ print(response)
320
+ ```
321
+
322
+ ---
323
+
324
+ ## Hardware Performance Metrics
325
+
326
+ ChatJimmy operates on custom hardware developed by Taalas Inc. Each response provides fine-grained hardware execution statistics:
327
+
328
+ ```python
329
+ response = client.chat("Explain quantum entanglement.")
330
+
331
+ if response.stats:
332
+ print(f"Time to First Token: {response.stats.ttft * 1000:.2f} ms")
333
+ print(f"Decode Generation Rate:{response.stats.decode_rate:.0f} tokens/s")
334
+ print(f"Prefill Rate: {response.stats.prefill_rate:.0f} tokens/s")
335
+ print(f"Total Compute Time: {response.stats.total_time * 1000:.2f} ms")
336
+ print(f"Total Tokens: {response.stats.total_tokens}")
337
+ print(f"Exit Reason: {response.stats.reason}")
338
+ ```
339
+
340
+ | Metric Field | Description | Typical Value |
341
+ |---|---|---|
342
+ | `stats.ttft` | Time To First Token in seconds | `~0.0008s – 0.0015s` (sub-2ms) |
343
+ | `stats.decode_rate` | Output token generation speed | `15,000 – 18,500 tokens/s` |
344
+ | `stats.prefill_rate` | Context / prompt processing speed | `14,000 – 21,000 tokens/s` |
345
+ | `stats.device_compute_time`| Pure on-chip execution time | `< 0.05s for 800 tokens` |
346
+
347
+ ---
348
+
349
+ ## Configuration & Networking
350
+
351
+ ```python
352
+ from chatjimmy import ChatJimmy
353
+
354
+ client = ChatJimmy(
355
+ base_url="https://chatjimmy.ai", # Override base URL if proxied
356
+ model="llama3.1-8B", # Default model ID
357
+ top_k=8, # Top-K sampling (1 to 8)
358
+ system_prompt="Be concise.", # Default system instruction
359
+ timeout=45.0, # Timeout in seconds
360
+ max_retries=3, # Retries on 429, 502, 503, 504
361
+ headers={"X-Custom": "Header"}, # Extra HTTP headers
362
+ maintain_history=True, # Auto-manage multi-turn history
363
+ )
364
+ ```
365
+
366
+ ---
367
+
368
+ ## Error Handling
369
+
370
+ All SDK exceptions inherit from `ChatJimmyError`:
371
+
372
+ ```python
373
+ from chatjimmy import (
374
+ ChatJimmy,
375
+ ChatJimmyAPIError,
376
+ ChatJimmyConnectionError,
377
+ ChatJimmyTimeoutError,
378
+ ChatJimmyValidationError,
379
+ )
380
+
381
+ client = ChatJimmy(timeout=5.0)
382
+
383
+ try:
384
+ response = client.chat("Hello!")
385
+ except ChatJimmyTimeoutError:
386
+ print("The request or stream timed out.")
387
+ except ChatJimmyAPIError as e:
388
+ print(f"Backend HTTP error {e.status_code}: {e.error_message}")
389
+ except ChatJimmyConnectionError:
390
+ print("Network connectivity failed.")
391
+ except ChatJimmyValidationError as e:
392
+ print(f"Input validation error: {e}")
393
+ ```
394
+
395
+ ---
396
+
397
+ ## Testing
398
+
399
+ Run the test suite:
400
+
401
+ ```bash
402
+ # Run all unit and live integration tests
403
+ python -m pytest -v
404
+
405
+ # Run only mocked unit tests
406
+ python -m pytest -v -m "not live"
407
+
408
+ # Run only live integration tests
409
+ python -m pytest -v -m "live"
410
+ ```
411
+
412
+ ---
413
+
414
+ ## Known Limitations
415
+
416
+ 1. **Available Models**: The platform is dedicated to `llama3.1-8B`. Requests specifying other model IDs are mapped to the default model.
417
+ 2. **Attachment Size Limit**: The platform enforces a strict 50KB limit on file attachments.
418
+ 3. **Context Length**: The backend enforces context limits; if reached, the generation terminates with reason `"max context limit <N> reached"`.
419
+ 4. **Service Availability**: Because this library interfaces with a public web endpoint without an SLA, changes to `https://chatjimmy.ai` may require SDK updates.
420
+
421
+ ---
422
+
423
+ ## License
424
+
425
+ Distributed under the [MIT License](LICENSE).