-
Notifications
You must be signed in to change notification settings - Fork 1
fix: Update README.md #170
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |||||
| This is the Python client package for Javelin. | ||||||
|
|
||||||
| For more information about Javelin, see https://getjavelin.com | ||||||
|
|
||||||
| Javelin Documentation: https://docs.getjavelin.io | ||||||
|
|
||||||
| ### Development | ||||||
|
|
@@ -64,96 +65,6 @@ poetry build | |||||
| pip install dist/javelin_sdk-<version>-py3-none-any.whl | ||||||
| ``` | ||||||
|
|
||||||
| ### 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: | ||||||
|
|
@@ -173,7 +84,6 @@ Javelin provides universal endpoints that allow you to use a consistent interfac | |||||
| - [Universal endpoint implementation](examples/gemini/javelin_gemini_univ_endpoint.py) | ||||||
| - [OpenAI-compatible interface](examples/gemini/openai_compatible_univ_gemini.py) | ||||||
|
|
||||||
|
|
||||||
| ### Agent Examples | ||||||
| - [CrewAI integration](examples/agents/crewai_javelin.ipynb) | ||||||
| - [LangGraph integration](examples/agents/langgraph_javelin.ipynb) | ||||||
|
|
@@ -186,3 +96,11 @@ Javelin provides universal endpoints that allow you to use a consistent interfac | |||||
| ### Advanced Examples | ||||||
| - [Document processing](examples/gemini/document_processing.py) | ||||||
| - [RAG implementation](examples/rag/javelin_rag_embeddings_demo.ipynb) | ||||||
|
|
||||||
| ## 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) | ||||||
|
||||||
| - [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) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The heading level here is inconsistent with the rest of the document. It was previously
###and now it's##. Consider using###to maintain consistency.