Python SDK for accessing Zella AI for building AI apps
Project description
Zella AI Python Package
This is a Python package for accessing Zella APIs.
Installation
pip install zella
Initialize Zella AI using API Key
api_key = 'api_jad3uf93iaf92902lkdj2ldu092d3d'
zella_ai = ZellaAI(api_key)
Chat Completion
Use Chat Completion API to get response from llms
# Create Request Parameters
user = "user_jskjf93o101"
model = {
"platform": "openai",
"name": "gpt-3.5-turbo"
}
query = {
"messages": [ {
"role": "system",
"content": "You are a helpful assistant to help design api structure"
},
{
"role": "user",
"content": "Hi There!"
}]
}
response = {
"format": "json_object"
}
# Call API
response = zella_ai.chat.completions.create(user, model, query, response)
Streaming Chat Completion
Pass stream parameter in response to get streaming response from llms
# Create Request Parameters
user = "user_jskjf93o101"
model = {
"platform": "openai",
"name": "gpt-3.5-turbo"
}
query = {
"messages": [ {
"role": "system",
"content": "You are a helpful assistant to help design api structure"
},
{
"role": "user",
"content": "Hi There!"
}]
}
response = {
"format": "json_object",
"stream": True
}
# Call API
stream = zella_ai.chat.completions.create(user, model, query, response)
# Iterate over stream
for chunk in stream:
if chunk:
print(chunk)
Complete Example Usage
api_key = 'api_jad3uf93iaf92902lkdj2ldu092d3d'
zella_ai = ZellaAI(api_key)
user = "user_jskjf93o101"
model = {
"platform": "openai",
"name": "gpt-3.5-turbo"
}
query = {
"messages": [ {
"role": "system",
"content": "You are a helpful assistant to help design api structure"
},
{
"role": "user",
"content": "Hi There!"
}]
}
response = {
"format": "json_object"
}
response = zella_ai.chat.completions.create(user, model, query, response)
assert response.status.type == 'ok'
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
zella-0.0.5.tar.gz
(8.0 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
zella-0.0.5-py3-none-any.whl
(11.7 kB
view details)
File details
Details for the file zella-0.0.5.tar.gz.
File metadata
- Download URL: zella-0.0.5.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ae893f060d898a81940a2ff5f157a62b9d2184379d568f9159693cdf950bd4d4
|
|
| MD5 |
b721bdebc3dbff7eaf122375f2db09f8
|
|
| BLAKE2b-256 |
69d895b69231cb821e75d8a6e3d6f35f20cb274d8d857de1769c96b966e36b04
|
File details
Details for the file zella-0.0.5-py3-none-any.whl.
File metadata
- Download URL: zella-0.0.5-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.10.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe9e49422a14a395b101de10f3649c37d9dea9b811937ee9cf4065f1a838256f
|
|
| MD5 |
bf24c0a5a66a1d6b6ad2f4457bc0605e
|
|
| BLAKE2b-256 |
a50a7468845602ec5110b2f3cfab084536e92cd34444b52de04cc5316abd8e04
|