Skip to content

feat: update universal endpoint scripts#195

Merged
abhijitjavelin merged 1 commit intomainfrom
update_models
May 28, 2025
Merged

feat: update universal endpoint scripts#195
abhijitjavelin merged 1 commit intomainfrom
update_models

Conversation

@abhijitjavelin
Copy link
Copy Markdown
Contributor

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 @abhijitjavelin, 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

Hello! Gemini or gemini-code-assist here, providing a summary of this pull request to help everyone get up to speed quickly.

This pull request, titled "feat: update universal endpoint scripts", appears to focus on refining how providers (like OpenAI, Azure OpenAI, and Bedrock) are registered with the Javelin client, particularly in the context of "universal endpoints". The changes involve simplifying the registration calls in example scripts by removing the explicit route_name parameter and adjusting the SDK's internal logic to handle default route names. Additionally, new fields related to secret management have been added to the Secret model.

Highlights

  • SDK Registration Logic Updates: The Javelin SDK's register_provider method now defaults the route_name if not explicitly provided. Specifically for Bedrock, if no route_name is given, it will default to "amazon". The x-javelin-provider header setting based on the base URL has also been removed from the register_provider method.
  • Secret Model Enhancements: The Secret model has been updated to include a new SecretType enum (AWS, KUBERNETES) and two new fields: secret_name and secrets_provider, indicating the name and type of the secret source.

Changelog

Click here to see the changelog
  • examples/azure-openai/azure-universal.py
    • Updated the AzureOpenAI client initialization to specify api_version="2023-09-15-preview" and removed other parameters (lines 34-37).
    • Removed the route_name argument from the javelin_client.register_azureopenai call (line 40).
  • examples/bedrock/bedrock_client_universal.py
    • Removed the route_name argument from the javelin_client.register_bedrock call (line 29).
  • examples/openai/openai-universal.py
    • Removed the route_name argument from the client.register_openai call (line 42).
  • javelin_sdk/client.py
    • Removed the line setting the x-javelin-provider header based on the base URL in register_provider (line 202).
    • Added logic in register_provider to default route_name to provider_name if route_name is not provided (line 202).
    • Changed the default value for the route_name parameter in register_openai and register_azureopenai methods from None to "" (lines 524, 529).
    • Changed the default value for the route_name parameter in the register_bedrock method from None to "" (line 549).
    • Added logic within register_bedrock to explicitly set route_name to "amazon" if it is not provided (lines 585-586).
  • javelin_sdk/models.py
    • Added the SecretType enum with values "aws" and "kubernetes" (lines 353-355).
    • Added secret_name and secrets_provider fields to the Secret model (lines 373-374).
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.


A route name removed,
Default logic improved,
Secrets now typed,
Code neatly swiped,
Universal path approved.

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 universal endpoint scripts, primarily focusing on simplifying the registration process for different providers (Azure OpenAI, Bedrock, OpenAI) by removing the explicit route_name parameter in the registration methods and providing a default route name. Additionally, it introduces a SecretType enum and updates the Secret model to include secret_name and secrets_provider fields.

Summary of Findings

  • Default Route Names: The route_name parameter is removed from the registration methods, and default route names are used. Ensure that these defaults are appropriate for all use cases, or provide configuration options for users to override them.
  • SecretType Default: The secrets_provider field defaults to SecretType.KUBERNETES. Verify that this is the most common or appropriate default.
  • Azure OpenAI Configuration: The azure_endpoint and api_key parameters are removed from the AzureOpenAI initialization. Ensure that these values are now being sourced from environment variables or another configuration mechanism, and that appropriate checks are in place to handle missing values.

Merge Readiness

The pull request introduces useful simplifications and enhancements. However, it's important to ensure that the default route names and secret provider are appropriate for all use cases, and that the Azure OpenAI configuration is handled correctly. I would recommend addressing these points before merging. I am unable to directly approve this pull request, and other reviewers should also review this code before merging.

Comment thread javelin_sdk/client.py
Comment on lines +524 to 532
def register_openai(self, openai_client: Any, route_name: str = "") -> Any:
return self.register_provider(
openai_client, provider_name="openai", route_name=route_name
)

def register_azureopenai(self, openai_client: Any, route_name: str = None) -> Any:
def register_azureopenai(self, openai_client: Any, route_name: str = "") -> Any:
return self.register_provider(
openai_client, provider_name="azureopenai", route_name=route_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

The default value for route_name in register_openai and register_azureopenai is changed from None to "". While this aligns with the intention of using a default route name, it might be more explicit to keep it as None and handle the default assignment within the register_provider method. This would centralize the logic for default route name assignment.

Suggested change
def register_openai(self, openai_client: Any, route_name: str = "") -> Any:
return self.register_provider(
openai_client, provider_name="openai", route_name=route_name
)
def register_azureopenai(self, openai_client: Any, route_name: str = None) -> Any:
def register_azureopenai(self, openai_client: Any, route_name: str = "") -> Any:
return self.register_provider(
openai_client, provider_name="azureopenai", route_name=route_name
)
def register_openai(self, openai_client: Any, route_name: str = None) -> Any:
return self.register_provider(
openai_client, provider_name="openai", route_name=route_name
)
def register_azureopenai(self, openai_client: Any, route_name: str = None) -> Any:
return self.register_provider(
openai_client, provider_name="azureopenai", route_name=route_name
)

Comment thread javelin_sdk/models.py
Comment on lines +373 to +374
secret_name: str = Field(default=None, description="Secret Name of the Secret")
secrets_provider: SecretType = Field(default=SecretType.KUBERNETES, description="Type of the secret: aws or kubernetes")
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 secrets_provider field defaults to SecretType.KUBERNETES. Ensure that this is the most common or appropriate default. If AWS is more common, consider making that the default, or provide a configuration option.

@abhijitjavelin abhijitjavelin merged commit 0d7136b into main May 28, 2025
7 of 8 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.

3 participants