Skip to content

feat(zeph-llm): GonkaProvider chat_with_tools / chat_typed (extract openai/wire.rs) #3612

@bug-ops

Description

@bug-ops

Part of epic #3602.

Scope

Complete the LlmProvider impl on GonkaProvider by adding chat_with_tools and chat_typed::<T> plus last_usage / last_cache_usage accounting.

Files to modify

  • crates/zeph-llm/src/gonka/mod.rs — extend LlmProvider impl:
    • chat_with_tools(messages, tools) — reuse OpenAI tool-body builder + decode_tool_chat_response (extract to openai/wire.rs if not already done in feat(zeph-llm): GonkaProvider chat / chat_stream / embed (signed transport) #3611).
    • chat_typed::<T>(messages) — reuse TypedChatRequest body helper from openai.
    • supports_tool_use returns true; supports_structured_output returns true.
    • last_usage / last_cache_usage route decoded OpenAiUsage through inner.store_cache_usage(usage) — promote that helper to pub(crate) in openai/mod.rs.
  • crates/zeph-llm/src/openai/mod.rs — promote helpers to pub(crate): store_cache_usage, decode_tool_chat_response (or move both to openai/wire.rs).
  • crates/zeph-llm/src/gonka/tests.rs — wiremock tests:
    • Tool-call round-trip: provider receives a tool-use response, returns ChatResponse::ToolUse with correct call IDs and arguments.
    • Structured output: chat_typed::<MyStruct>(...) returns a parsed value.

Acceptance

  • cargo nextest run -p zeph-llm -E 'test(gonka_tools)' green.
  • All previously written gonka tests still pass.
  • cargo clippy --workspace --features full -- -D warnings green.
  • cargo doc --no-deps -p zeph-llm clean with broken-intra-doc-links denied.
  • CHANGELOG.md [Unreleased] updated.

Depends on

#3611.

Size

M (~4h)

Metadata

Metadata

Assignees

Labels

P2High value, medium complexityenhancementNew feature or requestfeatureNew functionalityllmzeph-llm crate (Ollama, Claude)size/MMedium PR (51-200 lines)toolsTool execution and MCP integration

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions