Conversation
There was a problem hiding this comment.
Hello @dhruvj07, 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!
Summary of Changes
This pull request updates the examples for Azure OpenAI and Bedrock clients. For Azure OpenAI, the model name is changed from gpt-4 to gpt35 in both synchronous and streaming examples. For Bedrock, the payload structure for bedrock_converse_example and bedrock_converse_stream_example is updated to simplify the message format, changing the system and content fields from lists of dictionaries to simple strings.
Highlights
- Azure OpenAI Model Update: The model name in the Azure OpenAI examples has been updated from
gpt-4togpt35. - Bedrock Payload Simplification: The payload structure for Bedrock examples has been simplified by changing the
systemandcontentfields to simple strings.
Changelog
- examples/azure-openai/azure-universal.py
- Updated model name from
gpt-4togpt35inget_chat_completion_sync. - Updated model name from
gpt-4togpt35inget_chat_completion_stream.
- Updated model name from
- examples/bedrock/bedrock_client_universal.py
- Simplified the payload structure for
bedrock_converse_exampleby changing thesystemandcontentfields to strings. - Simplified the payload structure for
bedrock_converse_stream_exampleby changing thesystemandcontentfields to strings. - Removed an extra newline between the end of the
bedrock_invoke_stream_examplefunction and the start of thebedrock_converse_stream_examplefunction.
- Simplified the payload structure for
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 is currently in preview and 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 to provide feedback.
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.
Azure's models shift with grace,
Bedrock's payloads find their place,
Strings align with care,
Examples now more clear,
Code's evolution, time and space.
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
The pull request updates the models used in the Azure OpenAI examples and modifies the payload structure for Bedrock LLM calls. The changes seem reasonable, but I have a few suggestions to improve clarity and maintainability.
Summary of Findings
- Model ID Consistency: The model ID 'gpt35' is used in the Azure OpenAI examples. It's important to ensure this model ID is valid and consistent with the intended use case. Consider adding a comment explaining why this specific model is chosen.
- Bedrock Payload Structure: The payload structure for Bedrock LLM calls has been updated to simplify the 'system' and 'content' fields. While this reduces verbosity, ensure that the new structure is fully compatible with the Bedrock API and that all necessary information is being passed correctly.
Merge Readiness
The changes appear to be functional, but I recommend addressing the comments to improve code clarity and ensure compatibility with the respective APIs. I am unable to approve this pull request, and other reviewers should review and approve this code before merging.
|
|
||
| response = azure_client.chat.completions.create( | ||
| model="gpt-4", messages=messages # Adjust to your Azure deployment name | ||
| model="gpt35", messages=messages # Adjust to your Azure deployment name |
| """ | ||
| response = azure_client.chat.completions.create( | ||
| model="gpt-4", # Adjust to your Azure deployment name | ||
| model="gpt35", # Adjust to your Azure deployment name |
| "system": [ | ||
| {"type": "text", "text": "You are an economist with access to lots of data"} | ||
| ], | ||
| "system": "You are an economist with access to lots of data", |
| { | ||
| "role": "user", | ||
| "content": [{"type": "text", "text": "Write an article about the impact of high inflation on a country's GDP"}] | ||
| "content": "Write an article about the impact of high inflation on a country's GDP" |
There was a problem hiding this comment.
| "system": [ | ||
| {"type": "text", "text": "You are an economist with access to lots of data"} | ||
| ], | ||
| "system": "You are an economist with access to lots of data", |
| { | ||
| "role": "user", | ||
| "content": [{"type": "text", "text": "Write an article about the impact of high inflation on a country's GDP"}] | ||
| "content": "Write an article about the impact of high inflation on a country's GDP" |
There was a problem hiding this comment.
No description provided.