Skip to content

E4.5: wire real tool-calling through OpenAI provider #27

Closed

Description

@ajianaz

What

The real provider (OpenAiProvider, E4) is text-only: it never sends tools in the request body, never parses tool_calls from the response, and flattens the transcript to plain chat messages. The E3 mock exercises ProviderOutput::ToolCall, but with a live provider Tole can never call any tool — which blocks the E8 MVP gate.

Live smoke test (bifrost + glm/glm-5.1) confirmed: model replies "I don't have access to a cora_search tool".

Why

Without tool-calling on the wire, E8 (fix a real GitHub issue end-to-end) is impossible.

Scope

  1. Tool::spec() — per-tool function spec (name, description, parameters schema) with a minimal default
  2. ToolRegistry::specs() — collect into the OpenAI tools array
  3. OpenAiProvider::with_tool_specs() — inject specs; request_body sends tools when non-empty
  4. Flatten intent + tool_result entries to wire format (assistant tool_calls + role: tool messages; intent_id doubles as tool_call_id)
  5. Parse choices[0].message.tool_calls → ProviderOutput::ToolCall (single-path: first call wins, per the state machine)
  6. CLI: pass registry specs into the provider

Testing

  • Unit: request_body wire shape (intent→tool_calls, result→tool role), parse_completion variants
  • Full workspace gate + live smoke test with bifrost

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions