-
Notifications
You must be signed in to change notification settings - Fork 0
feat: remove unused codes & making the tool pass the original rag query! #44
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
Conversation
WalkthroughThe Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Agent
participant RAGTool
User->>Agent: Invoke do_rag_query()
Agent->>RAGTool: Pass query (unchanged)
RAGTool-->>Agent: Return response
Agent->>Agent: Store last_answer, increment retry_count
Agent-->>User: Return "stop"
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🔭 Outside diff range comments (2)
tasks/hivemind/agent.py (2)
182-184: Fix type inconsistency in state management.The
last_answerfield is defined asCrewOutput | None(line 21) but is now being assigned a string value fromresult["output"]. This creates a type mismatch that could cause runtime errors in other parts of the code.The
do_history_querymethod still assigns aCrewOutputobject tolast_answer, creating inconsistent behavior. Apply this fix:- result = agent_executor.invoke({"input": self.state.user_query}) - self.state.last_answer = result["output"] + result = agent_executor.invoke({"input": self.state.user_query}) + # Create a CrewOutput-compatible object or update the state type definition + from crewai.crews.crew_output import CrewOutput + self.state.last_answer = CrewOutput( + raw=result["output"], + pydantic=None, + json_dict=None, + tasks_output=[], + token_usage={} + )Alternatively, update the state type definition to accept string values:
- last_answer: CrewOutput | None = None + last_answer: CrewOutput | str | None = None
158-186: Add error handling for agent execution.The agent execution lacks error handling, which could cause the workflow to fail unexpectedly if the RAG tool or LLM encounters issues.
Add proper error handling:
- result = agent_executor.invoke({"input": self.state.user_query}) - self.state.last_answer = result["output"] - self.state.retry_count += 1 + try: + result = agent_executor.invoke({"input": self.state.user_query}) + self.state.last_answer = result["output"] + self.state.retry_count += 1 + except Exception as e: + logging.error(f"RAG query execution failed: {str(e)}") + self.state.last_answer = f"Error processing query: {str(e)}" + self.state.retry_count += 1 + # Consider whether to retry or stop based on error type
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
tasks/hivemind/agent.py(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#12
File: tasks/hivemind/query_data_sources.py:68-73
Timestamp: 2025-03-15T13:24:31.131Z
Learning: The RAGPipelineTool class in tasks/hivemind/query_data_sources.py has a design with class-level attributes (community_id and enable_answer_skipping) set in the setup_tools classmethod, which could cause concurrency issues if multiple instances run in parallel with different parameters. This has been acknowledged as a future improvement point to be addressed later.
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#2
File: tasks/hivemind/query_data_sources.py:27-31
Timestamp: 2025-02-26T15:41:54.631Z
Learning: In the agents-workflow project, "HivemindWorkflow" and "AgenticHivemindTemporalWorkflow" are two distinct workflows. The QueryDataSources class in tasks/hivemind/query_data_sources.py is designed to interact with "HivemindWorkflow", which is separate from "AgenticHivemindTemporalWorkflow" defined in tasks/agent.py.
tasks/hivemind/agent.py (1)
Learnt from: amindadgar
PR: TogetherCrew/agents-workflow#12
File: tasks/hivemind/query_data_sources.py:68-73
Timestamp: 2025-03-15T13:24:31.131Z
Learning: The RAGPipelineTool class in tasks/hivemind/query_data_sources.py has a design with class-level attributes (community_id and enable_answer_skipping) set in the setup_tools classmethod, which could cause concurrency issues if multiple instances run in parallel with different parameters. This has been acknowledged as a future improvement point to be addressed later.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: ci / test / Test
- GitHub Check: ci / lint / Lint
Summary by CodeRabbit