Skip to content

feat(llm): extend LlmProvider trait with tool_use support #254

@bug-ops

Description

@bug-ops

Problem

LlmProvider trait has no concept of tool definitions or structured tool calls. All tool interaction goes through text parsing.

Solution

Add to LlmProvider trait:

  • fn supports_tool_use(&self) -> bool (default false)
  • fn chat_with_tools(&self, messages, tools) -> Result<ChatResponse> (default delegates to chat())
  • ChatResponse enum: Text(String) | ToolUse { id, name, input: Value } | Mixed(Vec<ContentBlock>)

Use schemars for JSON Schema generation from tool parameter types.

Acceptance Criteria

  • Trait methods with default implementations (backward compatible)
  • ChatResponse supports text + tool_use blocks
  • JSON Schema generation via schemars derive
  • Existing providers unaffected (return false for supports_tool_use)

Part of #253 (M20)

Metadata

Metadata

Assignees

No one assigned

    Labels

    llmLLM provider related

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions