Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing "required" key in tool definitions while configuring session #9

Open
arunkumar-ramzy opened this issue Oct 26, 2024 · 0 comments

Comments

@arunkumar-ramzy
Copy link

Hello

I observe that sometimes my custom tool is called with optional arguments only. The required argument is missing in function call. After investigating the code, i found that, in class OpenAIVoiceReactAgent, in tool_defs dict, "required" is missing. In OpenAI Realtime api documentation: [https://platform.openai.com/docs/guides/realtime/concepts] there is a "required" key in parameters during session configuration. After adding this in tool_defs, the situation seems to be improved. But still, i see, although less frequently, tool call with only optional arguments.

Question:

  1. Why is it omitted from tool_defs?
  2. How to make sure tool calling is done correctly?

Code from react-voice-agent:

# sent tools and instructions with initial chunk
           tool_defs = [
               {
                   "type": "function",
                   "name": tool.name,
                   "description": tool.description,
                   "parameters": {"type": "object", "properties": tool.args},
               }

An example from OpenAI Realtime API documentation


{
  tools: [
  {
      name: "get_weather",
      description: "Get the weather at a given location",
      parameters: {
        type: "object",
        properties: {
          location: {
            type: "string",
            description: "Location to get the weather from",
          },
          scale: {
            type: "string",
            enum: ['celsius', 'farenheit']
          },
        },
        required: ["location", "scale"],
      },
    },
    ...
  ]
}

Any help much appreciated. Thanks a lot for this example implementation !!!

Regards
Arun

@arunkumar-ramzy arunkumar-ramzy changed the title Missing "required" key in tool definitions in session configuration Missing "required" key in tool definitions while configuring session Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant