Skip to content

[FEATURE] Add built-in support for tool control parametersΒ #343

@nwumnn

Description

@nwumnn

Scope check

  • This is core LLM communication (not application logic)
  • This benefits most users (not just my use case)
  • This can't be solved in application code with current RubyLLM
  • I read the Contributing Guide

Due diligence

  • I searched existing issues
  • I checked the documentation

What problem does this solve?

Different LLM providers use different formats for tool control parameters (e.g., OpenAI's separate parameter, Anthropic's tool choice object). The current implementation requires provider-specific handling through with_params, making it difficult to switch providers.

Proposed solution

  1. Add standardized tool_choice parameter. Support "auto", "required", "none", and specific tool selection.
  2. Add boolean parameter to support allow/disallow parallel tool use.
  3. Handle provider-specific format translation internally.

Why this belongs in RubyLLM

This aligns with RubyLLM's goal of providing a unified interface for LLM interactions while abstracting provider-specific implementations. These parameters need to be handled at the provider level because each provider has different format requirements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions