Build AI Assistants Fast
Project description
CyberChipped
Introduction
CyberChipped powers the best AIs - CometHeart and WalletBubbles!
In a few lines of code build a conversational AI Assistant!
Install
pip install cyberchipped
OpenAI Assistant
from cyberchipped.ai import SQLiteDatabase, AI
from fastapi import UploadFile, File
from fastapi.responses import StreamingResponse
import os
database = SQLiteDatabase("sqlite.db")
@app.post("/conversation/{user_id}")
async def conversation_endpoint(user_id: str, audio_file: UploadFile = File(...)):
ai = AI(
api_key=os.getenv("OPENAI_API_KEY"),
name="CometHeart AI Simple",
instructions="You are CometHeart an AI voice assistant - you answer questions and help with tasks. You keep your responses brief and tailor them for speech.",
database=database
)
@ai.add_tool
def get_current_temperature(location: str, unit: str) -> str:
"""Get the current temperature for a specific location"""
return f"The current temperature in {location} is 20 degrees {unit}"
async with ai as ai_instance:
audio_generator = await ai_instance.conversation(user_id, audio_file, "nova", "opus")
return StreamingResponse(
content=audio_generator,
media_type="audio/webm",
)
Run Tests
poetry run pytest
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
cyberchipped-1.2.5.tar.gz
(5.3 kB
view hashes)
Built Distribution
Close
Hashes for cyberchipped-1.2.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62b59cb50f8606aa900c9ffbbefc2f107758fc2ff8d9fee51d54d1281092d1d5 |
|
MD5 | 5cae07bf3aa0a3703be688437f960e1a |
|
BLAKE2b-256 | eeae9fa82add9e4a29cae9bb8c7263a17a9d9fcd1136bf18122849072af16e75 |