Skip to content

Ollama client doesn't like having non-text response of tool calling #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
riywo opened this issue May 7, 2025 · 0 comments · Fixed by #16
Closed

Ollama client doesn't like having non-text response of tool calling #15

riywo opened this issue May 7, 2025 · 0 comments · Fixed by #16
Assignees

Comments

@riywo
Copy link
Contributor

riywo commented May 7, 2025

It seems Ollama client doesn't like having non-text response of tool calling:

[2025-05-06 22:27:49.692 -0700] ERROR: LLM error: 1:llm:ChatOllama (3ms)
    error: "Non string tool message content is not supported\n\nError: Non string tool message content is not supported\n    at convertToolMessageToOllama (file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/ollama/dist/utils.js:119:15)\n    at file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/ollama/dist/utils.js:140:20\n    at Array.flatMap (<anonymous>)\n    at convertToOllamaMessages (file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/ollama/dist/utils.js:129:21)\n    at ChatOllama._streamResponseChunks (file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/ollama/dist/chat_models.js:730:32)\n    at _streamResponseChunks.next (<anonymous>)\n    at ChatOllama._generateUncached (file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/core/dist/language_models/chat_models.js:211:34)\n    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n    at async ChatOllama.invoke (file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/core/dist/language_models/chat_models.js:88:24)\n    at async RunnableSequence.invoke (file:///Users/ryosuke.iwanaga/.npm/_npx/25982cb890102a2e/node_modules/aethr/node_modules/@langchain/core/dist/runnables/base.js:1280:27)"
[2025-05-06 22:27:49.694 -0700] INFO: Test result: FAIL, Summary:
Error: Non string tool message content is not supported

Previously, we had converted non-text response (array) to a text but dropped it by #2 since most of providers accept the array as-is.

ref. langchain-ai/langchainjs#8151

@riywo riywo self-assigned this May 7, 2025
riywo added a commit that referenced this issue May 9, 2025
This commit fixes #15 by just stringifying the non-string tool response like OpenAI client.
riywo added a commit that referenced this issue May 9, 2025
This commit fixes #15 by just stringifying the non-string tool response like OpenAI client.
@riywo riywo closed this as completed in #16 May 9, 2025
@riywo riywo closed this as completed in 6445941 May 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant