mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-20 23:57:11 -04:00
[PR #303] [MERGED] fix: clarify Ollama models without tool support #308
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/303
Author: @mason5052
Created: 5/6/2026
Status: ✅ Merged
Merged: 5/21/2026
Merged by: @asdek
Base:
feature/next-release← Head:codex/issue-280-ollama-tool-support-validation📝 Commits (2)
552eda8fix: clarify Ollama models without tool support73d5b83fix: drop unverified ollama tags and broaden hint context📊 Changes
3 files changed (+128 additions, -2 deletions)
View changed files
📝
backend/pkg/providers/helpers.go(+27 -0)📝
backend/pkg/providers/helpers_test.go(+99 -0)📝
backend/pkg/providers/providers.go(+2 -2)📄 Description
Summary
Surface an actionable hint when an Ollama model that does not support tool/function calling is selected for a flow or assistant session, so users do not have to parse a five-wrap-deep "failed to determine tool call ID template" stack trace to figure out why provider initialization fails.
Problem
A user on an Ollama deployment of
gemma3:27b-it-q4_K_Mreports (issue #280) that the Provider/LLM test passes the basic completion checks but flow creation fails with:The underlying signal "does not support tools" is emitted by the Ollama API itself; PentAGI buries it five wraps deep, so the user is left guessing whether the issue is configuration, networking, or something internal to PentAGI.
Solution
Add an unexported helper
wrapToolCallIDTemplateErrorinpkg/providers/helpers.gothat detects the upstreamdoes not support toolssubstring and prepends a one-sentence guidance message asking the user to select an Ollama model whose own metadata advertises tool/function calling support. PentAGI does not verify Ollama model capabilities against upstream metadata, so the hint deliberately avoids hard-coded model tags. All other errors keep the existing wording. The original error is preserved via%wso log spans, langfuse traces, and any futureerrors.Is/Ascallers continue to work.Both call sites in
pkg/providers/providers.go(NewFlowProvider,NewAssistantProvider) now route through the helper, and the helper's wording is provider-agnostic so it applies equally to flow and assistant sessions.No schema, API, or DB changes. No new lifecycle state. No background work. The behavior change is the wording of one error string in one upstream-defined failure case.
User Impact
Test Plan
TestWrapToolCallIDTemplateErrorcovers:errors.Isround-trips to the original errorllama3.1,qwen2.5,mistral-nemo) and flow-only language (flow execution,flow creation)go test ./pkg/providers -run TestWrapToolCallIDTemplateError -count=1passes.go test ./pkg/providers/...currently fails inpkg/providers/testeronTestTestProviderStreamingMode("Expected non-zero latency for streaming test"). The same failure reproduces onupstream/mainwith no patch applied, so it appears pre-existing and environmental rather than introduced by this PR.Closes #280
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.