Python SDK
Primary SDK with httpx-based async support and OpenAI-compatible client interface
Installation
pip install beep-ai-sdkBasic Usage
from beep_ai_sdk import BeepClient
client = BeepClient(
base_url="http://localhost:5000",
api_key="YOUR_API_TOKEN"
)
# Chat completions
response = client.chat.completions.create(
model="phi-2",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response.choices[0].message.content)
# Streaming
async for chunk in client.chat.completions.create_stream(
model="phi-2",
messages=[{"role": "user", "content": "Tell me a story"}]
):
print(chunk.choices[0].delta.content, end="")
# Embeddings
embedding = client.embeddings.create(
model="all-MiniLM-L6-v2",
input="Hello world"
)
# RAG
results = client.rag.query(
collection_id="my-docs",
query="What is RAG?",
top_k=5
)
# Agents
result = client.agents.execute(
agent_id="code_reviewer",
input={"code": "def foo(): pass"}
)Features
- Full async/await support via httpx
- OpenAI-compatible client interface (drop-in replacement)
- Streaming with async iterators
- Automatic
/v1/*URL prefix handling - Type hints everywhere
- Connection pooling and retry