Skip to content

Force Agent tool use on first request #1820

@maxvdv94

Description

@maxvdv94

Description

When assigning tools there's no method or parameter to add that forces the model to use the tool. You either have to instruct it through a system_prompt or assume it makes the decision itself to use the tool.

The OpenAI SDK has a tool_choice parameter that can be found here.

Can you add this or a similar functionality that forces the model to use a specified tool on the first API request?

Example of the tool_choice parameter:

response = client.responses.create(
      model=model,
      tools=[{"type": "web_search_preview"}],
      input=search_query,
      tool_choice="required",
  )

References

https://platform.openai.com/docs/api-reference/responses/create#responses/object-tool_choice

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions