managarten/services/mana-llm/src
Till JS e757470cb0 feat(mana-llm): add OpenAI-style tools + tool_calls passthrough
Extends the chat-completions surface so callers can ask any provider
to call named functions and get structured tool_calls back. Wired
through all three provider adapters so the planner and companion can
switch off the fragile JSON-parsing pathway.

- Request: tools[], tool_choice, assistant tool_calls, tool-role
  messages with tool_call_id.
- Response: MessageResponse.tool_calls, Choice.finish_reason adds
  "tool_calls", DeltaContent streams tool_calls.
- Google provider: Tool(function_declarations=...) build, result
  normalised (args dict → JSON string), function_response parts on
  a user turn for tool-role messages.
- OpenAI-compat: 1:1 passthrough of the OpenAI spec.
- Ollama: /api/chat passthrough; model-level capability check via a
  TOOL_CAPABLE_OLLAMA_PATTERNS whitelist (llama3.1+, qwen2.5+,
  mistral, command-r, …) — unsupported models rejected rather than
  silently falling back to prose.
- Router: model_supports_tools() check upfront for both streaming
  and non-streaming paths; ProviderCapabilityError bubbles as 400.

No silent downgrade. Missing tool support = explicit error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 15:22:48 +02:00
..
models feat(mana-llm): add OpenAI-style tools + tool_calls passthrough 2026-04-20 15:22:48 +02:00
providers feat(mana-llm): add OpenAI-style tools + tool_calls passthrough 2026-04-20 15:22:48 +02:00
streaming fix(mana-llm): surface Gemini finish_reason errors instead of returning "" 2026-04-20 15:15:37 +02:00
utils feat(mana-llm): add central LLM abstraction service 2026-01-29 22:01:00 +01:00
__init__.py feat(mana-llm): add central LLM abstraction service 2026-01-29 22:01:00 +01:00
api_auth.py chore(ai-services): adopt Windows GPU as source of truth for llm/stt/tts 2026-04-08 12:46:03 +02:00
config.py chore(cloud-tier): upgrade default model gemini-2.0-flash → gemini-2.5-flash 2026-04-16 12:32:03 +02:00
main.py fix(mana-llm): surface Gemini finish_reason errors instead of returning "" 2026-04-20 15:15:37 +02:00