OpenAI Integration
from reacter_openapitools import OpenAIAdapter
from openai import OpenAI
# Initialize the AI client
client = OpenAI(api_key="your-openai-api-key")
# Initialize the adapter
adapter = OpenAIAdapter(api_key="your OpenAPI Tools Apikey - https://openapitools.com/dashboard/settings")
# Create a chatbot with tools
chatbot = adapter.create_openai_chatbot(
openai_client=client,
llm_config={
"model": "gpt-4o",
"temperature": 0.7,
"system": "You are a helpful assistant with access to tools."
},
options={ # Optional
"tool_names": ["generate-otp", {"name": "get-orders", "version": "prod"}],
}
)
# Use the chatbot
response = chatbot["invoke"]("Can you help me check the weather?")
print(response["text"])
Note
The llm_config
parameters correspond to the underlying LLM API you’re using. For detailed parameter information, check:
- OpenAI: Chat Completions API Reference
🚫
Important
Streaming responses are not currently supported in agents. Check tool_usage to implement streaming.
Last updated on