BotConnector
Masuk Workspace Buka Aplikasi

Python tools

Beta

Tool calling berstatus Experimental di level runtime (lihat Tool use); dukungan bergantung model/template. Source SDK sudah diimplementasikan, tetapi paket PyPI belum dipublikasikan.

Desain target SDK

python
from botconnector import Client

client = Client()
model = client.llm("<publisher>/<model>")

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current weather",
        "parameters": {
            "type": "object",
            "properties": {"city": {"type": "string"}},
            "required": ["city"],
        },
    },
}]

response = model.chat("What is the weather in Jakarta?", tools=tools)
if response.tool_calls:
    result = my_weather_impl(response.tool_calls[0].arguments["city"])
    # berikan hasil kembali dan lanjutkan percakapan
Keandalan tool-call bergantung model + chat template. Gunakan source SDK atau API kompatibel OpenAI — lihat Tool use — dengan catatan yang tercantum di sana.