Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nPeppon
Copy link
Contributor

@nPeppon nPeppon commented Jun 5, 2025

🛠️ Fixes & Improvements

This pull request addresses two key issues:

1. RAG Tool Context Injection in Research Agent

  • Fixes issue #2198
  • The Research Agent was previously lacking proper context injection into the RAG tool.
  • This PR ensures the necessary context is now passed correctly, improving relevance and performance in document retrieval tasks.

2. Extended Thinking Flow with Non-Anthropic Models

  • Resolved a breaking issue caused by how "Continue" messages were handled during extended thinking with non-Anthropic models.
  • Previously, this flow would trigger the following error:
    Agent error: Error code: 400 - {'error': {'message': "An assistant message with 'tool_calls' must be followed by tool messages responding to each 'tool_call_id'. The following tool_call_ids did not have response messages: {...}"}
    
  • The root cause was a violation of the expected sequence:
    assistant: tool call -> tool: tool reply
    
  • This PR implements a proper chaining mechanism that maintains the required format, ensuring stability and compatibility across model types.

Important

Fixes context injection for RAG tool in research.py and handles "Continue" messages for non-Anthropic models in agent.py.

  • RAG Tool Context Injection:
    • Adds context=self to rag_tool() in research.py to fix context injection issue.
  • Extended Thinking with Non-Anthropic Models:
    • Adds check for "anthropic/" in model name in handle_function_or_tool_call() in agent.py to conditionally add "Continue..." message.
    • Fixes error handling for "Continue" messages in non-Anthropic models.

This description was created by Ellipsis for 91787bc. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 91787bc in 1 minute and 51 seconds. Click for details.
  • Reviewed 27 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. py/core/agent/research.py:118
  • Draft comment:
    Ensure 'context=self' is supported by the Tool implementation. Verify that passing the agent instance as context won’t cause circular reference issues.
  • Reason this comment was not posted:
    Confidence changes required: 33% <= threshold 50% None
2. py/core/base/agent/agent.py:230
  • Draft comment:
    Extended thinking now activates only for Anthropic models. Consider normalizing the model string (e.g., using lower()) to ensure robust matching.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The suggestion to use .lower() is a reasonable defensive programming practice that could prevent bugs if model names ever come in with different casing. However, model names in this context likely come from a controlled source (the config) and probably have consistent casing. The change is minor and not clearly necessary based on the evidence available. I don't have evidence that inconsistent casing is actually a problem that needs solving. The current code may be perfectly sufficient for the known model name formats. While case-insensitive comparison could add robustness, we should avoid suggesting changes without clear evidence of need. The current code appears to work as intended. Delete the comment as it suggests a defensive programming change without clear evidence that it solves a real problem.
3. py/core/base/agent/agent.py:229
  • Draft comment:
    Typo: Consider capitalizing 'claude' to 'Claude' for consistency with the debug message on line 230.
  • Reason this comment was not posted:
    Comment was on unchanged code.
4. py/core/base/agent/agent.py:230
  • Draft comment:
    Typo: There's an extra space before the colon in 'Model in use :'. Consider changing it to 'Model in use:' for consistency.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is an extremely minor formatting issue in a debug log message that developers will rarely see. It doesn't affect functionality at all. The comment, while technically correct, is focusing on something too trivial. Debug messages don't need to follow strict formatting rules. The comment is technically accurate and does point out an inconsistency. Some teams might have strict formatting standards that apply even to debug messages. While formatting consistency is good, this is far too minor an issue to warrant a PR comment, especially for a debug message. This falls under the "Do NOT make comments that are obvious or unimportant" rule. Delete this comment as it focuses on an extremely minor formatting issue in a debug message that doesn't meaningfully impact code quality or readability.

Workflow ID: wflow_VLE5uUEysAX2i4KX

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@nPeppon
Copy link
Contributor Author

nPeppon commented Jun 5, 2025

@NolanTrem tagging you as latest most active user in merging PRs for your feedback/approval/merge

@NolanTrem
Copy link
Collaborator

Awesome catch! Mind running the pre-commit hooks? Otherwise, this looks great!

…ip extended thinking message in Agent class for non Anthropic models
@nPeppon nPeppon force-pushed the fix/rag_context_claude_thinking branch from 91787bc to 7272f95 Compare June 6, 2025 08:12
@nPeppon
Copy link
Contributor Author

nPeppon commented Jun 6, 2025

Sorry, my bad, enabled and pushed (after it passed)

@NolanTrem
Copy link
Collaborator

No worries, it looks like it didn't run automatically for you anyways. Merging now—I seriously appreciate it!

@NolanTrem NolanTrem merged commit eb508b5 into SciPhi-AI:main Jun 6, 2025
2 of 4 checks passed
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 this pull request may close these issues.

2 participants