Redcoatwright
Redcoatwright

Reputation: 157

Making a tool call using Anthropic/Claude with no inputs

I want to make a tool call using the Anthropic client but the function it would be calling has no inputs. It implicitly does but the input is a large vector and I'm initializing the program with this vector.

    tools = {
        "name": "pinecone_query",
        "description": "run query against pinecone db",
        "input_schema": {
            "type": "object",
            "properties" : {}
        },
        "required" : []
    }

The above code is not representative of what my actual tool is doing, it's more specific and fleshed out but the issue is I want the input_schema to be blank but I can't set it to just {}.

So the function call it can make would take the self.profile_embedding and run it against pinecone. The Anthropic documentation has nothing on making a function/tool call with an empty input schema.

Upvotes: 1

Views: 905

Answers (1)

Paté
Paté

Reputation: 1964

You need to put the required field inside the input_schema as such

tools = {
  name: "pinecone_query",
  description: "run query against pinecone db",
  input_schema: {
    type: "object",
    properties: {},
    required: []
  }
};

this will generate something like this

{
  type: 'tool_use',
  id: 'toolu_01346u3fP69FN722L2w5Txzi',
  name: 'pinecone_query',
  input: {}
}

Upvotes: 1

Related Questions