-
Notifications
You must be signed in to change notification settings - Fork 3k
My agent #183
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
base: main
Are you sure you want to change the base?
My agent #183
Conversation
…olved problems: bypassed Gemini API 429 rate limits, updated environment to Python 3.12 for library compatibility, and maintained Google Search grounding via hybrid LLM approach.
…tecture: Implemented a stateless filesystem crawler using os.walk. This approach was chosen to ensure 100% data privacy, eliminate external API latency, and bypass 429 rate limit issues entirely, providing a robust solution for local data analysis.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Summary of ChangesHello @LynAlinka, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant architectural shift in the research agent's data acquisition strategy, moving from external web searches to internal file system exploration. Concurrently, it updates the underlying Large Language Model (LLM) infrastructure, replacing Google's Gemini with Groq's Llama 3.3 70B, which impacts how queries are generated, reflections are made, and final answers are formulated. These changes enhance the agent's capability to process local information and offer more flexibility in LLM choice, alongside a new command-line option for directory specification. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request refactors the agent to use Groq with Llama models instead of Google Gemini, and switches from web-based research to searching within a local directory. While the core functionality change is clear, the implementation has introduced a significant regression where the configurable reasoning model is ignored in favor of a hardcoded one. Additionally, the new file search logic uses overly broad exception handling which could mask errors. I've also included some suggestions to improve code style and documentation in the command-line interface script.
backend/src/agent/graph.py
Outdated
| except Exception: | ||
| continue |
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.
Catching a broad Exception and silently continuing with continue can hide critical bugs and make debugging very difficult. It's much safer to catch only the specific exceptions you expect from file operations, such as IOError or OSError. This prevents masking unexpected issues.
| except Exception: | |
| continue | |
| except (IOError, OSError): | |
| continue |
backend/src/agent/graph.py
Outdated
| ) | ||
| result = llm.with_structured_output(Reflection).invoke(formatted_prompt) | ||
| # init Reasoning Model via Groq | ||
| result = groq_llm.with_structured_output(Reflection).invoke(formatted_prompt) |
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.
The reasoning_model passed in the state is being ignored here. The node now unconditionally uses the global groq_llm instance, which has a hardcoded model. This makes the --reasoning-model CLI argument ineffective for the reflection step. To honor the user's configuration, you should dynamically initialize a ChatGroq instance using the model from the state.
reasoning_model = state.get("reasoning_model") or "llama-3.3-70b-versatile"
llm = ChatGroq(
model=reasoning_model,
temperature=1.0,
api_key=os.getenv("GROQ_API_KEY"),
)
result = llm.with_structured_output(Reflection).invoke(formatted_prompt)
backend/src/agent/graph.py
Outdated
| ) | ||
| unique_sources.append(source) | ||
| # init Reasoning Model via Groq | ||
| result = groq_llm.invoke(formatted_prompt) |
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.
Similar to the reflection node, the reasoning_model from the state is being ignored. This node unconditionally uses the global groq_llm instance with its hardcoded model, rendering the --reasoning-model CLI argument useless for this final step. Please initialize a ChatGroq instance dynamically with the model from the state.
reasoning_model = state.get("reasoning_model") or "llama-3.3-70b-versatile"
llm = ChatGroq(
model=reasoning_model,
temperature=0,
api_key=os.getenv("GROQ_API_KEY"),
)
result = llm.invoke(formatted_prompt)
backend/examples/cli_research.py
Outdated
|
|
||
| def main() -> None: | ||
| """Run the research agent from the command line.""" | ||
| parser = argparse.ArgumentParser(description="Run the LangGraph research agent") |
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.
The docstring for the main function was removed. Per PEP 257, it's good practice to include docstrings for all public functions to improve readability and maintainability. Please consider adding it back.
| parser = argparse.ArgumentParser(description="Run the LangGraph research agent") | |
| """Run the research agent from the command line.""" | |
| parser = argparse.ArgumentParser(description="Run the LangGraph research agent") |
| parser.add_argument( | ||
| "--dir", | ||
| type=str, | ||
| help="Directory to search in", | ||
| default=None | ||
| ) |
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.
The formatting for this add_argument call is inconsistent with the others in this file and not well-aligned. For improved readability and consistency, please format it as a single line, similar to the other arguments.
parser.add_argument("--dir", type=str, help="Directory to search in", default=None)
No description provided.