This client is bot-first and typed-first.
Typical flow:
- Create
OpenChatClientand authenticate. - Create or select a bot.
- Create an interaction on that bot.
- Poll messages / wait for completion.
from client import OpenChatClient, PasswordAuth
client = OpenChatClient(
base_url="http://localhost:1984",
auth=PasswordAuth(email="admin", password="password"),
)
client.login()
interaction = client.interact(message="Draft a concise support response")
final = interaction.wait_until_finished(timeout_seconds=30)
print(type(final).__name__)Use create_bot(...) to create a user-owned bot with default interaction config.
bot = client.create_bot(
name="support_agent",
description="Customer support helper",
default_shared_config={
"model": "qwen3-4b-instruct-2507_vllm",
"backend": "litellm",
"endpoint": "https://litellm.t1m.me/v1",
"temperature": 0.2,
"max_tokens": 2048,
"system_prompt": "You are a concise support assistant.",
},
)
print(bot.uuid, bot.name)owned_bots = client.list_owned_bots()
for b in owned_bots:
print(b.uuid, b.name)If you also want visible public bots:
visible_bots = client.list_bots(include_public=True)You can resolve by bot UUID or owner-scoped name.
bot = client.get_bot("support_agent")
# or: bot = client.get_bot("<bot-uuid>")
interaction = bot.create_interaction(
message="Customer asks for a refund policy summary.",
)
print(interaction.uuid)Shortcut form:
interaction = client.interact(
bot="support_agent",
message="Answer as a support specialist",
)Tool names:
- Static generated enum:
ToolName - Runtime-fetched enum:
client.get_tool_name_enum()
from client import ToolName
interaction = client.get_bot("support_agent").create_interaction(
message="Weather in Berlin?",
overrides={"tools": [ToolName.GET_WEATHER]},
)Runtime enum example:
ToolNameDynamic = client.get_tool_name_enum()
print(ToolNameDynamic.GET_CURRENT_TIME)
print(client.list_tool_names())Per-tool payload classes are auto-generated under client/generated_api/models/,
for example:
get_weather_call.GetWeatherCall
You can validate typed call payloads via generated endpoints:
from client.generated_api.api.tools.post_api_v1_tools_typing_get_weather_call_validate import sync as validate_call
from client.generated_api.models.get_weather_call import GetWeatherCall
payload = GetWeatherCall(location="Berlin")
validate_call(client=client._api, body=payload)OpenChatClient.create_bot(...) -> BotOpenChatClient.update_bot(identifier, ...) -> BotOpenChatClient.delete_bot(identifier) -> BotOpenChatClient.list_owned_bots() -> list[Bot]OpenChatClient.list_bots(include_public=False) -> list[Bot]OpenChatClient.get_bot(identifier) -> BotOpenChatClient.interact(message, bot="bot", tool_init=None, overrides=None) -> InteractionSessionBot.create_interaction(message, tool_init=None, overrides=None) -> InteractionSessionInteractionSession.messages(page=1, limit=40) -> MessagesPageInteractionSession.wait_until_finished(...) -> Message | InteractionStopSignalInteractionSession.publish() -> ChatsSharedChatPublishResponseInteractionSession.shared_url() -> str
python3 development/scripts/update_oc_python_client_base.py