#How to debug a tool
1 messages · Page 1 of 1 (latest)
there's a bunch of examples of tool use, as well as on claude's pages too
What sort of tools are you working with? My basic debugging flow for tools is just to have prints in the tool such that when its called you can see what's happening
@junior steppe you mean function calling examples like these?
- https://cookbook.openai.com/examples/function_calling_with_an_openapi_spec
- https://cookbook.openai.com/examples/how_to_call_functions_with_chat_models
overall it would be nice if there is a collection of all these "tools" somewhere (also from the community) so that one can reuse them more easily
@willow umbra atm just with vscode. I have the https://github.com/mckaywrigley/chatbot-ui deployed and for the "Tools" section it allows you to define something with these schema:
{'openapi': '3.0.0',
'info': {'version': '1.0.0',
'title': 'Event Management API',
'description': 'An API for managing event data'},
'paths': {'/events': {'get': {'summary': 'List all events',
'operationId': 'listEvents',
'responses': {'200': {'description': 'A list of events',
'content': {'application/json': {'schema': {'type': 'array',
'items': {'type': 'object
...
but I am, not sure how to debug here. Also I have not checked much the function calling feature so I that might be a place to start (?) (https://towardsdatascience.com/leverage-openai-tool-calling-building-a-reliable-ai-agent-from-scratch-4e21fcd15b62)
the one thing langchain has done correctly is defining tools from functions easily.
I would recommend defining a tool from https://python.langchain.com/v0.1/docs/modules/tools/custom_tools/
@tool
def multiply(a: int, b: int) -> int:
"""Multiply two numbers."""
return a * b
And then passing it into this function https://api.python.langchain.com/en/latest/utils/langchain_core.utils.function_calling.convert_to_openai_tool.html
So, convert_to_openai_tool(multiply)