Conversation
Co-authored-by: Christian <ChrisCoder9000@users.noreply.github.com>
Co-authored-by: Christian <ChrisCoder9000@users.noreply.github.com>
…rovements-62aa Refactor graph neighbor reduction and harden mutable defaults
- fixed base agent infinite final loop - added new brain's api format check alphanum + starting with a character - video on readme - updated dockerfile with transformer cache folder - fixed imports of instances
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (24)
📝 WalkthroughWalkthroughThis PR bumps the version from 2.10.2-dev to 2.10.3-dev while introducing a strategy pattern for neighbor vector reduction, enhancing multi-tool invocation support in the agent loop, refactoring embeddings and MCP service initialization, and fixing mutable default argument issues across multiple modules. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant GraphAdapter
participant ReductionStrategy as NeighborVectorReductionStrategy
participant VectorStore
Client->>GraphAdapter: _reduce_neighbor_vectors(vectors, description, threshold)
alt No vectors or missing inputs
GraphAdapter-->>Client: return empty set
else Vectors available
GraphAdapter->>ReductionStrategy: prefilter(vectors, avg_vector, description)
alt Description present
ReductionStrategy->>ReductionStrategy: apply reduce_list
else No description
ReductionStrategy-->>ReductionStrategy: return vectors as-is
end
ReductionStrategy-->>GraphAdapter: filtered_vectors
loop For each vector
GraphAdapter->>GraphAdapter: validate metadata.uuid
GraphAdapter->>GraphAdapter: validate embeddings exist & type
GraphAdapter->>GraphAdapter: validate embedding dimensionality
alt Valid vector
GraphAdapter->>GraphAdapter: compute cosine_similarity
alt Similarity >= threshold
GraphAdapter->>GraphAdapter: collect UUID
end
else Invalid vector
GraphAdapter->>GraphAdapter: skip vector
end
end
GraphAdapter-->>Client: set of valid UUIDs
end
sequenceDiagram
participant InvokeLoop
participant Agent
participant LLM
participant ToolExecutor
InvokeLoop->>Agent: model.invoke(messages)
alt raw_tc mode & multiple tool_calls
LLM-->>Agent: response with multiple tool_calls
Agent-->>InvokeLoop: assistant_message
InvokeLoop->>InvokeLoop: _log_token_usage(response)
loop For each tool_call
InvokeLoop->>InvokeLoop: _infer_tool_from_parsed
InvokeLoop->>ToolExecutor: resolve tool by name
InvokeLoop->>ToolExecutor: _call_tool(tool, input)
ToolExecutor-->>InvokeLoop: tool_result
InvokeLoop->>Agent: append tool_result message
InvokeLoop->>InvokeLoop: update state/counters
end
else Single tool or no raw_tc
LLM-->>Agent: response
InvokeLoop->>InvokeLoop: _log_token_usage(response)
InvokeLoop->>ToolExecutor: execute single tool
ToolExecutor-->>InvokeLoop: result
InvokeLoop->>Agent: append tool message
end
alt Finish reason indicates token limit
InvokeLoop-->>Client: early termination
else Continue
InvokeLoop->>InvokeLoop: process next step
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~70 minutes Possibly related PRs
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Pylint (4.0.5)src/config.py************* Module .pylintrc ... [truncated 2286 characters] ... None.", src/core/agents/core/invoke_loop.py************* Module .pylintrc ... [truncated 14272 characters] ... W0212" src/core/agents/core/agent_base.py************* Module .pylintrc ... [truncated 3920 characters] ... ]
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. Comment |
Summary by CodeRabbit
New Features
Improvements
Bug Fixes