4 ms·
Where is `get_current_weather` implemented? > Tool responses can be provided via messages with the `tool` role.
by gavmor 2y ago
Where is `get_current_weather` implemented?
> Tool responses can be provided via messages with the `tool` role.
- mrshu 2y agoNot on the Ollama side. This sample code shows how a sample implementation of a tool like `get_current_weather` might look like in Python: https://github.com/ollama/ollama-python/blob/main/examples/tools/main.py https://github.com/ollama/ollama-python/blob/main/examples/t...
- gavmor 2y agoAh, I see. The model returns the name of an appropriate tool, then the client takes arbitrary action, and appends the `tool` message to the chat context, and finally a second call to the model minges these together. Part of me was hoping for some magic plugin space where I could drop named functions, but I couldn't imagine how.
- jejeyyy77 2y agoYou specify the API of your functions (inputs/description). The LLM will decide which functions to call and with what values. You perform the actual function execution.
- gavmor 2y agoThanks. If their announcement had included the schema of the return value of `response['message']['tool_calls']` it might've been more transparent to me.