OpenAI plugin for vision agents
Project description
OpenAI Plugin for GetStream
This package provides OpenAI integration for the GetStream plugin ecosystem.
It enables features such as:
- Real-time transcription and language processing using OpenAI models
- Easy integration with other GetStream plugins and services
- Function calling capabilities for dynamic interactions
Installation
pip install getstream-plugins-openai
Usage
from getstream.plugins.openai import OpenAIRealtime
# Initialize with API key
sts = OpenAIRealtime(api_key="your_openai_api_key", voice="alloy")
# Connect to a call
async with await sts.connect(call, agent_user_id="assistant") as connection:
# Send user message
await sts.send_user_message("Hello, how can you help me?")
# Request assistant response
await sts.request_assistant_response()
Function Calling
The OpenAI Realtime API supports function calling, allowing the assistant to invoke custom functions you define. This enables dynamic interactions like:
- Database queries
- API calls to external services
- File operations
- Custom business logic
Example with Function Calling
from getstream.plugins.openai import OpenAIRealtime
# Define your functions
def get_weather(location: str) -> str:
"""Get current weather for a location"""
# Your weather API logic here
return f"Weather in {location}: Sunny, 72°F"
def send_email(to: str, subject: str, body: str) -> str:
"""Send an email"""
# Your email sending logic here
return f"Email sent to {to} with subject: {subject}"
# Initialize with functions
sts = OpenAIRealtime(
api_key="your_openai_api_key",
voice="alloy",
functions=[
{
"name": "get_weather",
"description": "Get current weather information",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
},
{
"name": "send_email",
"description": "Send an email to someone",
"parameters": {
"type": "object",
"properties": {
"to": {"type": "string", "description": "Recipient email"},
"subject": {"type": "string", "description": "Email subject"},
"body": {"type": "string", "description": "Email body"}
},
"required": ["to", "subject", "body"]
}
}
]
)
async with await sts.connect(call, agent_user_id="assistant") as connection:
await sts.send_user_message("What's the weather like in San Francisco?")
await sts.request_assistant_response()
# The assistant can now call your functions and you can respond with results
# await sts.send_function_call_output("call_id", "function_result")
Requirements
- Python 3.10+
- openai[realtime] api
- GetStream SDK
License
MIT
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
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 vision_agents_plugins_openai-0.1.12.tar.gz.
File metadata
- Download URL: vision_agents_plugins_openai-0.1.12.tar.gz
- Upload date:
- Size: 23.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ac43fa00b159a4ee6734ae5e2834cbebb110a22c951315ef5cd641e44b620f6f
|
|
| MD5 |
d6f5af7119c29ae94a98bc3095220d45
|
|
| BLAKE2b-256 |
7d26118850eaa71ec8cfcfb37e804d996e098a6211a70e383c5da0a945493f6e
|
File details
Details for the file vision_agents_plugins_openai-0.1.12-py3-none-any.whl.
File metadata
- Download URL: vision_agents_plugins_openai-0.1.12-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.19
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dbabecb4b8009955963029aee27d6c50979245770887a296ede30e342159abb1
|
|
| MD5 |
3ac8badd8cd0ebf24e7fe1189a995c8f
|
|
| BLAKE2b-256 |
e990f3211112ffb4e8fd8ad4f240d9a2bb76a9358dbcd2fc06b1c368c122eabe
|