Skip to content

Feat/add tool choice parameter - #711

Open
SaiDevaHarshaR wants to merge 4 commits into
ollama:mainfrom
SaiDevaHarshaR:feat/add-tool-choice-parameter
Open

Feat/add tool choice parameter#711
SaiDevaHarshaR wants to merge 4 commits into
ollama:mainfrom
SaiDevaHarshaR:feat/add-tool-choice-parameter

Conversation

@SaiDevaHarshaR

Copy link
Copy Markdown

What this does

Adds tool_choice parameter to chat() and ChatRequest to control
how the model uses tools.

Usage

ollama.chat(
    model="llama3.2",
    messages=[...],
    tools=[...],
    tool_choice="auto"  # "auto", "none", or "required"
)

Changes

  • _types.py: Added tool_choice: Optional[str] = None to ChatRequest
  • _client.py: Added tool_choice parameter to chat() signature
    and passes it through to ChatRequest

Related

Closes #663

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

Successfully merging this pull request may close these issues.

Add tool_choice parameter to chat() (mirror server-side ollama#11171)

1 participant