PraisonAI icon indicating copy to clipboard operation
PraisonAI copied to clipboard

Tools with deepseek

Open iltempe opened this issue 11 months ago • 5 comments

No possibility at today to use tools with deepseek. This is the error.

│ Error in stream processing: Error code: 400 - {'error': {'message': 'registry.ollama.ai/library/deepseek-r1:latest does not support tools', │ │ 'type': 'api_error', 'param': None, 'code': None}}

iltempe avatar Jan 27 '25 22:01 iltempe

maybe you can make ollama team to change this....

malv-c avatar Jan 30 '25 12:01 malv-c

tools: ollama run nvjob/DeepSeek-R1-32B-Cline

malv-c avatar Feb 02 '25 08:02 malv-c

I am facing now the same issue but it was working fine as soon as deepseek (deepseek-r1:1.5b and deepseek-r1 7B) was released. I tested also the 2 new LLM openthinker deepscaler via Ollama and getting the same issue.

Any suggestions?

ciaotesla avatar Feb 13 '25 17:02 ciaotesla

@claude review this request, check if this issue is fixed. if not propose a fix.

MervinPraison avatar May 28 '25 14:05 MervinPraison

Claude finished @MervinPraison's task —— View jobclaude/issue-338-20250528_143600Create PR ➔


✅ DeepSeek Tools Issue Fixed

I've successfully implemented a comprehensive fix for issue #338 regarding DeepSeek models not supporting tools when used with Ollama.

Todo List:

  • [x] Read repository setup instructions (CLAUDE.md) - No repo-specific CLAUDE.md found
  • [x] Search codebase for DeepSeek-related configurations and examples - Found extensive DeepSeek support
  • [x] Check current tool handling logic for Ollama models - Reviewed LLM class with Ollama-specific handling
  • [x] Test current DeepSeek examples to verify issue status - Found limited tool testing with DeepSeek
  • [x] Investigate error handling for models without tool support - Found current error handling
  • [x] Propose/implement fix if issue persists - IMPLEMENTED COMPREHENSIVE SOLUTION

🔧 Solution Implemented:

1. Model Capability Detection

  • Added NO_TOOL_SUPPORT_MODELS constant tracking all DeepSeek/Ollama variants without tool support
  • Enhanced can_use_tools() method to detect these models proactively

2. Graceful Fallback System

  • Agents now continue execution without tools instead of crashing
  • Clear warning messages inform users about tool limitations
  • Both sync and async operations protected

3. Multiple Protection Layers

  • LLM class: Prevents tool formatting for unsupported models
  • Agent class: Additional safeguards during execution
  • Error-specific handling for 400 tool support errors

📁 Files Modified:

  • src/praisonai-agents/praisonaiagents/llm/llm.py - Core fix implementation
  • src/praisonai-agents/praisonaiagents/agent/agent.py - Agent-level protection
  • examples/python/models/deepseek/deepseek-tools-fix-test.py - Test script
  • DEEPSEEK_TOOLS_FIX.md - Comprehensive documentation

🧪 Test & Verify:

python examples/python/models/deepseek/deepseek-tools-fix-test.py

💡 User Impact:

  • Before: Hard crash with Error code: 400 - does not support tools
  • After: Warning message + continued execution without tools

Workarounds for users needing tools:

  1. Use DeepSeek API directly: llm="deepseek/deepseek-reasoner"
  2. Switch to tool-enabled Ollama models: llm="ollama/llama3.2"
  3. Wait for Ollama to enable tools in DeepSeek variants

claude[bot] avatar May 28 '25 14:05 claude[bot]

This is the nature of the model. Use models which support the tool call for it to work. https://ollama.com/search?c=tools

MervinPraison avatar May 31 '25 15:05 MervinPraison