Skip to content

Commit a13dc76

Browse files
authored
Merge pull request #174 from getjavelin/update_baseurl
fix: update base url to use environment variables
2 parents 419266c + 6e99325 commit a13dc76

39 files changed

Lines changed: 1088 additions & 40 deletions

examples/anthropic/javelin_anthropic_univ_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None:
1818

1919
# Setup client configuration for Bedrock
2020
config = JavelinConfig(
21-
base_url="https://api-dev.javelin.live",
21+
base_url=os.getenv("JAVELIN_BASE_URL"),
2222
javelin_api_key=os.getenv("JAVELIN_API_KEY"),
2323
)
2424
client = JavelinClient(config)

examples/anthropic/openai_compatible_univ_anthropic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None:
1515

1616
# Setup client configuration
1717
config = JavelinConfig(
18-
base_url="https://api-dev.javelin.live",
18+
base_url=os.getenv("JAVELIN_BASE_URL"),
1919
javelin_api_key=os.getenv("JAVELIN_API_KEY"),
2020
timeout=120,
2121
)

examples/azure-openai/azure_general_route.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def init_azure_client_sync():
1818
javelin_headers = {"x-api-key": javelin_api_key}
1919
client = AzureOpenAI(
2020
api_key=llm_api_key,
21-
base_url="https://api-dev.javelin.live/v1/query/azure-openai",
21+
base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai",
2222
default_headers=javelin_headers,
2323
api_version="2024-02-15-preview"
2424
)

examples/azure-openai/azure_openai_javelin_stream_&_non-stream.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ import { Stream } from 'openai/streaming.mjs';
44
const javelinApiKey = ""; // javelin api key here
55
const llmApiKey = ""; // llm api key
66

7-
const javelinBaseUrl = 'https://api.javelin.live/v1/query';
87

98
async function getCompletion() {
109
try {
1110
const routeName = 'AzureOpenAIRoute';
12-
const url = "https://api.javelin.live/v1/query/AzureOpenAIRoute";
11+
const url = `${process.env.JAVELIN_BASE_URL}/v1/query/${routeName}`;
1312

1413
const response = await axios.post(
1514
url,

examples/azure-openai/javelin_azureopenai_univ_endpoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None:
1414

1515
# Setup client configuration
1616
config = JavelinConfig(
17-
base_url="https://api-dev.javelin.live",
17+
base_url=os.getenv("JAVELIN_BASE_URL"),
1818
javelin_api_key=os.getenv("JAVELIN_API_KEY"),
1919
default_headers={
2020
"Content-Type": "application/json",

examples/azure-openai/langchain_azure_universal.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
load_dotenv()
1414
azure_openai_api_key = os.getenv("AZURE_OPENAI_API_KEY")
1515
javelin_api_key = os.getenv("JAVELIN_API_KEY")
16-
base_url = os.getenv(
17-
"JAVELIN_BASE_URL", "https://api.javelin.live"
18-
) # Default to generic base URL
16+
base_url = os.getenv("JAVELIN_BASE_URL")
1917

2018
# The name of your Azure deployment (e.g., "gpt-4")
2119
# or whatever you’ve set in Azure. Must also match x-javelin-model if

examples/azure-openai/langchain_chatmodel_example.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
dotenv.load_dotenv()
55

66
from langchain_openai import AzureChatOpenAI
7-
7+
url = os.path.join(os.getenv("JAVELIN_BASE_URL"), "v1")
8+
print(url)
89
model = AzureChatOpenAI(
9-
azure_endpoint="https://api-dev.javelin.live/v1",
10+
azure_endpoint=url,
1011
azure_deployment="gpt35",
1112
openai_api_version="2023-03-15-preview",
1213
extra_headers={"x-javelin-route": "azureopenai_univ", "x-api-key": os.environ.get("JAVELIN_API_KEY")}

examples/azure-openai/openai_azureopenai_testing.ipynb

Lines changed: 984 additions & 1 deletion
Large diffs are not rendered by default.

examples/azure-openai/openai_compatible_univ_azure.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None:
1717

1818
# Setup client configuration
1919
config = JavelinConfig(
20-
base_url="https://api-dev.javelin.live",
20+
base_url=os.getenv("JAVELIN_BASE_URL"),
2121
javelin_api_key=os.getenv("JAVELIN_API_KEY"),
2222
timeout=120,
2323
)

examples/bedrock/bedrock_client_universal.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ def init_bedrock():
2323

2424
# Initialize Javelin Client (if you want the route registered)
2525
config = JavelinConfig(
26-
javelin_api_key=os.getenv("JAVELIN_API_KEY") # Replace with your Javelin API key
26+
javelin_api_key=os.getenv("JAVELIN_API_KEY"), # Replace with your Javelin API key
27+
base_url=os.getenv("JAVELIN_BASE_URL")
2728
)
2829
javelin_client = JavelinClient(config)
2930

0 commit comments

Comments
 (0)