#How to debug a tool

1 messages · Page 1 of 1 (latest)

frosty umbra
#

Does anyone know of a setup to test and debug tools locally? Preferably in vscode

I have only seen the syntaxis from the OpenAI tools but unclear how one debugs when writing such tools

junior steppe
#

there's a bunch of examples of tool use, as well as on claude's pages too

willow umbra
frosty umbra
#

@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)

junior steppe
#

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)

When constructing your own agent, you will need to provide it with a list of Tools that it can use. Besides the actual function that is called, the Tool consists of several components: