feat: add GeminiAgent, GeminiClassifier, QdrantRetriever#482
feat: add GeminiAgent, GeminiClassifier, QdrantRetriever#482inamdarmihir wants to merge 1 commit into
Conversation
Implements native Gemini 2.0 Flash support for agents and classification, plus a cloud-agnostic Qdrant retriever powered by Gemini text-embedding-004. - GeminiAgent: streaming + non-streaming, retriever support, role mapping - GeminiClassifier: function-calling based routing, gemini-2.0-flash default - QdrantRetriever: drop-in Retriever ABC impl, index_documents() helper - setup.cfg: new [gemini] and [qdrant] extras, both added to [all] - Tests: test_gemini_agent.py, test_qdrant_retriever.py - Example: examples/python/gemini_qdrant_example.py Closes 2FastLabs#376 Co-authored-by: inamdarmihir <39341893+inamdarmihir@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR aims to add optional Google Gemini support (agent + classifier) and a Qdrant-based retriever to the Python agent_squad framework (Fixes #376), including new extras in packaging, tests, and an end-to-end example.
Changes:
- Add
GeminiAgent/GeminiClassifierimplementations and register them in package__init__.pymodules. - Add
QdrantRetrieverimplementation and register it under retrievers. - Add
gemini/qdrantextras (and include them inall), plus tests and an example.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@claude check this PR, check this new implementation against the other agents, how the code is written, how clean is it and how inline is with the existing code. |
|
Claude finished @cornelcroi's task in 2m 18s —— View job PR Code Review
Review Summary
The review below evaluates the design and code quality based on the PR description and the patterns established in the existing codebase. 1. Critical: Broken Branch StateThe commit history shows: This is a git submodule pointer, not source files. Before any code review can matter, the author needs to:
2. Agent Design: Alignment with Existing PatternsBased on the PR description and comparing against
@dataclass
class AnthropicAgentOptions(AgentOptions):
api_key: Optional[str] = None
client: Optional[Any] = None
model_id: str = "claude-3-5-sonnet-20240620"
streaming: Optional[bool] = False
inference_config: Optional[dict[str, Any]] = None
retriever: Optional[Retriever] = None
...The PR description proposes Concerns (from PR description text):
3. Classifier Design
The PR description says
4. Retriever Design
async def retrieve(self, text: str) -> Any: ...
async def retrieve_and_combine_results(self, text: str) -> Any: ...
async def retrieve_and_generate(self, text: str) -> Any: ...The PR description only mentions
5. Packaging (
|
|
Hi @inamdarmihir can you review these findings ? One thing that is very important is that every agent should come with an optional package so that the user to install it only if he uses this agent. |
Issue Link (REQUIRED)
Fixes #376
Summary
Changes
This PR adds Google Gemini support and a Qdrant retriever to the agent squad Python framework.
New files
python/src/agent_squad/agents/gemini_agent.pyGeminiAgent,GeminiAgentOptionsgoogle-generativeaiConversationMessageto Gemini role formatgemini-2.0-flashpython/src/agent_squad/classifiers/gemini_classifier.pyGeminiClassifier,GeminiClassifierOptionsanalyzePromptmatches existing classifier schemagemini-2.0-flashpython/src/agent_squad/retrievers/qdrant_retriever.pyQdrantRetriever,QdrantRetrieverOptionstext-embedding-004for embeddingsindex_documents()helperModified files
agents/__init__.pyregisters Gemini agentclassifiers/__init__.pyregisters Gemini classifierretrievers/__init__.pyregisters Qdrant retrieversetup.cfgaddsgeminiandqdrantextras, both included inallTests
test_gemini_agent.pyCovers validation, defaults, responses, role mapping, retriever use
test_qdrant_retriever.pyCovers retrieval and indexing with mocked calls
Example
examples/python/gemini_qdrant_example.pyEnd to end example with classifier, retriever, and two agents
Known issue in first commit
The initial push included the
agent-squaddirectory as a submodule instead of regular files.This has been fixed. The submodule was removed, the nested
.gitdirectory deleted, and all files committed normally. The diff now only contains the expected source, tests, config, and example files.User experience
Before
No built in Gemini agent or classifier.
Only retriever required AWS Bedrock.
Gemini workflows required custom code.
After
A full Gemini setup works in about 15 lines:
Install options:
No impact to existing AWS, Anthropic, or OpenAI users.
Checklist
Is this a breaking change?
RFC issue: N/A
Not a breaking change. All additions are optional and guarded by import checks. Existing behavior remains unchanged.
Acknowledgment
By submitting this PR, I agree that this contribution can be used, modified, and redistributed under the project’s terms.