A powerful, OpenAI-compatible Python SDK for TNSA NGen3 Pro and Lite Models
Project description
TNSAAI Python Client
A powerful, OpenAI-compatible Python SDK for TNSA NGen3 Pro and Lite Models.
Installation
pip install tnsaai
Quick Start
from tnsaai import TNSA
# Initialize the client
client = TNSA(api_key="your-api-key", base_url="https://api.tnsaai.com")
# Create a chat completion
response = client.chat.create(
model="NGen3.9-Pro",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
Streaming
stream = client.chat.create(
model="NGen3.9-Lite",
messages=[{"role": "user", "content": "Tell me a story"}],
stream=True
)
for chunk in stream:
if chunk.content:
print(chunk.content, end="")
Async Usage
import asyncio
from tnsaai import AsyncTNSA
async def main():
async with AsyncTNSA(api_key="your-api-key") as client:
response = await client.chat.create(
model="NGen3.9-Pro",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
asyncio.run(main())
Available Models
- NGen3.9-Pro - High-performance model for complex tasks
- NGen3.9-Lite - Fast, efficient model for general use
- Farmvaidya-Bot - Agricultural domain-specific model
Configuration
Set your API key as an environment variable:
export TNSA_API_KEY="your-api-key"
export TNSA_BASE_URL="https://api.tnsaai.com"
Or pass it directly:
client = TNSA(
api_key="your-api-key",
base_url="https://api.tnsaai.com"
)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
tnsaai_client-1.0.0.tar.gz
(8.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tnsaai_client-1.0.0.tar.gz.
File metadata
- Download URL: tnsaai_client-1.0.0.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c88d3a5f2690ecfa7d4e632bd1bb4c5da03e7c9a4d05f38f3526967268cd161b
|
|
| MD5 |
1a5e9426f224e2c1603380b0a17ba3e1
|
|
| BLAKE2b-256 |
49efed9cd17b84c5e306b9d8200d32b13a450f9e6f7d13c1c04d82594396fdd4
|
File details
Details for the file tnsaai_client-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tnsaai_client-1.0.0-py3-none-any.whl
- Upload date:
- Size: 8.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bf57c8963fd9755493e1e8bb8466e9a59c1066b065c68e3d3efe5625497c2a0c
|
|
| MD5 |
98e93d735b5e62c7514cba983090235c
|
|
| BLAKE2b-256 |
c66e828e118fe7f84445be663810e8e813e5abcfc1a1d9ad7aeaeff1ec5e2243
|