Conversation
There was a problem hiding this comment.
Hello @ankumar, 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 README.md file for the Javelin Python client package. The primary change is the removal of several code examples related to Direct OpenAI-Compatible Usage, Using Javelin SDK, and Using Universal Endpoints in OpenAI-Compatible Format. The section on Universal Endpoints is moved higher up in the document, and the 'Additional Integration Patterns' section is moved to the bottom of the document.
Highlights
- Code Example Removal: Removes code examples for Direct OpenAI-Compatible Usage, Javelin SDK usage, and Universal Endpoints in OpenAI-Compatible Format from the README.
- Section Reorganization: Moves the 'Universal Endpoints' section higher in the document and the 'Additional Integration Patterns' section to the end.
- Documentation Update: The documentation is updated to reflect the current best practices for universal endpoints.
Changelog
- README.md
- Removed Direct OpenAI-Compatible Usage code example.
- Removed Javelin SDK usage code example.
- Removed Universal Endpoints in OpenAI-Compatible Format code example.
- Moved the Universal Endpoints section higher in the document.
- Moved the Additional Integration Patterns section to the bottom of the document.
- Added a newline after the Javelin documentation link.
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 README's tale,
Code examples now set sail,
Docs shift and align.
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 README.md file to improve the documentation and provide more information about Javelin. The changes include adding a link to the Javelin documentation, removing outdated examples, and adding a section on universal endpoints. Overall, the changes are well-organized and improve the clarity of the README.
Merge Readiness
The changes in this pull request enhance the README.md file by providing updated information and removing outdated content. The addition of the Javelin documentation link and the section on universal endpoints are valuable improvements. I am unable to approve this pull request, and users should have others review and approve this code before merging. Given the nature of the changes, the pull request appears ready to be merged.
|
|
||
| ### Direct OpenAI-Compatible Usage | ||
|
|
||
| ```python | ||
| from openai import OpenAI | ||
|
|
||
| # Initialize client with Javelin endpoint | ||
| client = OpenAI( | ||
| base_url="https://api.javelin.live/v1/query/your_route", | ||
| api_key="your_api_key" | ||
| ) | ||
|
|
||
| # Make requests using standard OpenAI format | ||
| response = client.chat.completions.create( | ||
| model="gpt-3.5-turbo", | ||
| messages=[ | ||
| {"role": "system", "content": "You are a helpful assistant."}, | ||
| {"role": "user", "content": "Hello!"} | ||
| ] | ||
| ) | ||
| ``` | ||
|
|
||
| ### Using Javelin SDK | ||
|
|
||
| ```python | ||
| import os | ||
| from openai import OpenAI | ||
| import dotenv | ||
| dotenv.load_dotenv() | ||
| # Configure regular route with Javelin headers | ||
| javelin_api_key = os.getenv("JAVELIN_API_KEY") | ||
| llm_api_key = os.getenv("OPENAI_API_KEY") | ||
| javelin_headers = { | ||
| "x-api-key": javelin_api_key, | ||
| } | ||
|
|
||
| client = OpenAI( | ||
| base_url="https://api-dev.javelin.live/v1/query/<route>", | ||
| default_headers=javelin_headers | ||
| ) | ||
|
|
||
| response = client.chat.completions.create( | ||
| model="gpt-4o", | ||
| messages=[ | ||
| {"role": "user", "content": "hello"} | ||
| ], | ||
| ) | ||
|
|
||
| print(response.model_dump_json(indent=2)) | ||
| ``` | ||
|
|
||
| ### Using Universal Endpoints in OpenAI-Compatible Format | ||
|
|
||
| ```python | ||
| from javelin_sdk import JavelinClient, JavelinConfig | ||
|
|
||
| # Setup client configuration | ||
| config = JavelinConfig( | ||
| base_url="https://api.javelin.live", | ||
| javelin_api_key="your_javelin_api_key" | ||
| ) | ||
|
|
||
| client = JavelinClient(config) | ||
|
|
||
| # Set headers for universal endpoint | ||
| custom_headers = { | ||
| "Content-Type": "application/json", | ||
| "x-javelin-route": "univ_bedrock" # Change route as needed (univ_azure, univ_bedrock, univ_gemini) | ||
| } | ||
| client.set_headers(custom_headers) | ||
|
|
||
| # Make requests using OpenAI format | ||
| response = client.chat.completions.create( | ||
| messages=[ | ||
| {"role": "system", "content": "You are a helpful assistant."}, | ||
| {"role": "user", "content": "What are the three primary colors?"} | ||
| ], | ||
| temperature=0.7, | ||
| max_tokens=150, | ||
| model="amazon.titan-text-express-v1" # Use appropriate model for your endpoint | ||
| ) | ||
| ``` | ||
|
|
||
| ## Additional Integration Patterns | ||
|
|
||
| For more detailed examples and integration patterns, check out: | ||
|
|
||
| - [Azure OpenAI Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) | ||
| - [AWS Bedrock Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) | ||
| - [Supported Language Models](https://docs.getjavelin.io/docs/javelin-core/supported-llms) | ||
|
|
||
| ## [Universal Endpoints](https://docs.getjavelin.io/docs/javelin-core/integration#unified-endpoints) | ||
|
|
||
| Javelin provides universal endpoints that allow you to use a consistent interface across different LLM providers. Here are the main patterns: |
There was a problem hiding this comment.
The heading level here is inconsistent with the rest of the document. It was previously ### and now it's ##. Consider using ### to maintain consistency.
| ### Direct OpenAI-Compatible Usage | |
| ```python | |
| from openai import OpenAI | |
| # Initialize client with Javelin endpoint | |
| client = OpenAI( | |
| base_url="https://api.javelin.live/v1/query/your_route", | |
| api_key="your_api_key" | |
| ) | |
| # Make requests using standard OpenAI format | |
| response = client.chat.completions.create( | |
| model="gpt-3.5-turbo", | |
| messages=[ | |
| {"role": "system", "content": "You are a helpful assistant."}, | |
| {"role": "user", "content": "Hello!"} | |
| ] | |
| ) | |
| ``` | |
| ### Using Javelin SDK | |
| ```python | |
| import os | |
| from openai import OpenAI | |
| import dotenv | |
| dotenv.load_dotenv() | |
| # Configure regular route with Javelin headers | |
| javelin_api_key = os.getenv("JAVELIN_API_KEY") | |
| llm_api_key = os.getenv("OPENAI_API_KEY") | |
| javelin_headers = { | |
| "x-api-key": javelin_api_key, | |
| } | |
| client = OpenAI( | |
| base_url="https://api-dev.javelin.live/v1/query/<route>", | |
| default_headers=javelin_headers | |
| ) | |
| response = client.chat.completions.create( | |
| model="gpt-4o", | |
| messages=[ | |
| {"role": "user", "content": "hello"} | |
| ], | |
| ) | |
| print(response.model_dump_json(indent=2)) | |
| ``` | |
| ### Using Universal Endpoints in OpenAI-Compatible Format | |
| ```python | |
| from javelin_sdk import JavelinClient, JavelinConfig | |
| # Setup client configuration | |
| config = JavelinConfig( | |
| base_url="https://api.javelin.live", | |
| javelin_api_key="your_javelin_api_key" | |
| ) | |
| client = JavelinClient(config) | |
| # Set headers for universal endpoint | |
| custom_headers = { | |
| "Content-Type": "application/json", | |
| "x-javelin-route": "univ_bedrock" # Change route as needed (univ_azure, univ_bedrock, univ_gemini) | |
| } | |
| client.set_headers(custom_headers) | |
| # Make requests using OpenAI format | |
| response = client.chat.completions.create( | |
| messages=[ | |
| {"role": "system", "content": "You are a helpful assistant."}, | |
| {"role": "user", "content": "What are the three primary colors?"} | |
| ], | |
| temperature=0.7, | |
| max_tokens=150, | |
| model="amazon.titan-text-express-v1" # Use appropriate model for your endpoint | |
| ) | |
| ``` | |
| ## Additional Integration Patterns | |
| For more detailed examples and integration patterns, check out: | |
| - [Azure OpenAI Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) | |
| - [AWS Bedrock Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) | |
| - [Supported Language Models](https://docs.getjavelin.io/docs/javelin-core/supported-llms) | |
| ## [Universal Endpoints](https://docs.getjavelin.io/docs/javelin-core/integration#unified-endpoints) | |
| Javelin provides universal endpoints that allow you to use a consistent interface across different LLM providers. Here are the main patterns: | |
| ### [Universal Endpoints](https://docs.getjavelin.io/docs/javelin-core/integration#unified-endpoints) | |
| For more detailed examples and integration patterns, check out: | ||
|
|
||
| - [Azure OpenAI Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) | ||
| - [AWS Bedrock Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) |
There was a problem hiding this comment.
The URL for AWS Bedrock Integration appears to be the same as for Azure OpenAI Integration. Please verify and update the AWS link to point to the correct documentation.
| - [AWS Bedrock Integration](https://docs.getjavelin.io/docs/javelin-core/integration#2-azure-openai-api-endpoints) | |
| - [AWS Bedrock Integration](https://docs.getjavelin.io/docs/javelin-core/integration#3-aws-bedrock-api-endpoints) |
No description provided.