fix: drop unverified ollama tags and broaden hint context

Address review on PR #303.

- helpers.go: remove the concrete model examples (llama3.1, qwen2.5, mistral-nemo) from the Ollama tools-unsupported hint. PentAGI does not verify Ollama model capabilities from upstream metadata, so a hard-coded list of supposedly tool-capable tags is risky and ages poorly. The hint now points users to select an Ollama model whose own metadata advertises tool/function calling support.

- helpers.go: rewrite the comment and error wording so it is no longer flow-only. The helper is shared by NewFlowProvider and NewAssistantProvider, so the message now refers to tool execution in flows and assistant sessions, and the doc-comment notes that wording must stay context-neutral.

- helpers_test.go: tighten TestWrapToolCallIDTemplateError to match the new wording, ban the previous concrete model tags, and ban flow-only language ('flow execution', 'flow creation'). The test still verifies that the original underlying error is wrapped via errors.Is.

Signed-off-by: mason5052 <ehehwnwjs5052@gmail.com>
This commit is contained in:
mason5052
2026-05-06 22:11:12 -04:00
parent 552eda8746
commit 73d5b8366d
2 changed files with 26 additions and 10 deletions
+9 -8
View File
@@ -46,11 +46,12 @@ type dummyMessage struct {
// wrapToolCallIDTemplateError annotates an error returned by
// Provider.GetToolCallIDTemplate so the user sees an actionable hint when a
// known upstream limitation blocks flow creation. Currently it covers the
// Ollama "model does not support tools" case (issue #280): the underlying
// error is returned by the Ollama API itself and surfaces five wraps deep,
// which previously left the user with a cryptic "failed to determine tool
// call ID template" message.
// known upstream limitation blocks provider initialization. Currently it
// covers the Ollama "model does not support tools" case (issue #280): the
// underlying error is returned by the Ollama API itself and surfaces five
// wraps deep, which previously left the user with a cryptic "failed to
// determine tool call ID template" message. This helper is shared by the
// flow and assistant provider paths, so the wording stays context-neutral.
//
// The function preserves the original error chain via %w so downstream code
// (logs, langfuse spans, errors.Is/As) keeps working.
@@ -62,9 +63,9 @@ func wrapToolCallIDTemplateError(err error) error {
return fmt.Errorf(
"failed to determine tool call ID template: the selected model "+
"does not support tool/function calling, which PentAGI requires "+
"for flow execution; pick an Ollama model that advertises the "+
"\"tools\" capability (for example llama3.1, qwen2.5, or "+
"mistral-nemo) and update the provider configuration: %w",
"for tool execution in flows and assistant sessions; select an "+
"Ollama model whose metadata advertises tool/function calling "+
"support and update the provider configuration: %w",
err)
}
return fmt.Errorf("failed to determine tool call ID template: %w", err)
+17 -2
View File
@@ -1207,9 +1207,24 @@ func TestWrapToolCallIDTemplateError(t *testing.T) {
"failed to determine tool call ID template",
"does not support tool/function calling",
"PentAGI requires",
"\"tools\" capability",
"flows and assistant sessions",
"metadata advertises tool/function calling",
"does not support tools",
},
wantNotContain: []string{
// The hint must not name specific model tags as
// tool-capable, because Ollama model capabilities are
// not verified by PentAGI and any concrete list ages
// poorly.
"llama3.1",
"qwen2.5",
"mistral-nemo",
// The helper is shared by both the flow and assistant
// provider paths, so the message must not imply this
// is a flow-only failure mode.
"flow execution",
"flow creation",
},
wantUnwrapsTo: ollamaErr,
},
{
@@ -1221,7 +1236,7 @@ func TestWrapToolCallIDTemplateError(t *testing.T) {
},
wantNotContain: []string{
"does not support tool/function calling",
"\"tools\" capability",
"metadata advertises tool/function calling",
},
wantUnwrapsTo: genericErr,
},