Feat/adk hello world - #2
Conversation
There was a problem hiding this comment.
Summary of Changes
Hello @vmehmeri, 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 foundational "Hello World" examples for both Google ADK and FastAPI, providing a quick start for new features or projects. It also includes relevant documentation updates to reflect these additions and clarify development environment setup.
Highlights
- Google ADK "Hello World" Example: Introduces a new Python script (adk_hello_world/main.py) that demonstrates how to create and interact with a simple Google ADK agent designed to say "Hello, World!".
- FastAPI Bootstrap Application: Adds a basic FastAPI application (app/main.py) with a root endpoint that returns "Hello: World", along with its required dependencies (app/requirements.txt).
- Documentation Updates: Updates the CHANGELOG.md to reflect the new FastAPI bootstrap feature under version 0.2 and adds a new GEMINI.md file to specify Python 3.12 and uv as the dependency manager.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request introduces a 'hello world' example for the Google ADK and a basic FastAPI application. The changes are straightforward and add new functionality. I've provided a couple of suggestions to improve code structure and adhere to common best practices. One suggestion is for the new adk_hello_world/main.py to encapsulate the script logic within a main function, which is a standard Python practice for better modularity. The other is a minor formatting improvement for GEMINI.md.
| # GEMINI.md | ||
|
|
||
| We use Python 3.12 and uv for dependency management. No newline at end of file |
There was a problem hiding this comment.
The heading # GEMINI.md is redundant since it's the same as the filename. It's also a good practice for text files to end with a newline for POSIX compatibility and to avoid issues with some tools.
| # GEMINI.md | |
| We use Python 3.12 and uv for dependency management. | |
| We use Python 3.12 and uv for dependency management. | |
| from google.adk import Agent | ||
|
|
||
| # Create a simple agent | ||
| hello_agent = Agent( | ||
| name='hello_agent', | ||
| instruction='You are a friendly agent that says "Hello, World!".' | ||
| ) | ||
|
|
||
| # Interact with the agent | ||
| response = hello_agent.process('Say hi') | ||
|
|
||
| # Print the response | ||
| print(response.text) |
There was a problem hiding this comment.
The script's logic is currently in the global scope. It's a best practice in Python to encapsulate the main logic in a function (e.g., main) and use an if __name__ == "__main__": block to call it. This prevents the code from running when the module is imported elsewhere, improving reusability and modularity. I've also added a docstring to the new function for clarity.
from google.adk import Agent
def main():
"""Runs the hello world agent."""
# Create a simple agent
hello_agent = Agent(
name='hello_agent',
instruction='You are a friendly agent that says "Hello, World!".'
)
# Interact with the agent
response = hello_agent.process('Say hi')
# Print the response
print(response.text)
if __name__ == "__main__":
main()
No description provided.