Skip to content

update models suffix endpoint for azure deployed model, updated payload for bedrock llm call#180

Merged
dhruvj07 merged 3 commits intomainfrom
sdk-run-updated-providers-branch
Apr 10, 2025
Merged

update models suffix endpoint for azure deployed model, updated payload for bedrock llm call#180
dhruvj07 merged 3 commits intomainfrom
sdk-run-updated-providers-branch

Conversation

@dhruvj07
Copy link
Copy Markdown
Contributor

@dhruvj07 dhruvj07 commented Apr 9, 2025

No description provided.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-4 to gpt35.
  • Bedrock Payload Simplification: The payload structure for Bedrock examples has been simplified by changing the system and content fields to simple strings.

Changelog

  • examples/azure-openai/azure-universal.py
    • Updated model name from gpt-4 to gpt35 in get_chat_completion_sync.
    • Updated model name from gpt-4 to gpt35 in get_chat_completion_stream.
  • examples/bedrock/bedrock_client_universal.py
    • Simplified the payload structure for bedrock_converse_example by changing the system and content fields to strings.
    • Simplified the payload structure for bedrock_converse_stream_example by changing the system and content fields to strings.
    • Removed an extra newline between the end of the bedrock_invoke_stream_example function and the start of the bedrock_converse_stream_example function.
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

  1. 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.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider adding a comment explaining why 'gpt35' is being used here. Is this a specific deployment name or a general model ID?

        model="gpt35", messages=messages  # Adjust to your Azure deployment name, using gpt35 model

"""
response = azure_client.chat.completions.create(
model="gpt-4", # Adjust to your Azure deployment name
model="gpt35", # Adjust to your Azure deployment name
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Same here, consider adding a comment explaining why 'gpt35' is being used here.

        model="gpt35",  # Adjust to your Azure deployment name, using gpt35 model

"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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The 'system' field is now a string instead of a list of dictionaries. Ensure this change is compatible with the Bedrock API and that the system prompt is being correctly interpreted.

                "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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The 'content' field is now a string instead of a list of dictionaries. Ensure this change is compatible with the Bedrock API and that the user message is being correctly interpreted.

                        "content": "Write an article about the impact of high inflation on a country's GDP"

"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",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The 'system' field is now a string instead of a list of dictionaries. Ensure this change is compatible with the Bedrock API and that the system prompt is being correctly interpreted.

                "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"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The 'content' field is now a string instead of a list of dictionaries. Ensure this change is compatible with the Bedrock API and that the user message is being correctly interpreted.

                        "content": "Write an article about the impact of high inflation on a country's GDP"

@dhruvj07 dhruvj07 merged commit 0f52881 into main Apr 10, 2025
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants