From 5873cf6cb29fd07fa5f71f2b90e13c8422beb2ec Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 6 Jan 2026 09:35:57 +0530 Subject: [PATCH 01/18] update pyproject --- {javelin_sdk => highflame_sdk}/__init__.py | 0 {javelin_sdk => highflame_sdk}/chat_completions.py | 0 {javelin_sdk => highflame_sdk}/client.py | 0 {javelin_sdk => highflame_sdk}/exceptions.py | 0 {javelin_sdk => highflame_sdk}/model_adapters.py | 0 {javelin_sdk => highflame_sdk}/models.py | 0 {javelin_sdk => highflame_sdk}/services/aispm_service.py | 0 {javelin_sdk => highflame_sdk}/services/gateway_service.py | 0 .../services/guardrails_service.py | 0 .../services/modelspec_service.py | 0 {javelin_sdk => highflame_sdk}/services/provider_service.py | 0 {javelin_sdk => highflame_sdk}/services/route_service.py | 0 {javelin_sdk => highflame_sdk}/services/secret_service.py | 0 {javelin_sdk => highflame_sdk}/services/template_service.py | 0 {javelin_sdk => highflame_sdk}/services/trace_service.py | 0 {javelin_sdk => highflame_sdk}/tracing_setup.py | 0 pyproject.toml | 6 +++--- 17 files changed, 3 insertions(+), 3 deletions(-) rename {javelin_sdk => highflame_sdk}/__init__.py (100%) rename {javelin_sdk => highflame_sdk}/chat_completions.py (100%) rename {javelin_sdk => highflame_sdk}/client.py (100%) rename {javelin_sdk => highflame_sdk}/exceptions.py (100%) rename {javelin_sdk => highflame_sdk}/model_adapters.py (100%) rename {javelin_sdk => highflame_sdk}/models.py (100%) rename {javelin_sdk => highflame_sdk}/services/aispm_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/gateway_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/guardrails_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/modelspec_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/provider_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/route_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/secret_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/template_service.py (100%) rename {javelin_sdk => highflame_sdk}/services/trace_service.py (100%) rename {javelin_sdk => highflame_sdk}/tracing_setup.py (100%) diff --git a/javelin_sdk/__init__.py b/highflame_sdk/__init__.py similarity index 100% rename from javelin_sdk/__init__.py rename to highflame_sdk/__init__.py diff --git a/javelin_sdk/chat_completions.py b/highflame_sdk/chat_completions.py similarity index 100% rename from javelin_sdk/chat_completions.py rename to highflame_sdk/chat_completions.py diff --git a/javelin_sdk/client.py b/highflame_sdk/client.py similarity index 100% rename from javelin_sdk/client.py rename to highflame_sdk/client.py diff --git a/javelin_sdk/exceptions.py b/highflame_sdk/exceptions.py similarity index 100% rename from javelin_sdk/exceptions.py rename to highflame_sdk/exceptions.py diff --git a/javelin_sdk/model_adapters.py b/highflame_sdk/model_adapters.py similarity index 100% rename from javelin_sdk/model_adapters.py rename to highflame_sdk/model_adapters.py diff --git a/javelin_sdk/models.py b/highflame_sdk/models.py similarity index 100% rename from javelin_sdk/models.py rename to highflame_sdk/models.py diff --git a/javelin_sdk/services/aispm_service.py b/highflame_sdk/services/aispm_service.py similarity index 100% rename from javelin_sdk/services/aispm_service.py rename to highflame_sdk/services/aispm_service.py diff --git a/javelin_sdk/services/gateway_service.py b/highflame_sdk/services/gateway_service.py similarity index 100% rename from javelin_sdk/services/gateway_service.py rename to highflame_sdk/services/gateway_service.py diff --git a/javelin_sdk/services/guardrails_service.py b/highflame_sdk/services/guardrails_service.py similarity index 100% rename from javelin_sdk/services/guardrails_service.py rename to highflame_sdk/services/guardrails_service.py diff --git a/javelin_sdk/services/modelspec_service.py b/highflame_sdk/services/modelspec_service.py similarity index 100% rename from javelin_sdk/services/modelspec_service.py rename to highflame_sdk/services/modelspec_service.py diff --git a/javelin_sdk/services/provider_service.py b/highflame_sdk/services/provider_service.py similarity index 100% rename from javelin_sdk/services/provider_service.py rename to highflame_sdk/services/provider_service.py diff --git a/javelin_sdk/services/route_service.py b/highflame_sdk/services/route_service.py similarity index 100% rename from javelin_sdk/services/route_service.py rename to highflame_sdk/services/route_service.py diff --git a/javelin_sdk/services/secret_service.py b/highflame_sdk/services/secret_service.py similarity index 100% rename from javelin_sdk/services/secret_service.py rename to highflame_sdk/services/secret_service.py diff --git a/javelin_sdk/services/template_service.py b/highflame_sdk/services/template_service.py similarity index 100% rename from javelin_sdk/services/template_service.py rename to highflame_sdk/services/template_service.py diff --git a/javelin_sdk/services/trace_service.py b/highflame_sdk/services/trace_service.py similarity index 100% rename from javelin_sdk/services/trace_service.py rename to highflame_sdk/services/trace_service.py diff --git a/javelin_sdk/tracing_setup.py b/highflame_sdk/tracing_setup.py similarity index 100% rename from javelin_sdk/tracing_setup.py rename to highflame_sdk/tracing_setup.py diff --git a/pyproject.toml b/pyproject.toml index bd7c7f2..f7f714e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [tool.poetry] -name = "javelin-sdk" +name = "highflame-sdk" version = "0.2.7-dev" description = "Python client for Javelin" authors = ["Sharath Rajasekar "] @@ -8,11 +8,11 @@ license = "Apache-2.0" homepage = "https://getjavelin.com" packages = [ { include = "javelin_cli" }, - { include = "javelin_sdk" }, + { include = "highflame_sdk" }, ] [tool.poetry.scripts] -javelin = "javelin_cli.cli:main" +highflame = "javelin_cli.cli:main" [tool.poetry.dependencies] python = "^3.9" From 2f54f737bb13a18a8afe21e30d08de51f5949b26 Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 6 Jan 2026 09:39:29 +0530 Subject: [PATCH 02/18] update internal imports --- highflame_sdk/__init__.py | 6 ++--- highflame_sdk/chat_completions.py | 4 ++-- highflame_sdk/client.py | 24 ++++++++++---------- highflame_sdk/models.py | 2 +- highflame_sdk/services/aispm_service.py | 2 +- highflame_sdk/services/gateway_service.py | 4 ++-- highflame_sdk/services/guardrails_service.py | 4 ++-- highflame_sdk/services/modelspec_service.py | 4 ++-- highflame_sdk/services/provider_service.py | 4 ++-- highflame_sdk/services/route_service.py | 4 ++-- highflame_sdk/services/secret_service.py | 4 ++-- highflame_sdk/services/template_service.py | 4 ++-- highflame_sdk/services/trace_service.py | 4 ++-- highflame_sdk/tracing_setup.py | 2 +- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/highflame_sdk/__init__.py b/highflame_sdk/__init__.py index aa5b490..6927478 100644 --- a/highflame_sdk/__init__.py +++ b/highflame_sdk/__init__.py @@ -1,5 +1,5 @@ -from javelin_sdk.client import JavelinClient -from javelin_sdk.exceptions import ( +from highflame_sdk.client import JavelinClient +from highflame_sdk.exceptions import ( BadRequest, GatewayNotFoundError, InternalServerError, @@ -16,7 +16,7 @@ UnauthorizedError, ValidationError, ) -from javelin_sdk.models import ( +from highflame_sdk.models import ( Gateway, Gateways, JavelinConfig, diff --git a/highflame_sdk/chat_completions.py b/highflame_sdk/chat_completions.py index 4b01660..2f063d6 100644 --- a/highflame_sdk/chat_completions.py +++ b/highflame_sdk/chat_completions.py @@ -1,8 +1,8 @@ import logging from typing import Any, Dict, Generator, List, Optional, Union -from javelin_sdk.model_adapters import ModelTransformer, TransformationRuleManager -from javelin_sdk.models import EndpointType +from highflame_sdk.model_adapters import ModelTransformer, TransformationRuleManager +from highflame_sdk.models import EndpointType logger = logging.getLogger(__name__) diff --git a/highflame_sdk/client.py b/highflame_sdk/client.py index fba84de..58f6e50 100644 --- a/highflame_sdk/client.py +++ b/highflame_sdk/client.py @@ -10,18 +10,18 @@ from opentelemetry.semconv._incubating.attributes import gen_ai_attributes from opentelemetry.trace import SpanKind, Status, StatusCode -from javelin_sdk.chat_completions import Chat, Completions, Embeddings -from javelin_sdk.models import HttpMethod, JavelinConfig, Request -from javelin_sdk.services.gateway_service import GatewayService -from javelin_sdk.services.modelspec_service import ModelSpecService -from javelin_sdk.services.provider_service import ProviderService -from javelin_sdk.services.route_service import RouteService -from javelin_sdk.services.secret_service import SecretService -from javelin_sdk.services.template_service import TemplateService -from javelin_sdk.services.trace_service import TraceService -from javelin_sdk.services.aispm_service import AISPMService -from javelin_sdk.services.guardrails_service import GuardrailsService -from javelin_sdk.tracing_setup import configure_span_exporter +from highflame_sdk.chat_completions import Chat, Completions, Embeddings +from highflame_sdk.models import HttpMethod, JavelinConfig, Request +from highflame_sdk.services.gateway_service import GatewayService +from highflame_sdk.services.modelspec_service import ModelSpecService +from highflame_sdk.services.provider_service import ProviderService +from highflame_sdk.services.route_service import RouteService +from highflame_sdk.services.secret_service import SecretService +from highflame_sdk.services.template_service import TemplateService +from highflame_sdk.services.trace_service import TraceService +from highflame_sdk.services.aispm_service import AISPMService +from highflame_sdk.services.guardrails_service import GuardrailsService +from highflame_sdk.tracing_setup import configure_span_exporter API_BASEURL = "https://api-dev.javelin.live" API_BASE_PATH = "/v1" diff --git a/highflame_sdk/models.py b/highflame_sdk/models.py index a070d6c..3b5b2b5 100644 --- a/highflame_sdk/models.py +++ b/highflame_sdk/models.py @@ -2,7 +2,7 @@ from enum import Enum, auto from typing import Any, Dict, List, Optional -from javelin_sdk.exceptions import UnauthorizedError +from highflame_sdk.exceptions import UnauthorizedError from pydantic import BaseModel, Field, field_validator diff --git a/highflame_sdk/services/aispm_service.py b/highflame_sdk/services/aispm_service.py index 7cbf705..36288b0 100644 --- a/highflame_sdk/services/aispm_service.py +++ b/highflame_sdk/services/aispm_service.py @@ -2,7 +2,7 @@ from httpx import Response import json -from javelin_sdk.models import ( +from highflame_sdk.models import ( Customer, CustomerResponse, AWSConfig, diff --git a/highflame_sdk/services/gateway_service.py b/highflame_sdk/services/gateway_service.py index 5c1143b..349cf25 100644 --- a/highflame_sdk/services/gateway_service.py +++ b/highflame_sdk/services/gateway_service.py @@ -1,5 +1,5 @@ import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, GatewayAlreadyExistsError, GatewayNotFoundError, @@ -7,7 +7,7 @@ RateLimitExceededError, UnauthorizedError, ) -from javelin_sdk.models import Gateway, Gateways, HttpMethod, Request +from highflame_sdk.models import Gateway, Gateways, HttpMethod, Request class GatewayService: diff --git a/highflame_sdk/services/guardrails_service.py b/highflame_sdk/services/guardrails_service.py index eb37370..db557ca 100644 --- a/highflame_sdk/services/guardrails_service.py +++ b/highflame_sdk/services/guardrails_service.py @@ -1,11 +1,11 @@ import httpx from typing import Any, Dict, Optional -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, RateLimitExceededError, UnauthorizedError, ) -from javelin_sdk.models import HttpMethod, Request +from highflame_sdk.models import HttpMethod, Request class GuardrailsService: diff --git a/highflame_sdk/services/modelspec_service.py b/highflame_sdk/services/modelspec_service.py index 7a86825..f20e16f 100644 --- a/highflame_sdk/services/modelspec_service.py +++ b/highflame_sdk/services/modelspec_service.py @@ -1,13 +1,13 @@ from typing import Any, Dict, Optional import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, UnauthorizedError, ) -from javelin_sdk.models import HttpMethod, Request +from highflame_sdk.models import HttpMethod, Request class ModelSpecService: diff --git a/highflame_sdk/services/provider_service.py b/highflame_sdk/services/provider_service.py index 467c8ee..d0c6e47 100644 --- a/highflame_sdk/services/provider_service.py +++ b/highflame_sdk/services/provider_service.py @@ -1,7 +1,7 @@ from typing import Any, Dict, Optional import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, InternalServerError, ProviderAlreadyExistsError, @@ -9,7 +9,7 @@ RateLimitExceededError, UnauthorizedError, ) -from javelin_sdk.models import ( +from highflame_sdk.models import ( EndpointType, HttpMethod, Provider, diff --git a/highflame_sdk/services/route_service.py b/highflame_sdk/services/route_service.py index d9ec620..12cbc45 100644 --- a/highflame_sdk/services/route_service.py +++ b/highflame_sdk/services/route_service.py @@ -2,7 +2,7 @@ from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Union import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, @@ -10,7 +10,7 @@ RouteNotFoundError, UnauthorizedError, ) -from javelin_sdk.models import HttpMethod, Request, Route, Routes, UnivModelConfig +from highflame_sdk.models import HttpMethod, Request, Route, Routes, UnivModelConfig from jsonpath_ng import parse diff --git a/highflame_sdk/services/secret_service.py b/highflame_sdk/services/secret_service.py index e12dbcd..1e3747b 100644 --- a/highflame_sdk/services/secret_service.py +++ b/highflame_sdk/services/secret_service.py @@ -1,5 +1,5 @@ import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, @@ -7,7 +7,7 @@ SecretNotFoundError, UnauthorizedError, ) -from javelin_sdk.models import HttpMethod, Request, Secret, Secrets +from highflame_sdk.models import HttpMethod, Request, Secret, Secrets class SecretService: diff --git a/highflame_sdk/services/template_service.py b/highflame_sdk/services/template_service.py index bce1349..22f2fc7 100644 --- a/highflame_sdk/services/template_service.py +++ b/highflame_sdk/services/template_service.py @@ -1,5 +1,5 @@ import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, @@ -7,7 +7,7 @@ TemplateNotFoundError, UnauthorizedError, ) -from javelin_sdk.models import HttpMethod, Request, Template, Templates +from highflame_sdk.models import HttpMethod, Request, Template, Templates class TemplateService: diff --git a/highflame_sdk/services/trace_service.py b/highflame_sdk/services/trace_service.py index 486152f..0789b57 100644 --- a/highflame_sdk/services/trace_service.py +++ b/highflame_sdk/services/trace_service.py @@ -1,14 +1,14 @@ from typing import Any import httpx -from javelin_sdk.exceptions import ( +from highflame_sdk.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, TraceNotFoundError, UnauthorizedError, ) -from javelin_sdk.models import HttpMethod, Request, Template +from highflame_sdk.models import HttpMethod, Request, Template class TraceService: diff --git a/highflame_sdk/tracing_setup.py b/highflame_sdk/tracing_setup.py index dc77cf4..29014ec 100644 --- a/highflame_sdk/tracing_setup.py +++ b/highflame_sdk/tracing_setup.py @@ -1,4 +1,4 @@ -# javelin_sdk/tracing_setup.py +# highflame_sdk/tracing_setup.py # from opentelemetry.instrumentation.botocore import BotocoreInstrumentor import os from typing import Optional From 2bb09512276cca7f116e5e4fc7163b43e3a56ad4 Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 6 Jan 2026 10:19:12 +0530 Subject: [PATCH 03/18] feat: update env vars with old env fallback --- examples/agents/adk_gemini_agent_javelin/agent.py | 2 +- examples/agents/adk_openai_agent_javelin/agent.py | 2 +- examples/agents/openai_agents_javelin.py | 6 +++--- examples/anthropic/anthropic_api_function_calling.py | 4 ++-- examples/anthropic/anthropic_function_call.py | 4 ++-- examples/anthropic/javelin_anthropic_api_call.py | 4 ++-- examples/anthropic/javelin_anthropic_univ_endpoint.py | 4 ++-- examples/anthropic/openai_compatible_univ_anthropic.py | 4 ++-- examples/azure-openai/openai_compatible_univ_azure.py | 4 ++-- examples/bedrock/bedrock_client.py | 4 ++-- examples/bedrock/bedrock_client_universal.py | 2 +- examples/gemini/document_processing.py | 6 +++--- examples/gemini/gemini-universal.py | 2 +- examples/gemini/gemini_function_tool_call.py | 2 +- examples/gemini/javelin_gemini_univ_endpoint.py | 6 +++--- examples/gemini/langchain_chatmodel_example.py | 4 ++-- examples/gemini/openai_compatible_univ_gemini.py | 6 +++--- examples/gemini/strawberry.py | 6 +++--- .../guardrails/langgraph_guardrails_mcp_example.py | 6 +++--- examples/guardrails/test_guardrails.py | 2 +- examples/mistral/mistral_function_tool_call.py | 2 +- examples/openai/img_generations_example.py | 2 +- examples/openai/javelin_openai_univ_endpoint.py | 6 +++--- examples/openai/langchain-openai-universal.py | 4 ++-- examples/openai/langchain_callback_example.py | 4 ++-- examples/openai/langchain_chatmodel_example.py | 4 ++-- examples/openai/o1-03_function-calling.py | 8 ++++---- examples/openai/openai-universal.py | 6 +++--- examples/openai/openai_client.py | 4 ++-- examples/openai/openai_compatible_univ.py | 6 +++--- examples/openai/openai_embedding_example.py | 4 ++-- examples/openai/openai_general_route.py | 10 +++++----- examples/route_examples/aexample.py | 8 ++++---- examples/route_examples/drop_in_replacement.py | 8 ++++---- examples/route_examples/example.py | 8 ++++---- examples/route_examples/javelin_sdk_app.py | 8 ++++---- 36 files changed, 86 insertions(+), 86 deletions(-) diff --git a/examples/agents/adk_gemini_agent_javelin/agent.py b/examples/agents/adk_gemini_agent_javelin/agent.py index 57aed1c..65540d9 100644 --- a/examples/agents/adk_gemini_agent_javelin/agent.py +++ b/examples/agents/adk_gemini_agent_javelin/agent.py @@ -11,7 +11,7 @@ load_dotenv() GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") -JAVELIN_API_KEY = os.getenv("JAVELIN_API_KEY") +JAVELIN_API_KEY = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not GEMINI_API_KEY: raise ValueError("Missing GEMINI_API_KEY") diff --git a/examples/agents/adk_openai_agent_javelin/agent.py b/examples/agents/adk_openai_agent_javelin/agent.py index c1c98cb..babd14a 100644 --- a/examples/agents/adk_openai_agent_javelin/agent.py +++ b/examples/agents/adk_openai_agent_javelin/agent.py @@ -10,7 +10,7 @@ load_dotenv() -JAVELIN_API_KEY = os.getenv("JAVELIN_API_KEY") +JAVELIN_API_KEY = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") if not JAVELIN_API_KEY: diff --git a/examples/agents/openai_agents_javelin.py b/examples/agents/openai_agents_javelin.py index a4668a6..76c219e 100644 --- a/examples/agents/openai_agents_javelin.py +++ b/examples/agents/openai_agents_javelin.py @@ -23,12 +23,12 @@ set_default_openai_api("chat_completions") openai_api_key = os.getenv("OPENAI_API_KEY", "") -javelin_api_key = os.getenv("JAVELIN_API_KEY", "") -javelin_base_url = os.getenv("JAVELIN_BASE_URL", "") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "") +javelin_base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL", "") if not (openai_api_key and javelin_api_key and javelin_base_url): raise ValueError( - "Missing OPENAI_API_KEY, JAVELIN_API_KEY, or JAVELIN_BASE_URL in .env" + "Missing OPENAI_API_KEY, HIGHFLAME_API_KEY (or JAVELIN_API_KEY), or HIGHFLAME_BASE_URL (or JAVELIN_BASE_URL) in .env" ) # Create async OpenAI client diff --git a/examples/anthropic/anthropic_api_function_calling.py b/examples/anthropic/anthropic_api_function_calling.py index 4721bd6..7da8ea1 100644 --- a/examples/anthropic/anthropic_api_function_calling.py +++ b/examples/anthropic/anthropic_api_function_calling.py @@ -6,8 +6,8 @@ # Config setup config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), llm_api_key=os.getenv("ANTHROPIC_API_KEY"), timeout=120, ) diff --git a/examples/anthropic/anthropic_function_call.py b/examples/anthropic/anthropic_function_call.py index cff52e9..37b01fc 100644 --- a/examples/anthropic/anthropic_function_call.py +++ b/examples/anthropic/anthropic_function_call.py @@ -11,8 +11,8 @@ # Javelin Setup config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), ) client = JavelinClient(config) diff --git a/examples/anthropic/javelin_anthropic_api_call.py b/examples/anthropic/javelin_anthropic_api_call.py index 7ca4dd1..be21d00 100644 --- a/examples/anthropic/javelin_anthropic_api_call.py +++ b/examples/anthropic/javelin_anthropic_api_call.py @@ -16,8 +16,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Javelin client config config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), llm_api_key=os.getenv("ANTHROPIC_API_KEY"), timeout=120, ) diff --git a/examples/anthropic/javelin_anthropic_univ_endpoint.py b/examples/anthropic/javelin_anthropic_univ_endpoint.py index a08be62..ed4f5f8 100644 --- a/examples/anthropic/javelin_anthropic_univ_endpoint.py +++ b/examples/anthropic/javelin_anthropic_univ_endpoint.py @@ -18,8 +18,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration for Bedrock config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), ) client = JavelinClient(config) headers = { diff --git a/examples/anthropic/openai_compatible_univ_anthropic.py b/examples/anthropic/openai_compatible_univ_anthropic.py index e5486af..a7b6b30 100644 --- a/examples/anthropic/openai_compatible_univ_anthropic.py +++ b/examples/anthropic/openai_compatible_univ_anthropic.py @@ -15,8 +15,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), timeout=120, ) diff --git a/examples/azure-openai/openai_compatible_univ_azure.py b/examples/azure-openai/openai_compatible_univ_azure.py index d3264ab..104f5ea 100644 --- a/examples/azure-openai/openai_compatible_univ_azure.py +++ b/examples/azure-openai/openai_compatible_univ_azure.py @@ -20,8 +20,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), timeout=120, ) diff --git a/examples/bedrock/bedrock_client.py b/examples/bedrock/bedrock_client.py index 1e0a4f3..23f5de3 100644 --- a/examples/bedrock/bedrock_client.py +++ b/examples/bedrock/bedrock_client.py @@ -6,9 +6,9 @@ from pydantic import BaseModel # Environment Variables -javelin_base_url = os.getenv("JAVELIN_BASE_URL") +javelin_base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") openai_api_key = os.getenv("OPENAI_API_KEY") -javelin_api_key = os.getenv("JAVELIN_API_KEY") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") gemini_api_key = os.getenv("GEMINI_API_KEY") # Global JavelinClient, used for everything diff --git a/examples/bedrock/bedrock_client_universal.py b/examples/bedrock/bedrock_client_universal.py index 204bd8e..ffe4c7c 100644 --- a/examples/bedrock/bedrock_client_universal.py +++ b/examples/bedrock/bedrock_client_universal.py @@ -22,7 +22,7 @@ def init_bedrock(): config = JavelinConfig( # Replace with your Javelin API key - javelin_api_key=os.getenv("JAVELIN_API_KEY") + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") ) javelin_client = JavelinClient(config) javelin_client.register_bedrock( diff --git a/examples/gemini/document_processing.py b/examples/gemini/document_processing.py index b2203e2..f921e15 100644 --- a/examples/gemini/document_processing.py +++ b/examples/gemini/document_processing.py @@ -7,7 +7,7 @@ # Environment Variables openai_api_key = os.getenv("OPENAI_API_KEY") -javelin_api_key = os.getenv("JAVELIN_API_KEY") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") gemini_api_key = os.getenv("GEMINI_API_KEY") # Initialize Javelin Client @@ -19,9 +19,9 @@ # Initialize Javelin Client def initialize_javelin_client(): - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig( - javelin_api_key=javelin_api_key, base_url=os.getenv("JAVELIN_BASE_URL") + javelin_api_key=javelin_api_key, base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") ) return JavelinClient(config) diff --git a/examples/gemini/gemini-universal.py b/examples/gemini/gemini-universal.py index 5427b38..315db77 100644 --- a/examples/gemini/gemini-universal.py +++ b/examples/gemini/gemini-universal.py @@ -17,7 +17,7 @@ def init_gemini_client(): base_url="https://generativelanguage.googleapis.com/v1beta/openai/", ) - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig(javelin_api_key=javelin_api_key) client = JavelinClient(config) client.register_gemini(openai_client, route_name="google_univ") diff --git a/examples/gemini/gemini_function_tool_call.py b/examples/gemini/gemini_function_tool_call.py index a894bd5..024727d 100644 --- a/examples/gemini/gemini_function_tool_call.py +++ b/examples/gemini/gemini_function_tool_call.py @@ -9,7 +9,7 @@ def init_gemini_client(): gemini_api_key = os.getenv("GEMINI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not gemini_api_key or not javelin_api_key: raise ValueError("Missing GEMINI_API_KEY or JAVELIN_API_KEY") diff --git a/examples/gemini/javelin_gemini_univ_endpoint.py b/examples/gemini/javelin_gemini_univ_endpoint.py index d9e09bd..f5c38a9 100644 --- a/examples/gemini/javelin_gemini_univ_endpoint.py +++ b/examples/gemini/javelin_gemini_univ_endpoint.py @@ -14,8 +14,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), llm_api_key=os.getenv("OPENAI_API_KEY"), ) client = JavelinClient(config) @@ -32,7 +32,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "x-javelin-route": "google_univ", "x-javelin-model": "gemini-1.5-flash", "x-javelin-provider": "https://generativelanguage.googleapis.com/v1beta/openai", - "x-api-key": os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security # Use environment variable for security "Authorization": f"Bearer {os.getenv('GEMINI_API_KEY')}", } diff --git a/examples/gemini/langchain_chatmodel_example.py b/examples/gemini/langchain_chatmodel_example.py index 3eedbb9..023a282 100644 --- a/examples/gemini/langchain_chatmodel_example.py +++ b/examples/gemini/langchain_chatmodel_example.py @@ -8,10 +8,10 @@ model = init_chat_model( "gemini-1.5-flash", model_provider="openai", - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", extra_headers={ "x-javelin-route": "google_univ", - "x-api-key": os.environ.get("JAVELIN_API_KEY"), + "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), "Authorization": f"Bearer {os.environ.get('GEMINI_API_KEY')}", }, ) diff --git a/examples/gemini/openai_compatible_univ_gemini.py b/examples/gemini/openai_compatible_univ_gemini.py index 0dae7ae..46d331b 100644 --- a/examples/gemini/openai_compatible_univ_gemini.py +++ b/examples/gemini/openai_compatible_univ_gemini.py @@ -20,8 +20,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), llm_api_key=os.getenv("OPENAI_API_KEY"), timeout=120, ) @@ -31,7 +31,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "google_univ", "x-javelin-provider": "https://generativelanguage.googleapis.com/v1beta/openai", - "x-api-key": os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security # Use environment variable for security "Authorization": f"Bearer {os.getenv('GEMINI_API_KEY')}", } diff --git a/examples/gemini/strawberry.py b/examples/gemini/strawberry.py index a4748b6..c913b98 100644 --- a/examples/gemini/strawberry.py +++ b/examples/gemini/strawberry.py @@ -6,7 +6,7 @@ # Environment Variables openai_api_key = os.getenv("OPENAI_API_KEY") -javelin_api_key = os.getenv("JAVELIN_API_KEY") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") gemini_api_key = os.getenv("GEMINI_API_KEY") # Initialize Javelin Client @@ -43,9 +43,9 @@ def openai_chat_completions(): # Initialize Javelin Client def initialize_javelin_client(): - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), javelin_api_key=javelin_api_key, ) return JavelinClient(config) diff --git a/examples/guardrails/langgraph_guardrails_mcp_example.py b/examples/guardrails/langgraph_guardrails_mcp_example.py index ee78300..d4cbdf9 100644 --- a/examples/guardrails/langgraph_guardrails_mcp_example.py +++ b/examples/guardrails/langgraph_guardrails_mcp_example.py @@ -25,8 +25,8 @@ # Configuration from environment variables OPENAI_API_KEY = os.getenv("OPENAI_API_KEY") -JAVELIN_API_KEY = os.getenv("JAVELIN_API_KEY") -BASE_URL = os.getenv("JAVELIN_BASE_URL") +JAVELIN_API_KEY = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +BASE_URL = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") MODEL_NAME_CHAT = os.getenv("MODEL_NAME_CHAT", "openai/gpt-4o-mini") JAVELIN_GUARDRAILS_URL = os.getenv( "JAVELIN_GUARDRAILS_URL", "https://javelin-guardrails.fastmcp.app/mcp" @@ -133,7 +133,7 @@ async def main(): Main function demonstrating the Guardrails MCP Agent. """ # Validate required environment variables - required_vars = ["OPENAI_API_KEY", "JAVELIN_API_KEY", "JAVELIN_BASE_URL"] + required_vars = ["OPENAI_API_KEY"] # JAVELIN_* vars now have HIGHFLAME_* fallback missing_vars = [var for var in required_vars if not os.getenv(var)] if missing_vars: diff --git a/examples/guardrails/test_guardrails.py b/examples/guardrails/test_guardrails.py index c037740..28af455 100644 --- a/examples/guardrails/test_guardrails.py +++ b/examples/guardrails/test_guardrails.py @@ -2,7 +2,7 @@ from javelin_sdk import JavelinClient, JavelinConfig # Use your actual API key here -javelin_api_key = os.getenv("JAVELIN_API_KEY") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig( base_url="https://api-dev.javelin.live", javelin_api_key=javelin_api_key diff --git a/examples/mistral/mistral_function_tool_call.py b/examples/mistral/mistral_function_tool_call.py index f7e74d9..f498130 100644 --- a/examples/mistral/mistral_function_tool_call.py +++ b/examples/mistral/mistral_function_tool_call.py @@ -10,7 +10,7 @@ def init_mistral_model(): return init_chat_model( model_name="mistral-large-latest", model_provider="openai", - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", extra_headers={ "x-javelin-route": "mistral_univ", "x-api-key": os.environ.get("OPENAI_API_KEY"), diff --git a/examples/openai/img_generations_example.py b/examples/openai/img_generations_example.py index c1c12d2..e956d70 100644 --- a/examples/openai/img_generations_example.py +++ b/examples/openai/img_generations_example.py @@ -7,7 +7,7 @@ dotenv.load_dotenv() # Load API keys from environment variables -JAVELIN_API_KEY = os.getenv("JAVELIN_API_KEY") +JAVELIN_API_KEY = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") LLM_API_KEY = os.getenv("LLM_API_KEY") BASE_URL = os.getenv("BASE_URL") diff --git a/examples/openai/javelin_openai_univ_endpoint.py b/examples/openai/javelin_openai_univ_endpoint.py index 68455ab..772579a 100644 --- a/examples/openai/javelin_openai_univ_endpoint.py +++ b/examples/openai/javelin_openai_univ_endpoint.py @@ -14,8 +14,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), llm_api_key=os.getenv("OPENAI_API_KEY"), ) client = JavelinClient(config) @@ -32,7 +32,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "x-javelin-route": "openai_univ", "x-javelin-model": "gpt-4", "x-javelin-provider": "https://api.openai.com/v1", - "x-api-key": os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security # Use environment variable for security "Authorization": f"Bearer {os.getenv('OPENAI_API_KEY')}", } diff --git a/examples/openai/langchain-openai-universal.py b/examples/openai/langchain-openai-universal.py index 52ad932..6297273 100644 --- a/examples/openai/langchain-openai-universal.py +++ b/examples/openai/langchain-openai-universal.py @@ -16,11 +16,11 @@ # 1) Configuration # ----------------------------------------------------------------------------- OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY") # add your openai api key here -JAVELIN_API_KEY = os.environ.get("JAVELIN_API_KEY") # add your javelin api key here +JAVELIN_API_KEY = os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY") # add your javelin api key here MODEL_NAME_CHAT = "gpt-3.5-turbo" # For chat MODEL_NAME_EMBED = "text-embedding-ada-002" ROUTE_NAME = "openai_univ" -BASE_URL = os.getenv("JAVELIN_BASE_URL") # Default base URL +BASE_URL = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") # Default base URL def init_chat_llm_non_streaming(): diff --git a/examples/openai/langchain_callback_example.py b/examples/openai/langchain_callback_example.py index 2c874e8..0f6bc2a 100644 --- a/examples/openai/langchain_callback_example.py +++ b/examples/openai/langchain_callback_example.py @@ -13,7 +13,7 @@ class HeaderCallbackHandler(BaseCallbackHandler): """Custom callback handler that modifies the headers on chat model start.""" def __init__(self): - self.api_key = os.environ.get("JAVELIN_API_KEY") + self.api_key = os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY") def on_chain_start( self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any @@ -57,7 +57,7 @@ def on_chat_model_start( base_url="http://127.0.0.1:8000/v1", extra_headers={ "x-javelin-route": "openai_univ", - "x-api-key": os.environ.get("JAVELIN_API_KEY"), + "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), }, callbacks=[callback_handler], # Add our custom callback handler ) diff --git a/examples/openai/langchain_chatmodel_example.py b/examples/openai/langchain_chatmodel_example.py index 802481b..6876858 100644 --- a/examples/openai/langchain_chatmodel_example.py +++ b/examples/openai/langchain_chatmodel_example.py @@ -8,10 +8,10 @@ model = init_chat_model( "gpt-4o-mini", model_provider="openai", - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", extra_headers={ "x-javelin-route": "openai_univ", - "x-api-key": os.environ.get("JAVELIN_API_KEY"), + "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), }, ) diff --git a/examples/openai/o1-03_function-calling.py b/examples/openai/o1-03_function-calling.py index 998019e..42af7ab 100644 --- a/examples/openai/o1-03_function-calling.py +++ b/examples/openai/o1-03_function-calling.py @@ -21,7 +21,7 @@ def init_openai_client(): def init_javelin_client(openai_client, route_name="openai_univ"): - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig(javelin_api_key=javelin_api_key) client = JavelinClient(config) client.register_openai(openai_client, route_name=route_name) @@ -159,7 +159,7 @@ def init_azure_client(): def init_javelin_client_azure(azure_client, route_name="azureopenai_univ"): - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig(javelin_api_key=javelin_api_key) client = JavelinClient(config) client.register_azureopenai(azure_client, route_name=route_name) @@ -297,7 +297,7 @@ def openai_regular_non_stream(): "\n==== Running OpenAI Regular Route Non-Streaming Function " "Calling Example ====" ) - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") llm_api_key = os.getenv("OPENAI_API_KEY") if not javelin_api_key or not llm_api_key: raise ValueError("Both JAVELIN_API_KEY and OPENAI_API_KEY must be set.") @@ -341,7 +341,7 @@ def openai_regular_stream(): print( "\n==== Running OpenAI Regular Route Streaming Function " "Calling Example ====" ) - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") llm_api_key = os.getenv("OPENAI_API_KEY") if not javelin_api_key or not llm_api_key: raise ValueError("Both JAVELIN_API_KEY and OPENAI_API_KEY must be set.") diff --git a/examples/openai/openai-universal.py b/examples/openai/openai-universal.py index 4942b72..501e73a 100644 --- a/examples/openai/openai-universal.py +++ b/examples/openai/openai-universal.py @@ -31,7 +31,7 @@ def init_javelin_client_sync(openai_client): """Initialize JavelinClient for synchronous usage and register the OpenAI route.""" try: # Set (and print) the Javelin key - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") config = JavelinConfig( javelin_api_key=javelin_api_key, ) @@ -111,9 +111,9 @@ def init_async_openai_client(): def init_javelin_client_async(openai_async_client): """Initialize JavelinClient for async usage and register the OpenAI route.""" try: - javelin_api_key = os.getenv("JAVELIN_API_KEY") # add your javelin api key here + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") # add your javelin api key here config = JavelinConfig( - javelin_api_key=javelin_api_key, base_url=os.getenv("JAVELIN_BASE_URL") + javelin_api_key=javelin_api_key, base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") ) client = JavelinClient(config) client.register_openai(openai_async_client, route_name="openai_univ") diff --git a/examples/openai/openai_client.py b/examples/openai/openai_client.py index 1e0a4f3..23f5de3 100644 --- a/examples/openai/openai_client.py +++ b/examples/openai/openai_client.py @@ -6,9 +6,9 @@ from pydantic import BaseModel # Environment Variables -javelin_base_url = os.getenv("JAVELIN_BASE_URL") +javelin_base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") openai_api_key = os.getenv("OPENAI_API_KEY") -javelin_api_key = os.getenv("JAVELIN_API_KEY") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") gemini_api_key = os.getenv("GEMINI_API_KEY") # Global JavelinClient, used for everything diff --git a/examples/openai/openai_compatible_univ.py b/examples/openai/openai_compatible_univ.py index ae682db..f63f22b 100644 --- a/examples/openai/openai_compatible_univ.py +++ b/examples/openai/openai_compatible_univ.py @@ -20,8 +20,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), llm_api_key=os.getenv("OPENAI_API_KEY"), timeout=120, ) @@ -31,7 +31,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "openai_univ", "x-javelin-provider": "https://api.openai.com/v1", - "x-api-key": os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security # Use environment variable for security "Authorization": f"Bearer {os.getenv('OPENAI_API_KEY')}", } diff --git a/examples/openai/openai_embedding_example.py b/examples/openai/openai_embedding_example.py index 238c5b6..e0626ef 100644 --- a/examples/openai/openai_embedding_example.py +++ b/examples/openai/openai_embedding_example.py @@ -7,7 +7,7 @@ dotenv.load_dotenv() -javelin_api_key = os.getenv("JAVELIN_API_KEY") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") llm_api_key = os.getenv("OPENAI_API_KEY") embeddings = OpenAIEmbeddings(openai_api_key=llm_api_key) @@ -37,7 +37,7 @@ javelin_headers = {"x-api-key": javelin_api_key, "x-javelin-route": "myusers"} llm = ChatOpenAI( - openai_api_base=f"{os.getenv('JAVELIN_BASE_URL')}/v1/query", + openai_api_base=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1/query", openai_api_key=llm_api_key, model_kwargs={"extra_headers": javelin_headers}, ) diff --git a/examples/openai/openai_general_route.py b/examples/openai/openai_general_route.py index 1ed1052..32ee0d8 100644 --- a/examples/openai/openai_general_route.py +++ b/examples/openai/openai_general_route.py @@ -15,13 +15,13 @@ def init_sync_openai_client(): """Initialize and return a synchronous OpenAI client with Javelin headers.""" try: openai_api_key = os.getenv("OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") javelin_headers = {"x-javelin-apikey": javelin_api_key} print(f"[DEBUG] Synchronous OpenAI client key: {openai_api_key}") # This client is configured for chat completions. return OpenAI( api_key=openai_api_key, - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", default_headers=javelin_headers, ) except Exception as e: @@ -32,11 +32,11 @@ def init_async_openai_client(): """Initialize and return an asynchronous OpenAI client with Javelin headers.""" try: openai_api_key = os.getenv("OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") javelin_headers = {"x-javelin-apikey": javelin_api_key} return AsyncOpenAI( api_key=openai_api_key, - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", default_headers=javelin_headers, ) except Exception as e: @@ -96,7 +96,7 @@ def sync_openai_embeddings(_): """ try: openai_api_key = os.getenv("OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") javelin_headers = {"x-javelin-apikey": javelin_api_key} # Create a new client instance for embeddings. embeddings_client = OpenAI( diff --git a/examples/route_examples/aexample.py b/examples/route_examples/aexample.py index 04cf5f8..e852c9a 100644 --- a/examples/route_examples/aexample.py +++ b/examples/route_examples/aexample.py @@ -15,9 +15,9 @@ dotenv.load_dotenv() -# Retrieve environment variables -javelin_api_key = os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") llm_api_key = os.getenv("LLM_API_KEY") @@ -170,7 +170,7 @@ async def main(): try: config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), javelin_api_key=javelin_api_key, javelin_virtualapikey=javelin_virtualapikey, llm_api_key=llm_api_key, diff --git a/examples/route_examples/drop_in_replacement.py b/examples/route_examples/drop_in_replacement.py index b9a1442..d4a7986 100644 --- a/examples/route_examples/drop_in_replacement.py +++ b/examples/route_examples/drop_in_replacement.py @@ -14,9 +14,9 @@ dotenv.load_dotenv() -# Retrieve environment variables -javelin_api_key = os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") llm_api_key = os.getenv("OPENAI_API_KEY") @@ -124,7 +124,7 @@ def main(): try: config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), javelin_api_key=javelin_api_key, javelin_virtualapikey=javelin_virtualapikey, llm_api_key=llm_api_key, diff --git a/examples/route_examples/example.py b/examples/route_examples/example.py index 51dc655..71a433b 100644 --- a/examples/route_examples/example.py +++ b/examples/route_examples/example.py @@ -14,9 +14,9 @@ dotenv.load_dotenv() -# Retrieve environment variables -javelin_api_key = os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") llm_api_key = os.getenv("LLM_API_KEY") @@ -167,7 +167,7 @@ def main(): try: config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), javelin_api_key=javelin_api_key, javelin_virtualapikey=javelin_virtualapikey, llm_api_key=llm_api_key, diff --git a/examples/route_examples/javelin_sdk_app.py b/examples/route_examples/javelin_sdk_app.py index 01becbe..3934aae 100644 --- a/examples/route_examples/javelin_sdk_app.py +++ b/examples/route_examples/javelin_sdk_app.py @@ -7,9 +7,9 @@ dotenv.load_dotenv() -# Retrieve environment variables -javelin_api_key = os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") llm_api_key = os.getenv("LLM_API_KEY") @@ -27,7 +27,7 @@ def pretty_print(obj): def main(): config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), javelin_api_key=javelin_api_key, javelin_virtualapikey=javelin_virtualapikey, llm_api_key=llm_api_key, From 1583165165473a7838047575572ba4fb78caf8b1 Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 6 Jan 2026 17:15:56 +0530 Subject: [PATCH 04/18] feat: update examples to use highflame_sdk --- README.md | 14 ++++++++++---- examples/agents/openai_agents_javelin.py | 2 +- .../anthropic/anthropic_api_function_calling.py | 2 +- examples/anthropic/anthropic_function_call.py | 2 +- examples/anthropic/javelin_anthropic_api_call.py | 2 +- .../anthropic/javelin_anthropic_univ_endpoint.py | 2 +- .../anthropic/openai_compatible_univ_anthropic.py | 2 +- examples/azure-openai/azure-universal.py | 2 +- examples/azure-openai/azure_function_call.py | 2 +- .../javelin_azureopenai_univ_endpoint.py | 2 +- .../azure-openai/openai_compatible_univ_azure.py | 2 +- examples/bedrock/bedrock_client.py | 2 +- examples/bedrock/bedrock_client_universal.py | 2 +- examples/bedrock/bedrock_function_tool_call.py | 2 +- examples/bedrock/javelin_bedrock_univ_endpoint.py | 2 +- examples/bedrock/langchain-bedrock-universal.py | 2 +- examples/bedrock/openai_compatible_univ_bedrock.py | 2 +- examples/gemini/document_processing.py | 2 +- examples/gemini/gemini-universal.py | 2 +- examples/gemini/gemini_function_tool_call.py | 2 +- examples/gemini/javelin_gemini_univ_endpoint.py | 2 +- examples/gemini/openai_compatible_univ_gemini.py | 2 +- examples/gemini/strawberry.py | 2 +- examples/guardrails/test_guardrails.py | 2 +- examples/openai/img_generations_example.py | 2 +- examples/openai/javelin_openai_univ_endpoint.py | 2 +- examples/openai/o1-03_function-calling.py | 2 +- examples/openai/openai-universal.py | 2 +- examples/openai/openai_client.py | 2 +- examples/openai/openai_compatible_univ.py | 2 +- examples/route_examples/aexample.py | 2 +- examples/route_examples/drop_in_replacement.py | 2 +- examples/route_examples/example.py | 2 +- examples/route_examples/javelin_sdk_app.py | 2 +- 34 files changed, 43 insertions(+), 37 deletions(-) diff --git a/README.md b/README.md index 22372a0..117aac7 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,12 @@ Javelin Documentation: https://docs.getjavelin.io For local development, Please change `version = "RELEASE_VERSION"` with any semantic version example : `version = "v0.1.10"` in `pyproject.toml` -*Make sure that the file `pyproject.toml` reverted before commit back to main* +_Make sure that the file `pyproject.toml` reverted before commit back to main_ ### Installation ```python - pip install javelin-sdk + pip install highflame-sdk ``` ### Quick Start Guide @@ -58,13 +58,13 @@ poetry install ```bash # Uninstall any existing version -pip uninstall javelin-sdk -y +pip uninstall highflame-sdk -y # Build the package poetry build # Install the newly built package -pip install dist/javelin_sdk--py3-none-any.whl +pip install dist/highflame_sdk--py3-none-any.whl ``` ## [Universal Endpoints](https://docs.getjavelin.io/docs/javelin-core/integration#unified-endpoints) @@ -72,30 +72,36 @@ pip install dist/javelin_sdk--py3-none-any.whl Javelin provides universal endpoints that allow you to use a consistent interface across different LLM providers. Here are the main patterns: #### Azure OpenAI + - [Basic Azure OpenAI integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/azure-openai/azure-universal.py) - [Universal endpoint implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/azure-openai/javelin_azureopenai_univ_endpoint.py) - [OpenAI-compatible interface](https://github.com/highflame-ai/javelin-python/blob/main/examples/azure-openai/openai_compatible_univ_azure.py) #### Bedrock + - [Basic Bedrock integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/bedrock/bedrock_client_universal.py) - [Universal endpoint implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/bedrock/javelin_bedrock_univ_endpoint.py) - [OpenAI-compatible interface](https://github.com/highflame-ai/javelin-python/blob/main/examples/bedrock/openai_compatible_univ_bedrock.py) #### Gemini + - [Basic Gemini integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/gemini-universal.py) - [Universal endpoint implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/javelin_gemini_univ_endpoint.py) - [OpenAI-compatible interface](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/openai_compatible_univ_gemini.py) ### Agent Examples + - [CrewAI integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/agents/crewai_javelin.ipynb) - [LangGraph integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/agents/langgraph_javelin.ipynb) ### Basic Examples + - [Asynchronous example](https://github.com/highflame-ai/javelin-python/blob/main/examples/route_examples/aexample.py) - [Synchronous example](https://github.com/highflame-ai/javelin-python/blob/main/examples/route_examples/example.py) - [Drop-in replacement example](https://github.com/highflame-ai/javelin-python/blob/main/examples/route_examples/drop_in_replacement.py) ### Advanced Examples + - [Document processing](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/document_processing.py) - [RAG implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/rag/javelin_rag_embeddings_demo.ipynb) diff --git a/examples/agents/openai_agents_javelin.py b/examples/agents/openai_agents_javelin.py index 76c219e..ebaa8cb 100644 --- a/examples/agents/openai_agents_javelin.py +++ b/examples/agents/openai_agents_javelin.py @@ -11,7 +11,7 @@ ) from openai import AsyncOpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig from dotenv import load_dotenv ############################################################################## diff --git a/examples/anthropic/anthropic_api_function_calling.py b/examples/anthropic/anthropic_api_function_calling.py index 7da8ea1..72f7132 100644 --- a/examples/anthropic/anthropic_api_function_calling.py +++ b/examples/anthropic/anthropic_api_function_calling.py @@ -1,6 +1,6 @@ import os from dotenv import load_dotenv -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/anthropic/anthropic_function_call.py b/examples/anthropic/anthropic_function_call.py index 37b01fc..4751a10 100644 --- a/examples/anthropic/anthropic_function_call.py +++ b/examples/anthropic/anthropic_function_call.py @@ -2,7 +2,7 @@ import os import json import asyncio -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Load environment variables from dotenv import load_dotenv diff --git a/examples/anthropic/javelin_anthropic_api_call.py b/examples/anthropic/javelin_anthropic_api_call.py index be21d00..bb1af4d 100644 --- a/examples/anthropic/javelin_anthropic_api_call.py +++ b/examples/anthropic/javelin_anthropic_api_call.py @@ -1,7 +1,7 @@ import os import json from typing import Dict, Any -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig from dotenv import load_dotenv load_dotenv() diff --git a/examples/anthropic/javelin_anthropic_univ_endpoint.py b/examples/anthropic/javelin_anthropic_univ_endpoint.py index ed4f5f8..2359e5c 100644 --- a/examples/anthropic/javelin_anthropic_univ_endpoint.py +++ b/examples/anthropic/javelin_anthropic_univ_endpoint.py @@ -3,7 +3,7 @@ import os from typing import Any, Dict -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import dotenv diff --git a/examples/anthropic/openai_compatible_univ_anthropic.py b/examples/anthropic/openai_compatible_univ_anthropic.py index a7b6b30..2a8a135 100644 --- a/examples/anthropic/openai_compatible_univ_anthropic.py +++ b/examples/anthropic/openai_compatible_univ_anthropic.py @@ -1,4 +1,4 @@ -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import os from typing import Dict, Any import json diff --git a/examples/azure-openai/azure-universal.py b/examples/azure-openai/azure-universal.py index dc8297f..f8c50ef 100644 --- a/examples/azure-openai/azure-universal.py +++ b/examples/azure-openai/azure-universal.py @@ -3,7 +3,7 @@ from dotenv import load_dotenv from openai import AzureOpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/azure-openai/azure_function_call.py b/examples/azure-openai/azure_function_call.py index 1925ee0..5a3b4f0 100644 --- a/examples/azure-openai/azure_function_call.py +++ b/examples/azure-openai/azure_function_call.py @@ -2,7 +2,7 @@ import os from dotenv import load_dotenv from openai import AzureOpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/azure-openai/javelin_azureopenai_univ_endpoint.py b/examples/azure-openai/javelin_azureopenai_univ_endpoint.py index 170579f..e3fa915 100644 --- a/examples/azure-openai/javelin_azureopenai_univ_endpoint.py +++ b/examples/azure-openai/javelin_azureopenai_univ_endpoint.py @@ -3,7 +3,7 @@ import os from typing import Any, Dict -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig from dotenv import load_dotenv load_dotenv() diff --git a/examples/azure-openai/openai_compatible_univ_azure.py b/examples/azure-openai/openai_compatible_univ_azure.py index 104f5ea..393f9bd 100644 --- a/examples/azure-openai/openai_compatible_univ_azure.py +++ b/examples/azure-openai/openai_compatible_univ_azure.py @@ -6,7 +6,7 @@ # regardless of the underlying model provider, with Javelin handling the # necessary translations and adaptations behind the scenes. -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import os from typing import Dict, Any import json diff --git a/examples/bedrock/bedrock_client.py b/examples/bedrock/bedrock_client.py index 23f5de3..ee27a11 100644 --- a/examples/bedrock/bedrock_client.py +++ b/examples/bedrock/bedrock_client.py @@ -2,7 +2,7 @@ import base64 import requests from openai import OpenAI, AsyncOpenAI, AzureOpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig from pydantic import BaseModel # Environment Variables diff --git a/examples/bedrock/bedrock_client_universal.py b/examples/bedrock/bedrock_client_universal.py index ffe4c7c..775ffda 100644 --- a/examples/bedrock/bedrock_client_universal.py +++ b/examples/bedrock/bedrock_client_universal.py @@ -4,7 +4,7 @@ import boto3 from dotenv import load_dotenv -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/bedrock/bedrock_function_tool_call.py b/examples/bedrock/bedrock_function_tool_call.py index c2bf474..33d77b5 100644 --- a/examples/bedrock/bedrock_function_tool_call.py +++ b/examples/bedrock/bedrock_function_tool_call.py @@ -4,7 +4,7 @@ import os from typing import Dict, Any -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Load ENV from dotenv import load_dotenv diff --git a/examples/bedrock/javelin_bedrock_univ_endpoint.py b/examples/bedrock/javelin_bedrock_univ_endpoint.py index 76c2be2..37390d7 100644 --- a/examples/bedrock/javelin_bedrock_univ_endpoint.py +++ b/examples/bedrock/javelin_bedrock_univ_endpoint.py @@ -3,7 +3,7 @@ import os from typing import Any, Dict -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Helper function to pretty print responses diff --git a/examples/bedrock/langchain-bedrock-universal.py b/examples/bedrock/langchain-bedrock-universal.py index 4844727..3208a32 100644 --- a/examples/bedrock/langchain-bedrock-universal.py +++ b/examples/bedrock/langchain-bedrock-universal.py @@ -4,7 +4,7 @@ import boto3 from dotenv import load_dotenv -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/bedrock/openai_compatible_univ_bedrock.py b/examples/bedrock/openai_compatible_univ_bedrock.py index a089e6f..216dc26 100644 --- a/examples/bedrock/openai_compatible_univ_bedrock.py +++ b/examples/bedrock/openai_compatible_univ_bedrock.py @@ -1,4 +1,4 @@ -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import os from typing import Dict, Any import json diff --git a/examples/gemini/document_processing.py b/examples/gemini/document_processing.py index f921e15..3fa5474 100644 --- a/examples/gemini/document_processing.py +++ b/examples/gemini/document_processing.py @@ -3,7 +3,7 @@ from openai import OpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Environment Variables openai_api_key = os.getenv("OPENAI_API_KEY") diff --git a/examples/gemini/gemini-universal.py b/examples/gemini/gemini-universal.py index 315db77..9f95745 100644 --- a/examples/gemini/gemini-universal.py +++ b/examples/gemini/gemini-universal.py @@ -2,7 +2,7 @@ from dotenv import load_dotenv from openai import OpenAI from pydantic import BaseModel -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/gemini/gemini_function_tool_call.py b/examples/gemini/gemini_function_tool_call.py index 024727d..d73d926 100644 --- a/examples/gemini/gemini_function_tool_call.py +++ b/examples/gemini/gemini_function_tool_call.py @@ -2,7 +2,7 @@ import os from dotenv import load_dotenv from openai import OpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig load_dotenv() diff --git a/examples/gemini/javelin_gemini_univ_endpoint.py b/examples/gemini/javelin_gemini_univ_endpoint.py index f5c38a9..255bd45 100644 --- a/examples/gemini/javelin_gemini_univ_endpoint.py +++ b/examples/gemini/javelin_gemini_univ_endpoint.py @@ -3,7 +3,7 @@ import os from typing import Any, Dict -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Helper function to pretty print responses diff --git a/examples/gemini/openai_compatible_univ_gemini.py b/examples/gemini/openai_compatible_univ_gemini.py index 46d331b..ac4ee9b 100644 --- a/examples/gemini/openai_compatible_univ_gemini.py +++ b/examples/gemini/openai_compatible_univ_gemini.py @@ -6,7 +6,7 @@ # regardless of the underlying model provider, with Javelin handling the # necessary translations and adaptations behind the scenes. -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import os from typing import Dict, Any import json diff --git a/examples/gemini/strawberry.py b/examples/gemini/strawberry.py index c913b98..3d75fa1 100644 --- a/examples/gemini/strawberry.py +++ b/examples/gemini/strawberry.py @@ -2,7 +2,7 @@ from openai import OpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Environment Variables openai_api_key = os.getenv("OPENAI_API_KEY") diff --git a/examples/guardrails/test_guardrails.py b/examples/guardrails/test_guardrails.py index 28af455..50c02e4 100644 --- a/examples/guardrails/test_guardrails.py +++ b/examples/guardrails/test_guardrails.py @@ -1,5 +1,5 @@ import os -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Use your actual API key here javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") diff --git a/examples/openai/img_generations_example.py b/examples/openai/img_generations_example.py index e956d70..c5a698d 100644 --- a/examples/openai/img_generations_example.py +++ b/examples/openai/img_generations_example.py @@ -1,6 +1,6 @@ import base64 from openai import OpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import os import dotenv diff --git a/examples/openai/javelin_openai_univ_endpoint.py b/examples/openai/javelin_openai_univ_endpoint.py index 772579a..a7fad11 100644 --- a/examples/openai/javelin_openai_univ_endpoint.py +++ b/examples/openai/javelin_openai_univ_endpoint.py @@ -3,7 +3,7 @@ import os from typing import Any, Dict -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig # Helper function to pretty print responses diff --git a/examples/openai/o1-03_function-calling.py b/examples/openai/o1-03_function-calling.py index 42af7ab..79c6f70 100644 --- a/examples/openai/o1-03_function-calling.py +++ b/examples/openai/o1-03_function-calling.py @@ -5,7 +5,7 @@ import argparse from dotenv import load_dotenv from openai import OpenAI, AzureOpenAI -from javelin_sdk import JavelinClient, JavelinConfig, RouteNotFoundError +from highflame_sdk import JavelinClient, JavelinConfig, RouteNotFoundError # Load environment variables once at the start load_dotenv() diff --git a/examples/openai/openai-universal.py b/examples/openai/openai-universal.py index 501e73a..cfa406d 100644 --- a/examples/openai/openai-universal.py +++ b/examples/openai/openai-universal.py @@ -1,4 +1,4 @@ -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig from openai import AsyncOpenAI, OpenAI import asyncio import os diff --git a/examples/openai/openai_client.py b/examples/openai/openai_client.py index 23f5de3..ee27a11 100644 --- a/examples/openai/openai_client.py +++ b/examples/openai/openai_client.py @@ -2,7 +2,7 @@ import base64 import requests from openai import OpenAI, AsyncOpenAI, AzureOpenAI -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig from pydantic import BaseModel # Environment Variables diff --git a/examples/openai/openai_compatible_univ.py b/examples/openai/openai_compatible_univ.py index f63f22b..2c46608 100644 --- a/examples/openai/openai_compatible_univ.py +++ b/examples/openai/openai_compatible_univ.py @@ -6,7 +6,7 @@ # pattern regardless of the underlying model provider, with Javelin handling # the necessary translations and adaptations behind the scenes. -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig import os from typing import Dict, Any import json diff --git a/examples/route_examples/aexample.py b/examples/route_examples/aexample.py index e852c9a..84af818 100644 --- a/examples/route_examples/aexample.py +++ b/examples/route_examples/aexample.py @@ -4,7 +4,7 @@ import dotenv -from javelin_sdk import ( +from highflame_sdk import ( JavelinClient, JavelinConfig, NetworkError, diff --git a/examples/route_examples/drop_in_replacement.py b/examples/route_examples/drop_in_replacement.py index d4a7986..654fef8 100644 --- a/examples/route_examples/drop_in_replacement.py +++ b/examples/route_examples/drop_in_replacement.py @@ -3,7 +3,7 @@ import dotenv -from javelin_sdk import ( +from highflame_sdk import ( JavelinClient, JavelinConfig, NetworkError, diff --git a/examples/route_examples/example.py b/examples/route_examples/example.py index 71a433b..f8666eb 100644 --- a/examples/route_examples/example.py +++ b/examples/route_examples/example.py @@ -3,7 +3,7 @@ import dotenv -from javelin_sdk import ( +from highflame_sdk import ( JavelinClient, JavelinConfig, NetworkError, diff --git a/examples/route_examples/javelin_sdk_app.py b/examples/route_examples/javelin_sdk_app.py index 3934aae..b0f8ccb 100644 --- a/examples/route_examples/javelin_sdk_app.py +++ b/examples/route_examples/javelin_sdk_app.py @@ -3,7 +3,7 @@ import dotenv -from javelin_sdk import JavelinClient, JavelinConfig +from highflame_sdk import JavelinClient, JavelinConfig dotenv.load_dotenv() From 273291b42bf9d9ea0535cc2a35314fbd86a8fa66 Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 00:06:59 +0530 Subject: [PATCH 05/18] feat(cli): rename CLI from javelin to highflame BREAKING CHANGE: CLI command renamed from 'javelin' to 'highflame' - Rename javelin_cli/ directory to highflame_cli/ - Update pyproject.toml to reference highflame_cli module - Update CLI entry point from javelin_cli.cli:main to highflame_cli.cli:main - Update all internal imports to use highflame_cli namespace - Change CLI command from 'javelin' to 'highflame' - Update all user-facing messages to reference 'HighFlame' instead of 'Javelin' Backward compatibility: - Cache directory now uses ~/.highflame/ but maintains backward compatibility with existing ~/.javelin/ directory (reads from old location if it exists) - New authentications will write to ~/.highflame/cache.json - Existing users with ~/.javelin/cache.json can continue using their cached credentials Impact: - Users must now run 'highflame' command instead of 'javelin' - Auth command: 'highflame auth' instead of 'javelin auth' - All other commands follow the same pattern: 'highflame ' --- {javelin_cli => highflame_cli}/__init__.py | 0 {javelin_cli => highflame_cli}/__main__.py | 0 .../_internal/__init__.py | 0 .../_internal/commands.py | 30 +++++++--- {javelin_cli => highflame_cli}/cli.py | 56 ++++++++++++------ highflame_sdk/client.py | 17 +++++- highflame_sdk/models.py | 58 ++++++++++++++++--- pyproject.toml | 4 +- 8 files changed, 123 insertions(+), 42 deletions(-) rename {javelin_cli => highflame_cli}/__init__.py (100%) rename {javelin_cli => highflame_cli}/__main__.py (100%) rename {javelin_cli => highflame_cli}/_internal/__init__.py (100%) rename {javelin_cli => highflame_cli}/_internal/commands.py (97%) rename {javelin_cli => highflame_cli}/cli.py (93%) diff --git a/javelin_cli/__init__.py b/highflame_cli/__init__.py similarity index 100% rename from javelin_cli/__init__.py rename to highflame_cli/__init__.py diff --git a/javelin_cli/__main__.py b/highflame_cli/__main__.py similarity index 100% rename from javelin_cli/__main__.py rename to highflame_cli/__main__.py diff --git a/javelin_cli/_internal/__init__.py b/highflame_cli/_internal/__init__.py similarity index 100% rename from javelin_cli/_internal/__init__.py rename to highflame_cli/_internal/__init__.py diff --git a/javelin_cli/_internal/commands.py b/highflame_cli/_internal/commands.py similarity index 97% rename from javelin_cli/_internal/commands.py rename to highflame_cli/_internal/commands.py index d7fbf1d..3c5dc30 100644 --- a/javelin_cli/_internal/commands.py +++ b/highflame_cli/_internal/commands.py @@ -1,13 +1,13 @@ import json from pathlib import Path -from javelin_sdk.client import JavelinClient -from javelin_sdk.exceptions import ( +from highflame_sdk.client import JavelinClient +from highflame_sdk.exceptions import ( BadRequest, NetworkError, UnauthorizedError, ) -from javelin_sdk.models import ( +from highflame_sdk.models import ( AWSConfig, Gateway, GatewayConfig, @@ -27,10 +27,24 @@ from pydantic import ValidationError +def get_cache_file(): + """Get cache file path, checking new location first, then falling back to old location""" + home_dir = Path.home() + # Try new location first + new_cache_file = home_dir / ".highflame" / "cache.json" + if new_cache_file.exists(): + return new_cache_file + # Fall back to old location for backward compatibility + old_cache_file = home_dir / ".javelin" / "cache.json" + if old_cache_file.exists(): + return old_cache_file + # Default to new location if neither exists + return new_cache_file + + def get_javelin_client_aispm(): # Path to cache.json file - home_dir = Path.home() - json_file_path = home_dir / ".javelin" / "cache.json" + json_file_path = get_cache_file() # Load cache.json if not json_file_path.exists(): @@ -101,8 +115,7 @@ def get_javelin_client_aispm(): def get_javelin_client(): # Path to cache.json file - home_dir = Path.home() - json_file_path = home_dir / ".javelin" / "cache.json" + json_file_path = get_cache_file() # Load cache.json if not json_file_path.exists(): @@ -328,8 +341,7 @@ def list_gateways(args): print(f"Unexpected error: {e}") """ # Path to cache.json file - home_dir = Path.home() - json_file_path = home_dir / ".javelin" / "cache.json" + json_file_path = get_cache_file() # Load cache.json if not json_file_path.exists(): diff --git a/javelin_cli/cli.py b/highflame_cli/cli.py similarity index 93% rename from javelin_cli/cli.py rename to highflame_cli/cli.py index f5b984f..de4129b 100644 --- a/javelin_cli/cli.py +++ b/highflame_cli/cli.py @@ -12,7 +12,7 @@ import requests -from javelin_cli._internal.commands import ( +from highflame_cli._internal.commands import ( create_gateway, create_provider, create_route, @@ -49,13 +49,27 @@ ) +def get_cache_file(): + """Get cache file path, checking new location first, then falling back to old location""" + home_dir = Path.home() + # Try new location first + new_cache_file = home_dir / ".highflame" / "cache.json" + if new_cache_file.exists(): + return new_cache_file + # Fall back to old location for backward compatibility + old_cache_file = home_dir / ".javelin" / "cache.json" + if old_cache_file.exists(): + return old_cache_file + # Default to new location if neither exists + return new_cache_file + + def check_permissions(): """Check if user has permissions""" - home_dir = Path.home() - cache_file = home_dir / ".javelin" / "cache.json" + cache_file = get_cache_file() if not cache_file.exists(): - print("❌ Not authenticated. Please run 'javelin auth' first.") + print("❌ Not authenticated. Please run 'highflame auth' first.") sys.exit(1) try: @@ -67,7 +81,7 @@ def check_permissions(): if membership.get("role") == "org:superadmin": return True - print("❌ Permission denied: Javelin CLI requires superadmin privileges.") + print("❌ Permission denied: HighFlame CLI requires superadmin privileges.") print("Please contact your administrator for access.") sys.exit(1) @@ -79,11 +93,11 @@ def check_permissions(): def main(): # Fetch the version dynamically from the package package_version = importlib.metadata.version( - "javelin-sdk" - ) # Replace with your package name + "highflame-sdk" + ) parser = argparse.ArgumentParser( - description="The CLI for Javelin.", + description="The CLI for HighFlame.", formatter_class=argparse.RawTextHelpFormatter, epilog=( "See https://docs.getjavelin.io/docs/javelin-python/cli for more " @@ -91,13 +105,13 @@ def main(): ), ) parser.add_argument( - "--version", action="version", version=f"Javelin CLI v{package_version}" + "--version", action="version", version=f"HighFlame CLI v{package_version}" ) subparsers = parser.add_subparsers(title="commands", metavar="") # Auth command - auth_parser = subparsers.add_parser("auth", help="Authenticate with Javelin.") + auth_parser = subparsers.add_parser("auth", help="Authenticate with HighFlame.") auth_parser.add_argument( "--force", action="store_true", @@ -493,10 +507,14 @@ def main(): def authenticate(args): home_dir = Path.home() - javelin_dir = home_dir / ".javelin" - cache_file = javelin_dir / "cache.json" + highflame_dir = home_dir / ".highflame" + cache_file = highflame_dir / "cache.json" + + # Also check old location for backward compatibility + old_cache_file = home_dir / ".javelin" / "cache.json" + print(cache_file) - if cache_file.exists() and not args.force: + if (cache_file.exists() or old_cache_file.exists()) and not args.force: print("✅ User is already authenticated!") print("Use --force to re-authenticate and override existing cache.") return @@ -504,8 +522,8 @@ def authenticate(args): default_url = "https://dev.highflame.dev/" print(" O") print(" /|\\") - print(" / \\ ========> Welcome to Javelin! 🚀") - print("\nBefore you can use Javelin, you need to authenticate.") + print(" / \\ ========> Welcome to HighFlame! 🚀") + print("\nBefore you can use HighFlame, you need to authenticate.") print("Press Enter to open the default login URL in your browser...") print(f"Default URL: {default_url}") print("Or enter a new URL (leave blank to use the default): ", end="") @@ -530,7 +548,7 @@ def authenticate(args): if cache_file.exists(): print("✅ Successfully authenticated!") else: - print("⚠️ Failed to retrieve Javelin cache.") + print("⚠️ Failed to retrieve HighFlame cache.") def start_local_server(): @@ -586,10 +604,10 @@ def run_server(): def store_credentials(secrets): home_dir = Path.home() - javelin_dir = home_dir / ".javelin" - javelin_dir.mkdir(exist_ok=True) + highflame_dir = home_dir / ".highflame" + highflame_dir.mkdir(exist_ok=True) - cache_file = javelin_dir / "cache.json" + cache_file = highflame_dir / "cache.json" try: cache_data = json.loads(secrets) diff --git a/highflame_sdk/client.py b/highflame_sdk/client.py index 58f6e50..961034b 100644 --- a/highflame_sdk/client.py +++ b/highflame_sdk/client.py @@ -78,11 +78,20 @@ def __init__(self, config: JavelinConfig) -> None: self.config = config self.base_url = urljoin(config.base_url, config.api_version or "/v1") - self._headers = {"x-javelin-apikey": config.javelin_api_key} + # Use properties that support both old and new field names + api_key = config.api_key + virtual_api_key = config.virtual_api_key + + # Send both headers for backward compatibility (backend may accept either) + self._headers = { + "x-highflame-apikey": api_key, # New header + "x-javelin-apikey": api_key, # Old header (for backward compatibility) + } if config.llm_api_key: self._headers["Authorization"] = f"Bearer {config.llm_api_key}" - if config.javelin_virtualapikey: - self._headers["x-javelin-virtualapikey"] = config.javelin_virtualapikey + if virtual_api_key: + self._headers["x-highflame-virtualapikey"] = virtual_api_key # New header + self._headers["x-javelin-virtualapikey"] = virtual_api_key # Old header (for backward compatibility) self._client = None self._aclient = None self.bedrock_client = None @@ -972,7 +981,9 @@ def _prepare_request(self, request: Request) -> tuple: and request.route.startswith("v1/admin/aispm") and "x-javelin-accountid" in headers ): + # Remove both old and new headers for backward compatibility headers.pop("x-javelin-apikey", None) + headers.pop("x-highflame-apikey", None) return url, headers diff --git a/highflame_sdk/models.py b/highflame_sdk/models.py index 3b5b2b5..a6fb80e 100644 --- a/highflame_sdk/models.py +++ b/highflame_sdk/models.py @@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional from highflame_sdk.exceptions import UnauthorizedError -from pydantic import BaseModel, Field, field_validator +from pydantic import BaseModel, Field, field_validator, model_validator class GatewayConfig(BaseModel): @@ -466,13 +466,22 @@ class QueryResponse(BaseModel): class JavelinConfig(BaseModel): - javelin_api_key: str = Field(..., description="Javelin API key") + # Primary fields (old names kept for backward compatibility) + javelin_api_key: Optional[str] = Field( + default=None, description="Javelin API key (deprecated, use highflame_api_key)" + ) + highflame_api_key: Optional[str] = Field( + default=None, description="HighFlame API key" + ) base_url: str = Field( default="https://api-dev.javelin.live", description="Base URL for the Javelin API", ) javelin_virtualapikey: Optional[str] = Field( - default=None, description="Virtual API key for Javelin" + default=None, description="Virtual API key for Javelin (deprecated, use highflame_virtualapikey)" + ) + highflame_virtualapikey: Optional[str] = Field( + default=None, description="Virtual API key for HighFlame" ) llm_api_key: Optional[str] = Field( default=None, description="API key for the LLM provider" @@ -485,19 +494,50 @@ class JavelinConfig(BaseModel): default=None, description="Request timeout in seconds" ) - @field_validator("javelin_api_key") + @model_validator(mode="before") @classmethod - def validate_api_key(cls, value: str) -> str: - if not value: + def handle_backward_compatibility(cls, data: Any) -> Any: + """Handle backward compatibility between old and new field names""" + if isinstance(data, dict): + # Support both highflame_api_key and javelin_api_key + # If both are provided, prefer highflame_api_key + if "highflame_api_key" in data and "javelin_api_key" not in data: + data["javelin_api_key"] = data["highflame_api_key"] + elif "javelin_api_key" in data and "highflame_api_key" not in data: + data["highflame_api_key"] = data["javelin_api_key"] + + # Support both highflame_virtualapikey and javelin_virtualapikey + if "highflame_virtualapikey" in data and "javelin_virtualapikey" not in data: + data["javelin_virtualapikey"] = data.get("highflame_virtualapikey") + elif "javelin_virtualapikey" in data and "highflame_virtualapikey" not in data: + data["highflame_virtualapikey"] = data.get("javelin_virtualapikey") + return data + + @model_validator(mode="after") + def validate_at_least_one_api_key(self) -> "JavelinConfig": + """Ensure at least one API key field is provided and not empty""" + api_key = self.highflame_api_key or self.javelin_api_key + if not api_key or (isinstance(api_key, str) and api_key.strip() == ""): raise UnauthorizedError( response=None, message=( - "Please provide a valid Javelin API Key. " - "When you sign into Javelin, you can find your API Key in the " + "Please provide a valid HighFlame API Key (highflame_api_key) or " + "Javelin API Key (javelin_api_key for backward compatibility). " + "When you sign into HighFlame, you can find your API Key in the " "Account->Developer settings" ), ) - return value + return self + + @property + def api_key(self) -> str: + """Get the API key (prefers highflame_api_key, falls back to javelin_api_key)""" + return self.highflame_api_key or self.javelin_api_key or "" + + @property + def virtual_api_key(self) -> Optional[str]: + """Get the virtual API key (prefers highflame_virtualapikey, falls back to javelin_virtualapikey)""" + return self.highflame_virtualapikey or self.javelin_virtualapikey class HttpMethod(Enum): diff --git a/pyproject.toml b/pyproject.toml index f7f714e..8731976 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -7,12 +7,12 @@ readme = "README.md" license = "Apache-2.0" homepage = "https://getjavelin.com" packages = [ - { include = "javelin_cli" }, + { include = "highflame_cli" }, { include = "highflame_sdk" }, ] [tool.poetry.scripts] -highflame = "javelin_cli.cli:main" +highflame = "highflame_cli.cli:main" [tool.poetry.dependencies] python = "^3.9" From bb594635751dc6db4dbc25f3fc648efeee62b56a Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 00:12:56 +0530 Subject: [PATCH 06/18] feat(env): add HIGHFLAME_* environment variables with JAVELIN_* fallback Add support for new HIGHFLAME_* environment variable names while maintaining backward compatibility with existing JAVELIN_* variables. Changes: - Update all environment variable references to check HIGHFLAME_* first - Fall back to JAVELIN_* if HIGHFLAME_* is not set - Applies to: HIGHFLAME_API_KEY, HIGHFLAME_BASE_URL, HIGHFLAME_VIRTUALAPIKEY Pattern: os.getenv("HIGHFLAME_*") or os.getenv("JAVELIN_*") Backward compatibility: - Existing users with JAVELIN_* variables will continue to work - New users can use HIGHFLAME_* variables - If both are set, HIGHFLAME_* takes precedence --- examples/azure-openai/azure-universal.py | 2 +- examples/azure-openai/azure_function_call.py | 2 +- examples/azure-openai/azure_general_route.py | 10 +++++----- .../azure-openai/javelin_azureopenai_univ_endpoint.py | 8 ++++---- examples/azure-openai/langchain_azure_universal.py | 4 ++-- examples/azure-openai/langchain_chatmodel_example.py | 4 ++-- examples/bedrock/bedrock_function_tool_call.py | 6 +++--- examples/bedrock/bedrock_general_route.py | 4 ++-- examples/bedrock/javelin_bedrock_univ_endpoint.py | 6 +++--- examples/bedrock/langchain-bedrock-universal.py | 2 +- examples/bedrock/openai_compatible_univ_bedrock.py | 4 ++-- 11 files changed, 26 insertions(+), 26 deletions(-) diff --git a/examples/azure-openai/azure-universal.py b/examples/azure-openai/azure-universal.py index f8c50ef..6715681 100644 --- a/examples/azure-openai/azure-universal.py +++ b/examples/azure-openai/azure-universal.py @@ -13,7 +13,7 @@ def initialize_client(): Creates the AzureOpenAI client and registers it with Javelin. Returns the AzureOpenAI client object if successful, else None. """ - javelin_api_key = os.getenv("JAVELIN_API_KEY") # add your javelin api key here + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") # add your API key here azure_openai_api_key = os.getenv( "AZURE_OPENAI_API_KEY" ) # Add your Azure OpenAI key diff --git a/examples/azure-openai/azure_function_call.py b/examples/azure-openai/azure_function_call.py index 5a3b4f0..cb235ce 100644 --- a/examples/azure-openai/azure_function_call.py +++ b/examples/azure-openai/azure_function_call.py @@ -9,7 +9,7 @@ def init_azure_client_with_javelin(): azure_api_key = os.getenv("AZURE_OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not azure_api_key or not javelin_api_key: raise ValueError("Missing AZURE_OPENAI_API_KEY or JAVELIN_API_KEY") diff --git a/examples/azure-openai/azure_general_route.py b/examples/azure-openai/azure_general_route.py index 59aec58..20fd052 100644 --- a/examples/azure-openai/azure_general_route.py +++ b/examples/azure-openai/azure_general_route.py @@ -16,7 +16,7 @@ def init_azure_client_sync(): """ try: llm_api_key = os.getenv("AZURE_OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not llm_api_key or not javelin_api_key: raise Exception( "AZURE_OPENAI_API_KEY and JAVELIN_API_KEY must be set in " @@ -25,7 +25,7 @@ def init_azure_client_sync(): javelin_headers = {"x-javelin-apikey": javelin_api_key} client = AzureOpenAI( api_key=llm_api_key, - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai", default_headers=javelin_headers, api_version="2024-02-15-preview", ) @@ -39,7 +39,7 @@ def init_azure_embeddings_client_sync(): """Initialize a synchronous AzureOpenAI client for embeddings.""" try: llm_api_key = os.getenv("AZURE_OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not llm_api_key or not javelin_api_key: raise Exception( "AZURE_OPENAI_API_KEY and JAVELIN_API_KEY must be set in " @@ -134,7 +134,7 @@ async def init_async_azure_client(): """Initialize an asynchronous AzureOpenAI client for chat completions.""" try: llm_api_key = os.getenv("AZURE_OPENAI_API_KEY") - javelin_api_key = os.getenv("JAVELIN_API_KEY") + javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not llm_api_key or not javelin_api_key: raise Exception( "AZURE_OPENAI_API_KEY and JAVELIN_API_KEY must be set in " @@ -144,7 +144,7 @@ async def init_async_azure_client(): # Include the API version in the base URL for the async client. client = AsyncOpenAI( api_key=llm_api_key, - base_url=f"{os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai", + base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai", default_headers=javelin_headers, ) return client diff --git a/examples/azure-openai/javelin_azureopenai_univ_endpoint.py b/examples/azure-openai/javelin_azureopenai_univ_endpoint.py index e3fa915..3fc3ec4 100644 --- a/examples/azure-openai/javelin_azureopenai_univ_endpoint.py +++ b/examples/azure-openai/javelin_azureopenai_univ_endpoint.py @@ -18,12 +18,12 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), default_headers={ "Content-Type": "application/json", "x-javelin-provider": "https://javelinpreview.openai.azure.com/openai", - "x-api-key": os.getenv("JAVELIN_API_KEY"), + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), "api-key": os.getenv("AZURE_OPENAI_API_KEY"), }, ) @@ -40,7 +40,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "azureopenai_univ", "x-javelin-provider": "https://javelinpreview.openai.azure.com/openai", - "x-api-key": os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security "api-key": os.getenv( "AZURE_OPENAI_API_KEY" ), # Use environment variable for security diff --git a/examples/azure-openai/langchain_azure_universal.py b/examples/azure-openai/langchain_azure_universal.py index 3c84f71..ce5d929 100644 --- a/examples/azure-openai/langchain_azure_universal.py +++ b/examples/azure-openai/langchain_azure_universal.py @@ -12,8 +12,8 @@ print("Initializing environment variables...") load_dotenv() azure_openai_api_key = os.getenv("AZURE_OPENAI_API_KEY") -javelin_api_key = os.getenv("JAVELIN_API_KEY") -base_url = os.getenv("JAVELIN_BASE_URL") +javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") # The name of your Azure deployment (e.g., "gpt35") # or whatever you’ve set in Azure. Must also match x-javelin-model if diff --git a/examples/azure-openai/langchain_chatmodel_example.py b/examples/azure-openai/langchain_chatmodel_example.py index 53a4934..f06e7c1 100644 --- a/examples/azure-openai/langchain_chatmodel_example.py +++ b/examples/azure-openai/langchain_chatmodel_example.py @@ -4,7 +4,7 @@ dotenv.load_dotenv() -url = os.path.join(os.getenv("JAVELIN_BASE_URL"), "v1") +url = os.path.join(os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), "v1") print(url) model = AzureChatOpenAI( azure_endpoint=url, @@ -12,7 +12,7 @@ openai_api_version="2023-03-15-preview", extra_headers={ "x-javelin-route": "azureopenai_univ", - "x-api-key": os.environ.get("JAVELIN_API_KEY"), + "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), }, ) diff --git a/examples/bedrock/bedrock_function_tool_call.py b/examples/bedrock/bedrock_function_tool_call.py index 33d77b5..cdd64e5 100644 --- a/examples/bedrock/bedrock_function_tool_call.py +++ b/examples/bedrock/bedrock_function_tool_call.py @@ -21,8 +21,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup Bedrock Javelin client config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), ) client = JavelinClient(config) @@ -30,7 +30,7 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "amazon_univ", "x-javelin-model": "amazon.titan-text-express-v1", # replace if needed - "x-api-key": os.getenv("JAVELIN_API_KEY"), + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), } diff --git a/examples/bedrock/bedrock_general_route.py b/examples/bedrock/bedrock_general_route.py index cc53ee5..d393af6 100644 --- a/examples/bedrock/bedrock_general_route.py +++ b/examples/bedrock/bedrock_general_route.py @@ -56,7 +56,7 @@ def get_bedrock_client(): aws_access_key_id = os.getenv("AWS_ACCESS_KEY_ID", "YOUR_ACCESS_KEY") aws_secret_access_key = os.getenv("AWS_SECRET_ACCESS_KEY", "YOUR_SECRET_KEY") - bedrock_api_key = os.getenv("JAVELIN_API_KEY", "YOUR_BEDROCK_API_KEY") + bedrock_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "YOUR_BEDROCK_API_KEY") custom_headers = { "x-javelin-apikey": bedrock_api_key, @@ -66,7 +66,7 @@ def get_bedrock_client(): client = boto3.client( service_name="bedrock-runtime", region_name="us-east-1", - endpoint_url=os.path.join(os.getenv("JAVELIN_BASE_URL"), "v1"), + endpoint_url=os.path.join(os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), "v1"), aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, ) diff --git a/examples/bedrock/javelin_bedrock_univ_endpoint.py b/examples/bedrock/javelin_bedrock_univ_endpoint.py index 37390d7..54ad350 100644 --- a/examples/bedrock/javelin_bedrock_univ_endpoint.py +++ b/examples/bedrock/javelin_bedrock_univ_endpoint.py @@ -14,15 +14,15 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration for Bedrock config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), ) client = JavelinClient(config) headers = { "Content-Type": "application/json", "x-javelin-route": "univ_bedrock", "x-javelin-model": "amazon.titan-text-express-v1", - "x-api-key": os.getenv("JAVELIN_API_KEY"), + "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), } # Example messages in OpenAI format diff --git a/examples/bedrock/langchain-bedrock-universal.py b/examples/bedrock/langchain-bedrock-universal.py index 3208a32..4a78924 100644 --- a/examples/bedrock/langchain-bedrock-universal.py +++ b/examples/bedrock/langchain-bedrock-universal.py @@ -28,7 +28,7 @@ def init_bedrock(): # Initialize Javelin client config = JavelinConfig( - javelin_api_key=os.getenv("JAVELIN_API_KEY") # add your Javelin API key here + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") # add your API key here ) javelin_client = JavelinClient(config) diff --git a/examples/bedrock/openai_compatible_univ_bedrock.py b/examples/bedrock/openai_compatible_univ_bedrock.py index 216dc26..3f9c267 100644 --- a/examples/bedrock/openai_compatible_univ_bedrock.py +++ b/examples/bedrock/openai_compatible_univ_bedrock.py @@ -12,8 +12,8 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: # Setup client configuration config = JavelinConfig( - base_url=os.getenv("JAVELIN_BASE_URL"), - javelin_api_key=os.getenv("JAVELIN_API_KEY"), + base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), timeout=120, ) From 883545e6f02a546c29ed1dda1b07f00a34a9aefb Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 00:18:06 +0530 Subject: [PATCH 07/18] refactor(examples): rename example files and directories from javelin to highflame Rename all example files, directories, and notebooks to use 'highflame' naming convention instead of 'javelin'. --- .../__init__.py | 0 .../agent.py | 0 .../__init__.py | 0 .../agent.py | 0 examples/agents/{crewai_javelin.ipynb => crewai_highflame.ipynb} | 0 .../agents/{langgraph_javelin.ipynb => langgraph_highflame.ipynb} | 0 .../{openai_agents_javelin.py => openai_agents_highflame.py} | 0 ...elin_anthropic_api_call.py => highflame_anthropic_api_call.py} | 0 ...opic_univ_endpoint.py => highflame_anthropic_univ_endpoint.py} | 0 ...on-stream.js => azure_openai_highflame_stream_&_non-stream.js} | 0 ...ai_univ_endpoint.py => highflame_azureopenai_univ_endpoint.py} | 0 ...edrock_univ_endpoint.py => highflame_bedrock_univ_endpoint.py} | 0 ..._gemini_univ_endpoint.py => highflame_gemini_univ_endpoint.py} | 0 ..._openai_univ_endpoint.py => highflame_openai_univ_endpoint.py} | 0 ...stream&non-stream.js => openai_highflame_stream&non-stream.js} | 0 ..._embeddings_demo.ipynb => highflame_rag_embeddings_demo.ipynb} | 0 ...lemetation_javelin.ipynb => rag_implemetation_highflame.ipynb} | 0 .../route_examples/{javelin_sdk_app.py => highflame_sdk_app.py} | 0 18 files changed, 0 insertions(+), 0 deletions(-) rename examples/agents/{adk_gemini_agent_javelin => adk_gemini_agent_highflame}/__init__.py (100%) rename examples/agents/{adk_gemini_agent_javelin => adk_gemini_agent_highflame}/agent.py (100%) rename examples/agents/{adk_openai_agent_javelin => adk_openai_agent_highflame}/__init__.py (100%) rename examples/agents/{adk_openai_agent_javelin => adk_openai_agent_highflame}/agent.py (100%) rename examples/agents/{crewai_javelin.ipynb => crewai_highflame.ipynb} (100%) rename examples/agents/{langgraph_javelin.ipynb => langgraph_highflame.ipynb} (100%) rename examples/agents/{openai_agents_javelin.py => openai_agents_highflame.py} (100%) rename examples/anthropic/{javelin_anthropic_api_call.py => highflame_anthropic_api_call.py} (100%) rename examples/anthropic/{javelin_anthropic_univ_endpoint.py => highflame_anthropic_univ_endpoint.py} (100%) rename examples/azure-openai/{azure_openai_javelin_stream_&_non-stream.js => azure_openai_highflame_stream_&_non-stream.js} (100%) rename examples/azure-openai/{javelin_azureopenai_univ_endpoint.py => highflame_azureopenai_univ_endpoint.py} (100%) rename examples/bedrock/{javelin_bedrock_univ_endpoint.py => highflame_bedrock_univ_endpoint.py} (100%) rename examples/gemini/{javelin_gemini_univ_endpoint.py => highflame_gemini_univ_endpoint.py} (100%) rename examples/openai/{javelin_openai_univ_endpoint.py => highflame_openai_univ_endpoint.py} (100%) rename examples/openai/{openai_javelin_stream&non-stream.js => openai_highflame_stream&non-stream.js} (100%) rename examples/rag/{javelin_rag_embeddings_demo.ipynb => highflame_rag_embeddings_demo.ipynb} (100%) rename examples/rag/{rag_implemetation_javelin.ipynb => rag_implemetation_highflame.ipynb} (100%) rename examples/route_examples/{javelin_sdk_app.py => highflame_sdk_app.py} (100%) diff --git a/examples/agents/adk_gemini_agent_javelin/__init__.py b/examples/agents/adk_gemini_agent_highflame/__init__.py similarity index 100% rename from examples/agents/adk_gemini_agent_javelin/__init__.py rename to examples/agents/adk_gemini_agent_highflame/__init__.py diff --git a/examples/agents/adk_gemini_agent_javelin/agent.py b/examples/agents/adk_gemini_agent_highflame/agent.py similarity index 100% rename from examples/agents/adk_gemini_agent_javelin/agent.py rename to examples/agents/adk_gemini_agent_highflame/agent.py diff --git a/examples/agents/adk_openai_agent_javelin/__init__.py b/examples/agents/adk_openai_agent_highflame/__init__.py similarity index 100% rename from examples/agents/adk_openai_agent_javelin/__init__.py rename to examples/agents/adk_openai_agent_highflame/__init__.py diff --git a/examples/agents/adk_openai_agent_javelin/agent.py b/examples/agents/adk_openai_agent_highflame/agent.py similarity index 100% rename from examples/agents/adk_openai_agent_javelin/agent.py rename to examples/agents/adk_openai_agent_highflame/agent.py diff --git a/examples/agents/crewai_javelin.ipynb b/examples/agents/crewai_highflame.ipynb similarity index 100% rename from examples/agents/crewai_javelin.ipynb rename to examples/agents/crewai_highflame.ipynb diff --git a/examples/agents/langgraph_javelin.ipynb b/examples/agents/langgraph_highflame.ipynb similarity index 100% rename from examples/agents/langgraph_javelin.ipynb rename to examples/agents/langgraph_highflame.ipynb diff --git a/examples/agents/openai_agents_javelin.py b/examples/agents/openai_agents_highflame.py similarity index 100% rename from examples/agents/openai_agents_javelin.py rename to examples/agents/openai_agents_highflame.py diff --git a/examples/anthropic/javelin_anthropic_api_call.py b/examples/anthropic/highflame_anthropic_api_call.py similarity index 100% rename from examples/anthropic/javelin_anthropic_api_call.py rename to examples/anthropic/highflame_anthropic_api_call.py diff --git a/examples/anthropic/javelin_anthropic_univ_endpoint.py b/examples/anthropic/highflame_anthropic_univ_endpoint.py similarity index 100% rename from examples/anthropic/javelin_anthropic_univ_endpoint.py rename to examples/anthropic/highflame_anthropic_univ_endpoint.py diff --git a/examples/azure-openai/azure_openai_javelin_stream_&_non-stream.js b/examples/azure-openai/azure_openai_highflame_stream_&_non-stream.js similarity index 100% rename from examples/azure-openai/azure_openai_javelin_stream_&_non-stream.js rename to examples/azure-openai/azure_openai_highflame_stream_&_non-stream.js diff --git a/examples/azure-openai/javelin_azureopenai_univ_endpoint.py b/examples/azure-openai/highflame_azureopenai_univ_endpoint.py similarity index 100% rename from examples/azure-openai/javelin_azureopenai_univ_endpoint.py rename to examples/azure-openai/highflame_azureopenai_univ_endpoint.py diff --git a/examples/bedrock/javelin_bedrock_univ_endpoint.py b/examples/bedrock/highflame_bedrock_univ_endpoint.py similarity index 100% rename from examples/bedrock/javelin_bedrock_univ_endpoint.py rename to examples/bedrock/highflame_bedrock_univ_endpoint.py diff --git a/examples/gemini/javelin_gemini_univ_endpoint.py b/examples/gemini/highflame_gemini_univ_endpoint.py similarity index 100% rename from examples/gemini/javelin_gemini_univ_endpoint.py rename to examples/gemini/highflame_gemini_univ_endpoint.py diff --git a/examples/openai/javelin_openai_univ_endpoint.py b/examples/openai/highflame_openai_univ_endpoint.py similarity index 100% rename from examples/openai/javelin_openai_univ_endpoint.py rename to examples/openai/highflame_openai_univ_endpoint.py diff --git a/examples/openai/openai_javelin_stream&non-stream.js b/examples/openai/openai_highflame_stream&non-stream.js similarity index 100% rename from examples/openai/openai_javelin_stream&non-stream.js rename to examples/openai/openai_highflame_stream&non-stream.js diff --git a/examples/rag/javelin_rag_embeddings_demo.ipynb b/examples/rag/highflame_rag_embeddings_demo.ipynb similarity index 100% rename from examples/rag/javelin_rag_embeddings_demo.ipynb rename to examples/rag/highflame_rag_embeddings_demo.ipynb diff --git a/examples/rag/rag_implemetation_javelin.ipynb b/examples/rag/rag_implemetation_highflame.ipynb similarity index 100% rename from examples/rag/rag_implemetation_javelin.ipynb rename to examples/rag/rag_implemetation_highflame.ipynb diff --git a/examples/route_examples/javelin_sdk_app.py b/examples/route_examples/highflame_sdk_app.py similarity index 100% rename from examples/route_examples/javelin_sdk_app.py rename to examples/route_examples/highflame_sdk_app.py From 1a147a2625a31b2f1155cb34cc849a42e9adfc43 Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 00:34:30 +0530 Subject: [PATCH 08/18] update documentation, branding, github repo references to HighFlame and example file paths. --- README.md | 42 +++++++++++++++++++++--------------------- pyproject.toml | 4 ++-- swagger/README.md | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 117aac7..6ca8951 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ [![Ask DeepWiki](https://deepwiki.com/badge.svg "DeepWiki Documentation")](https://deepwiki.com/getjavelin/javelin-python) -## Javelin: an Enterprise-Scale, Fast LLM Gateway/Edge +## HighFlame: an Enterprise-Scale, Fast LLM Gateway/Edge -This is the Python client package for Javelin. +This is the Python client package for HighFlame. -For more information about Javelin, see https://getjavelin.com +For more information about HighFlame, see https://highflame.com -Javelin Documentation: https://docs.getjavelin.io +HighFlame Documentation: https://docs.getjavelin.io ### Development @@ -69,41 +69,41 @@ pip install dist/highflame_sdk--py3-none-any.whl ## [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: +HighFlame provides universal endpoints that allow you to use a consistent interface across different LLM providers. Here are the main patterns: #### Azure OpenAI -- [Basic Azure OpenAI integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/azure-openai/azure-universal.py) -- [Universal endpoint implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/azure-openai/javelin_azureopenai_univ_endpoint.py) -- [OpenAI-compatible interface](https://github.com/highflame-ai/javelin-python/blob/main/examples/azure-openai/openai_compatible_univ_azure.py) +- [Basic Azure OpenAI integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/azure-openai/azure-universal.py) +- [Universal endpoint implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/azure-openai/highflame_azureopenai_univ_endpoint.py) +- [OpenAI-compatible interface](https://github.com/highflame-ai/highflame-python/blob/main/examples/azure-openai/openai_compatible_univ_azure.py) #### Bedrock -- [Basic Bedrock integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/bedrock/bedrock_client_universal.py) -- [Universal endpoint implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/bedrock/javelin_bedrock_univ_endpoint.py) -- [OpenAI-compatible interface](https://github.com/highflame-ai/javelin-python/blob/main/examples/bedrock/openai_compatible_univ_bedrock.py) +- [Basic Bedrock integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/bedrock/bedrock_client_universal.py) +- [Universal endpoint implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/bedrock/highflame_bedrock_univ_endpoint.py) +- [OpenAI-compatible interface](https://github.com/highflame-ai/highflame-python/blob/main/examples/bedrock/openai_compatible_univ_bedrock.py) #### Gemini -- [Basic Gemini integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/gemini-universal.py) -- [Universal endpoint implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/javelin_gemini_univ_endpoint.py) -- [OpenAI-compatible interface](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/openai_compatible_univ_gemini.py) +- [Basic Gemini integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/gemini-universal.py) +- [Universal endpoint implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/highflame_gemini_univ_endpoint.py) +- [OpenAI-compatible interface](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/openai_compatible_univ_gemini.py) ### Agent Examples -- [CrewAI integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/agents/crewai_javelin.ipynb) -- [LangGraph integration](https://github.com/highflame-ai/javelin-python/blob/main/examples/agents/langgraph_javelin.ipynb) +- [CrewAI integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/agents/crewai_highflame.ipynb) +- [LangGraph integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/agents/langgraph_highflame.ipynb) ### Basic Examples -- [Asynchronous example](https://github.com/highflame-ai/javelin-python/blob/main/examples/route_examples/aexample.py) -- [Synchronous example](https://github.com/highflame-ai/javelin-python/blob/main/examples/route_examples/example.py) -- [Drop-in replacement example](https://github.com/highflame-ai/javelin-python/blob/main/examples/route_examples/drop_in_replacement.py) +- [Asynchronous example](https://github.com/highflame-ai/highflame-python/blob/main/examples/route_examples/aexample.py) +- [Synchronous example](https://github.com/highflame-ai/highflame-python/blob/main/examples/route_examples/example.py) +- [Drop-in replacement example](https://github.com/highflame-ai/highflame-python/blob/main/examples/route_examples/drop_in_replacement.py) ### Advanced Examples -- [Document processing](https://github.com/highflame-ai/javelin-python/blob/main/examples/gemini/document_processing.py) -- [RAG implementation](https://github.com/highflame-ai/javelin-python/blob/main/examples/rag/javelin_rag_embeddings_demo.ipynb) +- [Document processing](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/document_processing.py) +- [RAG implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/rag/highflame_rag_embeddings_demo.ipynb) ## Additional Integration Patterns diff --git a/pyproject.toml b/pyproject.toml index 8731976..ba1fd21 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,11 @@ [tool.poetry] name = "highflame-sdk" version = "0.2.7-dev" -description = "Python client for Javelin" +description = "Python client for HighFlame" authors = ["Sharath Rajasekar "] readme = "README.md" license = "Apache-2.0" -homepage = "https://getjavelin.com" +homepage = "https://highflame.com" packages = [ { include = "highflame_cli" }, { include = "highflame_sdk" }, diff --git a/swagger/README.md b/swagger/README.md index c5dabbe..a050169 100644 --- a/swagger/README.md +++ b/swagger/README.md @@ -1,6 +1,6 @@ # Swagger Model Sync -This directory contains a script (`sync_models.py`) for synchronizing Python models with a Swagger/OpenAPI specification from javelin admin repo. +This directory contains a script (`sync_models.py`) for synchronizing Python models with a Swagger/OpenAPI specification from HighFlame admin repo. ## Purpose From 6c921ec0b91d04240920aae1fd47003a7f8ebe23 Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 00:58:29 +0530 Subject: [PATCH 09/18] Update tooling scripts to reference highflame_sdk instead of javelin_sdk. --- Makefile | 2 +- swagger/sync_models.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index bc4e7c4..29be6bd 100644 --- a/Makefile +++ b/Makefile @@ -30,4 +30,4 @@ install: poetry install install-wheel: - pip install dist/javelin_sdk-0.2.6-py3-none-any.whl --force-reinstall + pip install dist/highflame_sdk-*.whl --force-reinstall diff --git a/swagger/sync_models.py b/swagger/sync_models.py index 48bff68..fc756b1 100644 --- a/swagger/sync_models.py +++ b/swagger/sync_models.py @@ -8,7 +8,7 @@ SWAGGER_FILE_PATH = Path(os.path.join(os.path.dirname(__file__), "swagger.yaml")) MODELS_FILE_PATH = Path( - os.path.join(os.path.dirname(__file__), "..", "javelin_sdk", "models.py") + os.path.join(os.path.dirname(__file__), "..", "highflame_sdk", "models.py") ) FIELDS_TO_EXCLUDE = { @@ -172,10 +172,10 @@ def modify_and_convert_swagger(input_file, output_file): # Add info section with title and version swagger_data["info"] = { - "title": "Javelin Admin API", + "title": "HighFlame Admin API", "version": "1.0", "contact": {}, - "description": "This is the Javelin Admin API", + "description": "This is the HighFlame Admin API", } # Remove 'providername' from '/v1/admin/providers/secrets/keys' path From aa5a78a825fb0bd45157cdcb61ef6f1eb3512dde Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 01:56:36 +0530 Subject: [PATCH 10/18] fix: minor error --- highflame_sdk/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/highflame_sdk/__init__.py b/highflame_sdk/__init__.py index 6927478..97d2133 100644 --- a/highflame_sdk/__init__.py +++ b/highflame_sdk/__init__.py @@ -1,11 +1,13 @@ from highflame_sdk.client import JavelinClient from highflame_sdk.exceptions import ( BadRequest, + GatewayAlreadyExistsError, GatewayNotFoundError, InternalServerError, MethodNotAllowedError, NetworkError, ProviderAlreadyExistsError, + ProviderNotFoundError, RateLimitExceededError, RouteAlreadyExistsError, RouteNotFoundError, @@ -33,7 +35,8 @@ __all__ = [ "GatewayNotFoundError", - "GatewayAlreadyExistsError" "ProviderNotFoundError", + "GatewayAlreadyExistsError", + "ProviderNotFoundError", "ProviderAlreadyExistsError", "RouteNotFoundError", "RouteAlreadyExistsError", From dbf09d29b88809de367e2751f3c50384ff0ede66 Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 20:49:06 +0530 Subject: [PATCH 11/18] refactor: rename core classes from Javelin to Highflame MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Rename JavelinClient → Highflame - Rename JavelinConfig → Config - Rename JavelinRequestWrapper → RequestWrapper - Simplify Config to use api_key directly - Update base URL to https://api.highflame.app - Maintain dual header support (x-highflame-* and x-javelin-*) for backward compatibility --- highflame_sdk/__init__.py | 8 ++--- highflame_sdk/client.py | 47 ++++++++++++++-------------- highflame_sdk/models.py | 64 ++++++++------------------------------- 3 files changed, 40 insertions(+), 79 deletions(-) diff --git a/highflame_sdk/__init__.py b/highflame_sdk/__init__.py index 97d2133..c2a381d 100644 --- a/highflame_sdk/__init__.py +++ b/highflame_sdk/__init__.py @@ -1,4 +1,4 @@ -from highflame_sdk.client import JavelinClient +from highflame_sdk.client import Highflame from highflame_sdk.exceptions import ( BadRequest, GatewayAlreadyExistsError, @@ -21,7 +21,7 @@ from highflame_sdk.models import ( Gateway, Gateways, - JavelinConfig, + Config, Provider, Providers, QueryResponse, @@ -63,6 +63,6 @@ "Secrets", "QueryBody", "QueryResponse", - "JavelinClient", - "JavelinConfig", + "Highflame", + "Config", ] diff --git a/highflame_sdk/client.py b/highflame_sdk/client.py index 961034b..8171e28 100644 --- a/highflame_sdk/client.py +++ b/highflame_sdk/client.py @@ -11,7 +11,7 @@ from opentelemetry.trace import SpanKind, Status, StatusCode from highflame_sdk.chat_completions import Chat, Completions, Embeddings -from highflame_sdk.models import HttpMethod, JavelinConfig, Request +from highflame_sdk.models import HttpMethod, Config, Request from highflame_sdk.services.gateway_service import GatewayService from highflame_sdk.services.modelspec_service import ModelSpecService from highflame_sdk.services.provider_service import ProviderService @@ -23,12 +23,12 @@ from highflame_sdk.services.guardrails_service import GuardrailsService from highflame_sdk.tracing_setup import configure_span_exporter -API_BASEURL = "https://api-dev.javelin.live" +API_BASEURL = "https://api.highflame.app" API_BASE_PATH = "/v1" API_TIMEOUT = 10 -class JavelinRequestWrapper: +class RequestWrapper: """A wrapper around Botocore's request object to store additional metadata.""" def __init__(self, original_request, span): @@ -36,7 +36,7 @@ def __init__(self, original_request, span): self.span = span -class JavelinClient: +class Highflame: BEDROCK_RUNTIME_OPERATIONS = frozenset( {"InvokeModel", "InvokeModelWithResponseStream", "Converse", "ConverseStream"} ) @@ -74,24 +74,20 @@ class JavelinClient: "images.create_variation": "image_variation", } - def __init__(self, config: JavelinConfig) -> None: + def __init__(self, config: Config) -> None: self.config = config self.base_url = urljoin(config.base_url, config.api_version or "/v1") - # Use properties that support both old and new field names - api_key = config.api_key - virtual_api_key = config.virtual_api_key - # Send both headers for backward compatibility (backend may accept either) self._headers = { - "x-highflame-apikey": api_key, # New header - "x-javelin-apikey": api_key, # Old header (for backward compatibility) + "x-highflame-apikey": config.api_key, # New header + "x-javelin-apikey": config.api_key, # Old header (for backward compatibility) } if config.llm_api_key: self._headers["Authorization"] = f"Bearer {config.llm_api_key}" - if virtual_api_key: - self._headers["x-highflame-virtualapikey"] = virtual_api_key # New header - self._headers["x-javelin-virtualapikey"] = virtual_api_key # Old header (for backward compatibility) + if config.virtual_api_key: + self._headers["x-highflame-virtualapikey"] = config.virtual_api_key # New header + self._headers["x-javelin-virtualapikey"] = config.virtual_api_key # Old header (for backward compatibility) self._client = None self._aclient = None self.bedrock_client = None @@ -145,13 +141,13 @@ def aclient(self): ) return self._aclient - async def __aenter__(self) -> "JavelinClient": + async def __aenter__(self) -> "Highflame": return self async def __aexit__(self, exc_type, exc_val, exc_tb) -> None: await self.aclose() - def __enter__(self) -> "JavelinClient": + def __enter__(self) -> "Highflame": return self def __exit__(self, exc_type, exc_val, exc_tb) -> None: @@ -193,7 +189,8 @@ def _setup_client_headers(self, openai_client, route_name): openai_client._custom_headers.update(self._headers) if route_name is not None: - openai_client._custom_headers["x-javelin-route"] = route_name + openai_client._custom_headers["x-highflame-route"] = route_name # New header + openai_client._custom_headers["x-javelin-route"] = route_name # Old header (for backward compatibility) # Ensure the client uses the custom headers if hasattr(openai_client, "default_headers"): @@ -283,7 +280,8 @@ def _execute_with_tracing( def _setup_custom_headers(self, openai_client, model): """Setup custom headers for the OpenAI client.""" if model and hasattr(openai_client, "_custom_headers"): - openai_client._custom_headers["x-javelin-model"] = model + openai_client._custom_headers["x-highflame-model"] = model # New header + openai_client._custom_headers["x-javelin-model"] = model # Old header (for backward compatibility) if not hasattr(openai_client, "_custom_headers"): return @@ -773,11 +771,13 @@ def override_endpoint_url(request: Any, **kwargs) -> None: # Construct the base URL (scheme + netloc) base_url = f"{original_url.scheme}://{original_url.netloc}" - # Set the header - request.headers["x-javelin-provider"] = base_url + # Set the header (dual support for backward compatibility) + request.headers["x-highflame-provider"] = base_url # New header + request.headers["x-javelin-provider"] = base_url # Old header (for backward compatibility) if self.use_default_bedrock_route and self.default_bedrock_route: - request.headers["x-javelin-route"] = self.default_bedrock_route + request.headers["x-highflame-route"] = self.default_bedrock_route # New header + request.headers["x-javelin-route"] = self.default_bedrock_route # Old header (for backward compatibility) path = original_url.path path = unquote(path) @@ -788,7 +788,8 @@ def override_endpoint_url(request: Any, **kwargs) -> None: if model_id: model_id = re.sub(r"-\d{8}(?=-)", "", model_id) - request.headers["x-javelin-model"] = model_id + request.headers["x-highflame-model"] = model_id # New header + request.headers["x-javelin-model"] = model_id # Old header (for backward compatibility) # Update the request URL to use the Javelin endpoint. parsed_base = urlparse(self.base_url) @@ -827,7 +828,7 @@ def bedrock_before_call(**kwargs): span = self.tracer.start_span(operation_name, kind=SpanKind.CLIENT) # Store it in the context - context["javelin_request_wrapper"] = JavelinRequestWrapper(None, span) + context["javelin_request_wrapper"] = RequestWrapper(None, span) def bedrock_after_call(**kwargs): """ diff --git a/highflame_sdk/models.py b/highflame_sdk/models.py index a6fb80e..9d1f203 100644 --- a/highflame_sdk/models.py +++ b/highflame_sdk/models.py @@ -465,23 +465,14 @@ class QueryResponse(BaseModel): usage: Usage = Field(..., description="Usage details") -class JavelinConfig(BaseModel): - # Primary fields (old names kept for backward compatibility) - javelin_api_key: Optional[str] = Field( - default=None, description="Javelin API key (deprecated, use highflame_api_key)" - ) - highflame_api_key: Optional[str] = Field( - default=None, description="HighFlame API key" - ) +class Config(BaseModel): + api_key: str = Field(..., description="Highflame API key") base_url: str = Field( - default="https://api-dev.javelin.live", - description="Base URL for the Javelin API", - ) - javelin_virtualapikey: Optional[str] = Field( - default=None, description="Virtual API key for Javelin (deprecated, use highflame_virtualapikey)" + default="https://api.highflame.app", + description="Base URL for the Highflame API", ) - highflame_virtualapikey: Optional[str] = Field( - default=None, description="Virtual API key for HighFlame" + virtual_api_key: Optional[str] = Field( + default=None, description="Virtual API key for Highflame" ) llm_api_key: Optional[str] = Field( default=None, description="API key for the LLM provider" @@ -494,50 +485,19 @@ class JavelinConfig(BaseModel): default=None, description="Request timeout in seconds" ) - @model_validator(mode="before") + @field_validator("api_key") @classmethod - def handle_backward_compatibility(cls, data: Any) -> Any: - """Handle backward compatibility between old and new field names""" - if isinstance(data, dict): - # Support both highflame_api_key and javelin_api_key - # If both are provided, prefer highflame_api_key - if "highflame_api_key" in data and "javelin_api_key" not in data: - data["javelin_api_key"] = data["highflame_api_key"] - elif "javelin_api_key" in data and "highflame_api_key" not in data: - data["highflame_api_key"] = data["javelin_api_key"] - - # Support both highflame_virtualapikey and javelin_virtualapikey - if "highflame_virtualapikey" in data and "javelin_virtualapikey" not in data: - data["javelin_virtualapikey"] = data.get("highflame_virtualapikey") - elif "javelin_virtualapikey" in data and "highflame_virtualapikey" not in data: - data["highflame_virtualapikey"] = data.get("javelin_virtualapikey") - return data - - @model_validator(mode="after") - def validate_at_least_one_api_key(self) -> "JavelinConfig": - """Ensure at least one API key field is provided and not empty""" - api_key = self.highflame_api_key or self.javelin_api_key - if not api_key or (isinstance(api_key, str) and api_key.strip() == ""): + def validate_api_key(cls, value: str) -> str: + if not value: raise UnauthorizedError( response=None, message=( - "Please provide a valid HighFlame API Key (highflame_api_key) or " - "Javelin API Key (javelin_api_key for backward compatibility). " - "When you sign into HighFlame, you can find your API Key in the " + "Please provide a valid Highflame API Key. " + "When you sign into Highflame, you can find your API Key in the " "Account->Developer settings" ), ) - return self - - @property - def api_key(self) -> str: - """Get the API key (prefers highflame_api_key, falls back to javelin_api_key)""" - return self.highflame_api_key or self.javelin_api_key or "" - - @property - def virtual_api_key(self) -> Optional[str]: - """Get the virtual API key (prefers highflame_virtualapikey, falls back to javelin_virtualapikey)""" - return self.highflame_virtualapikey or self.javelin_virtualapikey + return value class HttpMethod(Enum): From 8ce79b71692d8f5e1010e9e5a39a39aeeb3122eb Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 20:55:47 +0530 Subject: [PATCH 12/18] rename exception classes and update package structure --- {highflame_sdk => highflame}/__init__.py | 6 +-- .../chat_completions.py | 4 +- {highflame_sdk => highflame}/client.py | 24 +++++----- {highflame_sdk => highflame}/exceptions.py | 44 +++++++++---------- .../model_adapters.py | 0 {highflame_sdk => highflame}/models.py | 2 +- .../services/aispm_service.py | 2 +- .../services/gateway_service.py | 4 +- .../services/guardrails_service.py | 4 +- .../services/modelspec_service.py | 4 +- .../services/provider_service.py | 4 +- .../services/route_service.py | 4 +- .../services/secret_service.py | 4 +- .../services/template_service.py | 4 +- .../services/trace_service.py | 4 +- {highflame_sdk => highflame}/tracing_setup.py | 2 +- highflame_cli/_internal/commands.py | 24 +++++----- pyproject.toml | 10 +++-- 18 files changed, 76 insertions(+), 74 deletions(-) rename {highflame_sdk => highflame}/__init__.py (91%) rename {highflame_sdk => highflame}/chat_completions.py (99%) rename {highflame_sdk => highflame}/client.py (98%) rename {highflame_sdk => highflame}/exceptions.py (82%) rename {highflame_sdk => highflame}/model_adapters.py (100%) rename {highflame_sdk => highflame}/models.py (99%) rename {highflame_sdk => highflame}/services/aispm_service.py (96%) rename {highflame_sdk => highflame}/services/gateway_service.py (97%) rename {highflame_sdk => highflame}/services/guardrails_service.py (96%) rename {highflame_sdk => highflame}/services/modelspec_service.py (96%) rename {highflame_sdk => highflame}/services/provider_service.py (99%) rename {highflame_sdk => highflame}/services/route_service.py (99%) rename {highflame_sdk => highflame}/services/secret_service.py (98%) rename {highflame_sdk => highflame}/services/template_service.py (98%) rename {highflame_sdk => highflame}/services/trace_service.py (94%) rename {highflame_sdk => highflame}/tracing_setup.py (98%) diff --git a/highflame_sdk/__init__.py b/highflame/__init__.py similarity index 91% rename from highflame_sdk/__init__.py rename to highflame/__init__.py index c2a381d..4bf1c41 100644 --- a/highflame_sdk/__init__.py +++ b/highflame/__init__.py @@ -1,5 +1,5 @@ -from highflame_sdk.client import Highflame -from highflame_sdk.exceptions import ( +from highflame.client import Highflame +from highflame.exceptions import ( BadRequest, GatewayAlreadyExistsError, GatewayNotFoundError, @@ -18,7 +18,7 @@ UnauthorizedError, ValidationError, ) -from highflame_sdk.models import ( +from highflame.models import ( Gateway, Gateways, Config, diff --git a/highflame_sdk/chat_completions.py b/highflame/chat_completions.py similarity index 99% rename from highflame_sdk/chat_completions.py rename to highflame/chat_completions.py index 2f063d6..ca56b01 100644 --- a/highflame_sdk/chat_completions.py +++ b/highflame/chat_completions.py @@ -1,8 +1,8 @@ import logging from typing import Any, Dict, Generator, List, Optional, Union -from highflame_sdk.model_adapters import ModelTransformer, TransformationRuleManager -from highflame_sdk.models import EndpointType +from highflame.model_adapters import ModelTransformer, TransformationRuleManager +from highflame.models import EndpointType logger = logging.getLogger(__name__) diff --git a/highflame_sdk/client.py b/highflame/client.py similarity index 98% rename from highflame_sdk/client.py rename to highflame/client.py index 8171e28..000f99e 100644 --- a/highflame_sdk/client.py +++ b/highflame/client.py @@ -10,18 +10,18 @@ from opentelemetry.semconv._incubating.attributes import gen_ai_attributes from opentelemetry.trace import SpanKind, Status, StatusCode -from highflame_sdk.chat_completions import Chat, Completions, Embeddings -from highflame_sdk.models import HttpMethod, Config, Request -from highflame_sdk.services.gateway_service import GatewayService -from highflame_sdk.services.modelspec_service import ModelSpecService -from highflame_sdk.services.provider_service import ProviderService -from highflame_sdk.services.route_service import RouteService -from highflame_sdk.services.secret_service import SecretService -from highflame_sdk.services.template_service import TemplateService -from highflame_sdk.services.trace_service import TraceService -from highflame_sdk.services.aispm_service import AISPMService -from highflame_sdk.services.guardrails_service import GuardrailsService -from highflame_sdk.tracing_setup import configure_span_exporter +from highflame.chat_completions import Chat, Completions, Embeddings +from highflame.models import HttpMethod, Config, Request +from highflame.services.gateway_service import GatewayService +from highflame.services.modelspec_service import ModelSpecService +from highflame.services.provider_service import ProviderService +from highflame.services.route_service import RouteService +from highflame.services.secret_service import SecretService +from highflame.services.template_service import TemplateService +from highflame.services.trace_service import TraceService +from highflame.services.aispm_service import AISPMService +from highflame.services.guardrails_service import GuardrailsService +from highflame.tracing_setup import configure_span_exporter API_BASEURL = "https://api.highflame.app" API_BASE_PATH = "/v1" diff --git a/highflame_sdk/exceptions.py b/highflame/exceptions.py similarity index 82% rename from highflame_sdk/exceptions.py rename to highflame/exceptions.py index 965b0e9..2eefbfa 100644 --- a/highflame_sdk/exceptions.py +++ b/highflame/exceptions.py @@ -4,16 +4,16 @@ from pydantic import ValidationError as PydanticValidationError -class JavelinClientError(Exception): +class ClientError(Exception): """ - Base exception class for JavelinClient errors. + Base exception class for Highflame client errors. Attributes ---------- message : str - The error message associated with the JavelinClient error. + The error message associated with the client error. response_data : Optional[dict] - The response data associated with the JavelinClient error. + The response data associated with the client error. Parameters ---------- @@ -59,14 +59,14 @@ def __str__(self): return f"{self.message}: {self.response_data}" -class GatewayNotFoundError(JavelinClientError): +class GatewayNotFoundError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Gateway not found" ) -> None: super().__init__(message=message, response=response) -class GatewayAlreadyExistsError(JavelinClientError): +class GatewayAlreadyExistsError(ClientError): def __init__( self, response: Optional[Response] = None, @@ -75,28 +75,28 @@ def __init__( super().__init__(message=message, response=response) -class RouteNotFoundError(JavelinClientError): +class RouteNotFoundError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Route not found" ) -> None: super().__init__(message=message, response=response) -class RouteAlreadyExistsError(JavelinClientError): +class RouteAlreadyExistsError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Route already exists" ) -> None: super().__init__(message=message, response=response) -class ProviderNotFoundError(JavelinClientError): +class ProviderNotFoundError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Provider not found" ) -> None: super().__init__(message=message, response=response) -class ProviderAlreadyExistsError(JavelinClientError): +class ProviderAlreadyExistsError(ClientError): def __init__( self, response: Optional[Response] = None, @@ -105,21 +105,21 @@ def __init__( super().__init__(message=message, response=response) -class TemplateNotFoundError(JavelinClientError): +class TemplateNotFoundError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Template not found" ) -> None: super().__init__(message=message, response=response) -class TraceNotFoundError(JavelinClientError): +class TraceNotFoundError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Trace not found" ) -> None: super().__init__(message=message, response=response) -class TemplateAlreadyExistsError(JavelinClientError): +class TemplateAlreadyExistsError(ClientError): def __init__( self, response: Optional[Response] = None, @@ -128,14 +128,14 @@ def __init__( super().__init__(message=message, response=response) -class SecretNotFoundError(JavelinClientError): +class SecretNotFoundError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Secret not found" ) -> None: super().__init__(message=message, response=response) -class SecretAlreadyExistsError(JavelinClientError): +class SecretAlreadyExistsError(ClientError): def __init__( self, response: Optional[Response] = None, @@ -144,28 +144,28 @@ def __init__( super().__init__(message=message, response=response) -class NetworkError(JavelinClientError): +class NetworkError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Connection error" ) -> None: super().__init__(message=message, response=response) -class BadRequest(JavelinClientError): +class BadRequest(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Bad Request" ) -> None: super().__init__(message=message, response=response) -class RateLimitExceededError(JavelinClientError): +class RateLimitExceededError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Rate limit exceeded" ) -> None: super().__init__(message=message, response=response) -class InternalServerError(JavelinClientError): +class InternalServerError(ClientError): def __init__( self, response: Optional[Response] = None, @@ -174,14 +174,14 @@ def __init__( super().__init__(message=message, response=response) -class MethodNotAllowedError(JavelinClientError): +class MethodNotAllowedError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Method not allowed" ) -> None: super().__init__(message=message, response=response) -class UnauthorizedError(JavelinClientError): +class UnauthorizedError(ClientError): def __init__( self, response: Optional[Response] = None, message: str = "Access denied" ) -> None: @@ -192,7 +192,7 @@ def __str__(self): return self.message -class ValidationError(JavelinClientError): +class ValidationError(ClientError): def __init__( self, error: PydanticValidationError, message: str = "Validation error occurred" ) -> None: diff --git a/highflame_sdk/model_adapters.py b/highflame/model_adapters.py similarity index 100% rename from highflame_sdk/model_adapters.py rename to highflame/model_adapters.py diff --git a/highflame_sdk/models.py b/highflame/models.py similarity index 99% rename from highflame_sdk/models.py rename to highflame/models.py index 9d1f203..fdbb713 100644 --- a/highflame_sdk/models.py +++ b/highflame/models.py @@ -2,7 +2,7 @@ from enum import Enum, auto from typing import Any, Dict, List, Optional -from highflame_sdk.exceptions import UnauthorizedError +from highflame.exceptions import UnauthorizedError from pydantic import BaseModel, Field, field_validator, model_validator diff --git a/highflame_sdk/services/aispm_service.py b/highflame/services/aispm_service.py similarity index 96% rename from highflame_sdk/services/aispm_service.py rename to highflame/services/aispm_service.py index 36288b0..929372e 100644 --- a/highflame_sdk/services/aispm_service.py +++ b/highflame/services/aispm_service.py @@ -2,7 +2,7 @@ from httpx import Response import json -from highflame_sdk.models import ( +from highflame.models import ( Customer, CustomerResponse, AWSConfig, diff --git a/highflame_sdk/services/gateway_service.py b/highflame/services/gateway_service.py similarity index 97% rename from highflame_sdk/services/gateway_service.py rename to highflame/services/gateway_service.py index 349cf25..d866c27 100644 --- a/highflame_sdk/services/gateway_service.py +++ b/highflame/services/gateway_service.py @@ -1,5 +1,5 @@ import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, GatewayAlreadyExistsError, GatewayNotFoundError, @@ -7,7 +7,7 @@ RateLimitExceededError, UnauthorizedError, ) -from highflame_sdk.models import Gateway, Gateways, HttpMethod, Request +from highflame.models import Gateway, Gateways, HttpMethod, Request class GatewayService: diff --git a/highflame_sdk/services/guardrails_service.py b/highflame/services/guardrails_service.py similarity index 96% rename from highflame_sdk/services/guardrails_service.py rename to highflame/services/guardrails_service.py index db557ca..22a25af 100644 --- a/highflame_sdk/services/guardrails_service.py +++ b/highflame/services/guardrails_service.py @@ -1,11 +1,11 @@ import httpx from typing import Any, Dict, Optional -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, RateLimitExceededError, UnauthorizedError, ) -from highflame_sdk.models import HttpMethod, Request +from highflame.models import HttpMethod, Request class GuardrailsService: diff --git a/highflame_sdk/services/modelspec_service.py b/highflame/services/modelspec_service.py similarity index 96% rename from highflame_sdk/services/modelspec_service.py rename to highflame/services/modelspec_service.py index f20e16f..4eabd52 100644 --- a/highflame_sdk/services/modelspec_service.py +++ b/highflame/services/modelspec_service.py @@ -1,13 +1,13 @@ from typing import Any, Dict, Optional import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, UnauthorizedError, ) -from highflame_sdk.models import HttpMethod, Request +from highflame.models import HttpMethod, Request class ModelSpecService: diff --git a/highflame_sdk/services/provider_service.py b/highflame/services/provider_service.py similarity index 99% rename from highflame_sdk/services/provider_service.py rename to highflame/services/provider_service.py index d0c6e47..effce5d 100644 --- a/highflame_sdk/services/provider_service.py +++ b/highflame/services/provider_service.py @@ -1,7 +1,7 @@ from typing import Any, Dict, Optional import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, InternalServerError, ProviderAlreadyExistsError, @@ -9,7 +9,7 @@ RateLimitExceededError, UnauthorizedError, ) -from highflame_sdk.models import ( +from highflame.models import ( EndpointType, HttpMethod, Provider, diff --git a/highflame_sdk/services/route_service.py b/highflame/services/route_service.py similarity index 99% rename from highflame_sdk/services/route_service.py rename to highflame/services/route_service.py index 12cbc45..59c8fd0 100644 --- a/highflame_sdk/services/route_service.py +++ b/highflame/services/route_service.py @@ -2,7 +2,7 @@ from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Union import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, @@ -10,7 +10,7 @@ RouteNotFoundError, UnauthorizedError, ) -from highflame_sdk.models import HttpMethod, Request, Route, Routes, UnivModelConfig +from highflame.models import HttpMethod, Request, Route, Routes, UnivModelConfig from jsonpath_ng import parse diff --git a/highflame_sdk/services/secret_service.py b/highflame/services/secret_service.py similarity index 98% rename from highflame_sdk/services/secret_service.py rename to highflame/services/secret_service.py index 1e3747b..ecd750b 100644 --- a/highflame_sdk/services/secret_service.py +++ b/highflame/services/secret_service.py @@ -1,5 +1,5 @@ import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, @@ -7,7 +7,7 @@ SecretNotFoundError, UnauthorizedError, ) -from highflame_sdk.models import HttpMethod, Request, Secret, Secrets +from highflame.models import HttpMethod, Request, Secret, Secrets class SecretService: diff --git a/highflame_sdk/services/template_service.py b/highflame/services/template_service.py similarity index 98% rename from highflame_sdk/services/template_service.py rename to highflame/services/template_service.py index 22f2fc7..3f9e1e8 100644 --- a/highflame_sdk/services/template_service.py +++ b/highflame/services/template_service.py @@ -1,5 +1,5 @@ import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, @@ -7,7 +7,7 @@ TemplateNotFoundError, UnauthorizedError, ) -from highflame_sdk.models import HttpMethod, Request, Template, Templates +from highflame.models import HttpMethod, Request, Template, Templates class TemplateService: diff --git a/highflame_sdk/services/trace_service.py b/highflame/services/trace_service.py similarity index 94% rename from highflame_sdk/services/trace_service.py rename to highflame/services/trace_service.py index 0789b57..61943a3 100644 --- a/highflame_sdk/services/trace_service.py +++ b/highflame/services/trace_service.py @@ -1,14 +1,14 @@ from typing import Any import httpx -from highflame_sdk.exceptions import ( +from highflame.exceptions import ( BadRequest, InternalServerError, RateLimitExceededError, TraceNotFoundError, UnauthorizedError, ) -from highflame_sdk.models import HttpMethod, Request, Template +from highflame.models import HttpMethod, Request, Template class TraceService: diff --git a/highflame_sdk/tracing_setup.py b/highflame/tracing_setup.py similarity index 98% rename from highflame_sdk/tracing_setup.py rename to highflame/tracing_setup.py index 29014ec..86ce3e1 100644 --- a/highflame_sdk/tracing_setup.py +++ b/highflame/tracing_setup.py @@ -1,4 +1,4 @@ -# highflame_sdk/tracing_setup.py +# highflame/tracing_setup.py # from opentelemetry.instrumentation.botocore import BotocoreInstrumentor import os from typing import Optional diff --git a/highflame_cli/_internal/commands.py b/highflame_cli/_internal/commands.py index 3c5dc30..191935d 100644 --- a/highflame_cli/_internal/commands.py +++ b/highflame_cli/_internal/commands.py @@ -1,17 +1,17 @@ import json from pathlib import Path -from highflame_sdk.client import JavelinClient -from highflame_sdk.exceptions import ( +from highflame.client import Highflame +from highflame.exceptions import ( BadRequest, NetworkError, UnauthorizedError, ) -from highflame_sdk.models import ( +from highflame.models import ( AWSConfig, Gateway, GatewayConfig, - JavelinConfig, + Config, Customer, Model, Provider, @@ -96,13 +96,13 @@ def get_javelin_client_aispm(): javelin_api_key = selected_gateway.get("api_key_value", "placeholder") - # Initialize and return the JavelinClient - config = JavelinConfig( + # Initialize and return the Highflame client + config = Config( base_url=base_url, - javelin_api_key=javelin_api_key, + api_key=javelin_api_key, ) - client = JavelinClient(config) + client = Highflame(config) # Store account_id in client for AISPM service to use if account_id: @@ -165,13 +165,13 @@ def get_javelin_client(): ), ) - # Initialize the JavelinClient when required - config = JavelinConfig( + # Initialize the Highflame client when required + config = Config( base_url=base_url, - javelin_api_key=javelin_api_key, + api_key=javelin_api_key, ) - return JavelinClient(config) + return Highflame(config) def create_customer(args): diff --git a/pyproject.toml b/pyproject.toml index ba1fd21..b5b7422 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,16 @@ [tool.poetry] -name = "highflame-sdk" -version = "0.2.7-dev" -description = "Python client for HighFlame" +name = "highflame" +version = "2.0.0" +description = "Python SDK for Highflame - Enterprise-Scale LLM Gateway" authors = ["Sharath Rajasekar "] readme = "README.md" license = "Apache-2.0" homepage = "https://highflame.com" +repository = "https://github.com/highflame-ai/highflame-python" +keywords = ["llm", "gateway", "ai", "api", "routing"] packages = [ { include = "highflame_cli" }, - { include = "highflame_sdk" }, + { include = "highflame" }, ] [tool.poetry.scripts] From 408043575b278024501b3679d061651f2561b77f Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 21:01:49 +0530 Subject: [PATCH 13/18] feat: add logging implementation and update config fields, variable names --- highflame/client.py | 12 ++-- highflame/services/aispm_service.py | 2 +- highflame/services/route_service.py | 4 ++ highflame/tracing_setup.py | 11 +++- highflame_cli/_internal/commands.py | 88 ++++++++++++++--------------- 5 files changed, 66 insertions(+), 51 deletions(-) diff --git a/highflame/client.py b/highflame/client.py index 000f99e..d2cb334 100644 --- a/highflame/client.py +++ b/highflame/client.py @@ -27,6 +27,8 @@ API_BASE_PATH = "/v1" API_TIMEOUT = 10 +logger = logging.getLogger(__name__) + class RequestWrapper: """A wrapper around Botocore's request object to store additional metadata.""" @@ -78,6 +80,8 @@ def __init__(self, config: Config) -> None: self.config = config self.base_url = urljoin(config.base_url, config.api_version or "/v1") + logger.debug(f"Initializing Highflame client with base_url={self.base_url}") + # Send both headers for backward compatibility (backend may accept either) self._headers = { "x-highflame-apikey": config.api_key, # New header @@ -828,7 +832,7 @@ def bedrock_before_call(**kwargs): span = self.tracer.start_span(operation_name, kind=SpanKind.CLIENT) # Store it in the context - context["javelin_request_wrapper"] = RequestWrapper(None, span) + context["highflame_request_wrapper"] = RequestWrapper(None, span) def bedrock_after_call(**kwargs): """ @@ -838,7 +842,7 @@ def bedrock_after_call(**kwargs): if not context: return - wrapper = context.get("javelin_request_wrapper") + wrapper = context.get("highflame_request_wrapper") if not wrapper: return @@ -927,8 +931,8 @@ def register_bedrock( Example: >>> bedrock = boto3.client('bedrock-runtime') - >>> modified_client = javelin_client.register_bedrock_client(bedrock) - >>> javelin_client.register_bedrock_client(bedrock) + >>> modified_client = highflame_client.register_bedrock_client(bedrock) + >>> highflame_client.register_bedrock_client(bedrock) >>> bedrock.invoke_model( """ self._setup_bedrock_clients( diff --git a/highflame/services/aispm_service.py b/highflame/services/aispm_service.py index 929372e..f5e3beb 100644 --- a/highflame/services/aispm_service.py +++ b/highflame/services/aispm_service.py @@ -23,7 +23,7 @@ def __init__(self, client): def _get_aispm_headers(self) -> Dict[str, str]: """Get headers for AISPM requests, including account_id if available.""" headers = {} - # Check if account_id is stored in client (set by get_javelin_client_aispm) + # Check if account_id is stored in client (set by get_highflame_client_aispm) account_id = getattr(self.client, "_aispm_account_id", None) if account_id: headers["x-javelin-accountid"] = account_id diff --git a/highflame/services/route_service.py b/highflame/services/route_service.py index 59c8fd0..2c1445d 100644 --- a/highflame/services/route_service.py +++ b/highflame/services/route_service.py @@ -1,7 +1,10 @@ import json +import logging from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Union import httpx + +logger = logging.getLogger(__name__) from highflame.exceptions import ( BadRequest, InternalServerError, @@ -249,6 +252,7 @@ def query_route( stream_response_path: Optional[str] = None, ) -> Union[Dict[str, Any], Generator[str, None, None]]: """Query a route synchronously.""" + logger.debug(f"Querying route: {route_name}, stream={stream}") self._validate_route_name(route_name) response = self.client._send_request_sync( diff --git a/highflame/tracing_setup.py b/highflame/tracing_setup.py index 86ce3e1..cb2cda2 100644 --- a/highflame/tracing_setup.py +++ b/highflame/tracing_setup.py @@ -1,10 +1,13 @@ # highflame/tracing_setup.py # from opentelemetry.instrumentation.botocore import BotocoreInstrumentor +import logging import os from typing import Optional from opentelemetry import trace +logger = logging.getLogger(__name__) + # from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter # Use the HTTP exporter instead of the gRPC one from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter @@ -22,9 +25,9 @@ TRACES_HEADERS = os.getenv("OTEL_EXPORTER_OTLP_HEADERS") # Initialize OpenTelemetry Tracer -resource = Resource.create({"service.name": "javelin-sdk"}) +resource = Resource.create({"service.name": "highflame"}) trace.set_tracer_provider(TracerProvider(resource=resource)) -tracer = trace.get_tracer("javelin") # Name of the tracer +tracer = trace.get_tracer("highflame") # Name of the tracer def parse_headers(header_str: Optional[str]) -> dict: @@ -47,8 +50,11 @@ def configure_span_exporter(api_key: Optional[str] = None): """ # Disable tracing if TRACES_ENDPOINT is not set if not TRACES_ENDPOINT: + logger.debug("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT not set, tracing disabled") return None + logger.debug(f"Configuring OTLP span exporter with endpoint={TRACES_ENDPOINT}") + # Parse headers from environment variable otlp_headers = parse_headers(TRACES_HEADERS) @@ -58,6 +64,7 @@ def configure_span_exporter(api_key: Optional[str] = None): # Setup OTLP Exporter with API key in headers span_exporter = OTLPSpanExporter(endpoint=TRACES_ENDPOINT, headers=otlp_headers) + logger.debug("OTLP span exporter configured successfully") span_processor = BatchSpanProcessor(span_exporter) provider = trace.get_tracer_provider() diff --git a/highflame_cli/_internal/commands.py b/highflame_cli/_internal/commands.py index 191935d..419c884 100644 --- a/highflame_cli/_internal/commands.py +++ b/highflame_cli/_internal/commands.py @@ -42,7 +42,7 @@ def get_cache_file(): return new_cache_file -def get_javelin_client_aispm(): +def get_highflame_client_aispm(): # Path to cache.json file json_file_path = get_cache_file() @@ -94,12 +94,12 @@ def get_javelin_client_aispm(): except (IndexError, AttributeError): pass - javelin_api_key = selected_gateway.get("api_key_value", "placeholder") + api_key = selected_gateway.get("api_key_value", "placeholder") # Initialize and return the Highflame client config = Config( base_url=base_url, - api_key=javelin_api_key, + api_key=api_key, ) client = Highflame(config) @@ -113,7 +113,7 @@ def get_javelin_client_aispm(): return client -def get_javelin_client(): +def get_highflame_client(): # Path to cache.json file json_file_path = get_cache_file() @@ -148,19 +148,19 @@ def get_javelin_client(): selected_gateway = gateways[choice] base_url = selected_gateway["base_url"] - javelin_api_key = selected_gateway["api_key_value"] + api_key = selected_gateway["api_key_value"] # Print all the relevant variables for debugging (optional) # print(f"Base URL: {base_url}") - # print(f"Javelin API Key: {javelin_api_key}") + # print(f"Highflame API Key: {api_key}") # Ensure the API key is set before initializing - if not javelin_api_key or javelin_api_key == "": + if not api_key or api_key == "": raise UnauthorizedError( response=None, message=( - "Please provide a valid Javelin API Key. " - "When you sign into Javelin, you can find your API Key in the " + "Please provide a valid Highflame API Key. " + "When you sign into Highflame, you can find your API Key in the " "Account->Developer settings" ), ) @@ -168,14 +168,14 @@ def get_javelin_client(): # Initialize the Highflame client when required config = Config( base_url=base_url, - api_key=javelin_api_key, + api_key=api_key, ) return Highflame(config) def create_customer(args): - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() customer = Customer( name=args.name, description=args.description, @@ -190,7 +190,7 @@ def get_customer(args): Gets customer details using the AISPM service. """ try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() response = client.aispm.get_customer() # Pretty print the response for CLI output @@ -211,7 +211,7 @@ def get_customer(args): def configure_aws(args): try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() config = json.loads(args.config) configs = [AWSConfig(**config)] client.aispm.configure_aws(configs) @@ -225,7 +225,7 @@ def get_aws_config(args): Gets AWS configurations using the AISPM service. """ try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() response = client.aispm.get_aws_configs() # Simply print the JSON response print(json.dumps(response, indent=2)) @@ -242,7 +242,7 @@ def delete_aws_config(args): Deletes an AWS configuration. """ try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() client.aispm.delete_aws_config(args.name) print(f"AWS configuration '{args.name}' deleted successfully.") except Exception as e: @@ -254,7 +254,7 @@ def get_azure_config(args): Gets Azure configurations using the AISPM service. """ try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() response = client.aispm.get_azure_config() # Format and print the response nicely print(json.dumps(response, indent=2)) @@ -264,7 +264,7 @@ def get_azure_config(args): def configure_azure(args): try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() config = json.loads(args.config) configs = [AzureConfig(**config)] client.aispm.configure_azure(configs) @@ -275,7 +275,7 @@ def configure_azure(args): def get_usage(args): try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() usage = client.aispm.get_usage( provider=args.provider, cloud_account=args.account, @@ -289,7 +289,7 @@ def get_usage(args): def get_alerts(args): try: - client = get_javelin_client_aispm() + client = get_highflame_client_aispm() alerts = client.aispm.get_alerts( provider=args.provider, cloud_account=args.account, @@ -303,7 +303,7 @@ def get_alerts(args): def create_gateway(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON input for GatewayConfig config_data = json.loads(args.config) @@ -326,7 +326,7 @@ def create_gateway(args): def list_gateways(args): """ try: - client = get_javelin_client() + client = get_highflame_client() # Fetch and print the list of gateways gateways = client.list_gateways() @@ -375,7 +375,7 @@ def list_gateways(args): def get_gateway(args): try: - client = get_javelin_client() + client = get_highflame_client() gateway = client.get_gateway(args.name) print(f"Gateway details for '{args.name}':") @@ -391,7 +391,7 @@ def get_gateway(args): def update_gateway(args): try: - client = get_javelin_client() + client = get_highflame_client() config_data = json.loads(args.config) config = GatewayConfig(**config_data) @@ -412,7 +412,7 @@ def update_gateway(args): def delete_gateway(args): try: - client = get_javelin_client() + client = get_highflame_client() client.delete_gateway(args.name) print(f"Gateway '{args.name}' deleted successfully.") @@ -427,7 +427,7 @@ def delete_gateway(args): def create_provider(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON string from args.config to a dictionary config_data = json.loads(args.config) @@ -464,7 +464,7 @@ def create_provider(args): def list_providers(args): try: - client = get_javelin_client() + client = get_highflame_client() providers = client.list_providers() print("List of providers:") @@ -480,7 +480,7 @@ def list_providers(args): def get_provider(args): try: - client = get_javelin_client() + client = get_highflame_client() provider = client.get_provider(args.name) print(f"Provider details for '{args.name}':") @@ -496,7 +496,7 @@ def get_provider(args): def update_provider(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON string for config config_data = json.loads(args.config) @@ -529,7 +529,7 @@ def update_provider(args): def delete_provider(args): try: - client = get_javelin_client() + client = get_highflame_client() client.delete_provider(args.name) print(f"Provider '{args.name}' deleted successfully.") @@ -544,7 +544,7 @@ def delete_provider(args): def create_route(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON string for config and models config_data = json.loads(args.config) @@ -582,7 +582,7 @@ def create_route(args): def list_routes(args): try: - client = get_javelin_client() + client = get_highflame_client() routes = client.list_routes() print("List of routes:") @@ -598,7 +598,7 @@ def list_routes(args): def get_route(args): try: - client = get_javelin_client() + client = get_highflame_client() route = client.get_route(args.name) print(f"Route details for '{args.name}':") @@ -614,7 +614,7 @@ def get_route(args): def update_route(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON string for config and models config_data = json.loads(args.config) @@ -648,7 +648,7 @@ def update_route(args): def delete_route(args): try: - client = get_javelin_client() + client = get_highflame_client() client.delete_route(args.name) print(f"Route '{args.name}' deleted successfully.") @@ -663,7 +663,7 @@ def delete_route(args): def create_secret(args): try: - client = get_javelin_client() + client = get_highflame_client() # Create an instance of the Secret class using the provided arguments secret = Secret( @@ -698,7 +698,7 @@ def create_secret(args): def list_secrets(args): try: - client = get_javelin_client() + client = get_highflame_client() # Fetch the list of secrets from the client secrets_response = client.list_secrets() @@ -732,7 +732,7 @@ def list_secrets(args): def get_secret(args): try: - client = get_javelin_client() + client = get_highflame_client() # Fetch the secret and mask sensitive data secret = client.get_secret(args.api_key) @@ -751,7 +751,7 @@ def get_secret(args): def update_secret(args): try: - client = get_javelin_client() + client = get_highflame_client() # Create an instance of the Secret class secret = Secret( @@ -781,7 +781,7 @@ def update_secret(args): def delete_secret(args): try: - client = get_javelin_client() + client = get_highflame_client() client.delete_secret(args.provider_name, args.api_key) print(f"Secret '{args.api_key}' deleted successfully.") @@ -796,7 +796,7 @@ def delete_secret(args): def create_template(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON string for config and models config_data = json.loads(args.config) @@ -833,7 +833,7 @@ def create_template(args): def list_templates(args): try: - client = get_javelin_client() + client = get_highflame_client() templates = client.list_templates() print("List of templates:") @@ -849,7 +849,7 @@ def list_templates(args): def get_template(args): try: - client = get_javelin_client() + client = get_highflame_client() template = client.get_template(args.name) print(f"Template details for '{args.name}':") @@ -865,7 +865,7 @@ def get_template(args): def update_template(args): try: - client = get_javelin_client() + client = get_highflame_client() # Parse the JSON string for config and models config_data = json.loads(args.config) @@ -900,7 +900,7 @@ def update_template(args): def delete_template(args): try: - client = get_javelin_client() + client = get_highflame_client() client.delete_template(args.name) print(f"Template '{args.name}' deleted successfully.") From 2859b23dcfc4186d874b407e31fb2fd237332a86 Mon Sep 17 00:00:00 2001 From: Darshana Date: Mon, 12 Jan 2026 21:43:39 +0530 Subject: [PATCH 14/18] docs: complete v2 migration documentation and cleanup --- CLI_PYPROJECT.toml | 36 ++ README.md | 528 +++++++++++++++++++++++++++- highflame/client.py | 13 +- highflame/py.typed | 0 highflame/services/aispm_service.py | 13 +- highflame/services/route_service.py | 6 +- highflame_cli/cli.py | 2 +- 7 files changed, 566 insertions(+), 32 deletions(-) create mode 100644 CLI_PYPROJECT.toml create mode 100644 highflame/py.typed diff --git a/CLI_PYPROJECT.toml b/CLI_PYPROJECT.toml new file mode 100644 index 0000000..fc1d33e --- /dev/null +++ b/CLI_PYPROJECT.toml @@ -0,0 +1,36 @@ +# This file shows what the future CLI-only package pyproject.toml would look like +# Once CLI is separated into its own package: highflame-cli +# This serves as a reference for the CLI package separation plan + +[tool.poetry] +name = "highflame-cli" +version = "2.0.0" +description = "Command-line interface for Highflame - LLM Gateway Management" +authors = ["Sharath Rajasekar "] +readme = "README.md" +license = "Apache-2.0" +homepage = "https://highflame.com" +repository = "https://github.com/highflame-ai/highflame-cli" +packages = [ + { include = "highflame_cli" }, +] + +[tool.poetry.scripts] +highflame = "highflame_cli.cli:main" + +[tool.poetry.dependencies] +python = "^3.9" +highflame = "^2.0.0" +requests = "^2.32.3" + +[tool.poetry.group.dev.dependencies] +black = "24.3.0" +flake8 = "^7.3.0" +pre-commit = "^3.3.1" +pytest = "^8.3.5" +pytest-mock = "^3.10.0" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + diff --git a/README.md b/README.md index 6ca8951..533278d 100644 --- a/README.md +++ b/README.md @@ -1,26 +1,322 @@ [![Ask DeepWiki](https://deepwiki.com/badge.svg "DeepWiki Documentation")](https://deepwiki.com/getjavelin/javelin-python) -## HighFlame: an Enterprise-Scale, Fast LLM Gateway/Edge +## Highflame: Enterprise-Scale LLM Gateway -This is the Python client package for HighFlame. +This is the Python SDK for Highflame - an enterprise-scale, fast LLM gateway that provides unified access to multiple LLM providers with advanced routing, monitoring, and management capabilities. -For more information about HighFlame, see https://highflame.com +**Package Name:** `highflame` (v2.0.0) +**Previous Package:** `javelin_sdk` -HighFlame Documentation: https://docs.getjavelin.io +For more information about Highflame, see [https://highflame.com](https://highflame.com) -### Development +Highflame Documentation: [https://docs.highflame.ai/](https://docs.highflame.ai/) -For local development, Please change `version = "RELEASE_VERSION"` with any semantic version example : `version = "v0.1.10"` in `pyproject.toml` +--- -_Make sure that the file `pyproject.toml` reverted before commit back to main_ +## Quick Start ### Installation +```bash +pip install highflame +``` + +### Basic Usage + +```python +from highflame import Highflame, Config +import os + +# Initialize client +config = Config(api_key=os.getenv("HIGHFLAME_API_KEY")) +client = Highflame(config) + +# Query a route +response = client.query_route( + route_name="my_route", + query_body={"messages": [{"role": "user", "content": "Hello!"}], "model": "gpt-4"} +) +``` + +--- + +## What Changed + +### Package & Import Changes + +**v1:** + +```python +from javelin_sdk import JavelinClient, JavelinConfig +``` + +**v2:** + +```python +from highflame import Highflame, Config +``` + +### Class Name Changes + +| v1 | v2 | +| -------------------- | ------------- | +| `JavelinClient` | `Highflame` | +| `JavelinConfig` | `Config` | +| `JavelinClientError` | `ClientError` | + +### Configuration Changes + +**Environment Variables:** +All environment variable names have changed from `JAVELIN_*` to `HIGHFLAME_*`: + +| v1 | v2 | +| ----------------------- | ------------------------- | +| `JAVELIN_API_KEY` | `HIGHFLAME_API_KEY` | +| `JAVELIN_VIRTUALAPIKEY` | `HIGHFLAME_VIRTUALAPIKEY` | +| `JAVELIN_BASE_URL` | `HIGHFLAME_BASE_URL` | + +**Configuration Fields:** + +- `javelin_api_key` → `api_key` +- `javelin_virtualapikey` → `virtual_api_key` +- Default `base_url`: `https://api-dev.javelin.live` → `https://api.highflame.app` + +**Example:** + +**v1:** + ```python - pip install highflame-sdk +from javelin_sdk import JavelinConfig + +config = JavelinConfig(javelin_api_key="your-key") ``` -### Quick Start Guide +**v2:** + +```python +from highflame import Config + +config = Config(api_key="your-key") +``` + +### HTTP Headers (Backward Compatible) + +v2 sends **both** old and new headers for backward compatibility during the transition period: + +| Header Type | v1 | v2 (Primary) | v2 (Backward Compat) | +| --------------- | ------------------------- | --------------------------- | ------------------------- | +| API Key | `x-javelin-apikey` | `x-highflame-apikey` | `x-javelin-apikey` | +| Virtual API Key | `x-javelin-virtualapikey` | `x-highflame-virtualapikey` | `x-javelin-virtualapikey` | +| Route | `x-javelin-route` | `x-highflame-route` | `x-javelin-route` | +| Model | `x-javelin-model` | `x-highflame-model` | `x-javelin-model` | +| Provider | `x-javelin-provider` | `x-highflame-provider` | `x-javelin-provider` | +| Account ID | `x-javelin-accountid` | `x-highflame-accountid` | `x-javelin-accountid` | +| User | `x-javelin-user` | `x-highflame-user` | `x-javelin-user` | +| User Role | `x-javelin-userrole` | `x-highflame-userrole` | `x-javelin-userrole` | + +**Note:** Both header formats are sent simultaneously to ensure compatibility with existing backends. + +### API Endpoint Changes + +| v1 | v2 | +| ------------------------------ | --------------------------- | +| `https://api-dev.javelin.live` | `https://api.highflame.app` | + +### Exception Handling + +**v1:** + +```python +from javelin_sdk.exceptions import ( + JavelinClientError, + GatewayNotFoundError, + RouteNotFoundError, + # ... etc +) +``` + +**v2:** + +```python +from highflame.exceptions import ( + ClientError, + GatewayNotFoundError, + RouteNotFoundError, + # ... etc +) +``` + +All exception classes now inherit from `ClientError` instead of `JavelinClientError`. + +### OpenTelemetry Tracing + +**Service & Tracer Names:** + +- Service name: `"javelin-sdk"` → `"highflame"` +- Tracer name: `"javelin"` → `"highflame"` + +**Span Attributes:** + +- `javelin.response.body` → `highflame.response.body` +- `javelin.error` → `highflame.error` + +### CLI Changes + +**Command Name:** + +- `javelin` → `highflame` + +**Cache Directory:** + +- `~/.javelin/` → `~/.highflame/` + +**Example:** + +**v1:** + +```bash +javelin auth +javelin routes list +``` + +**v2:** + +```bash +highflame auth +highflame routes list +``` + +### Exception Handling Changes + +**v1:** + +```python +from javelin_sdk.exceptions import ( + JavelinClientError, + RouteNotFoundError, + ProviderNotFoundError, +) + +try: + client.query_route(...) +except JavelinClientError as e: + print(f"Error: {e}") +``` + +**v2:** + +```python +from highflame.exceptions import ( + ClientError, + RouteNotFoundError, + ProviderNotFoundError, +) + +try: + client.query_route(...) +except ClientError as e: + print(f"Error: {e}") +``` + +### Complete Migration Example + +**v1 Code:** + +```python +import os +from javelin_sdk import JavelinClient, JavelinConfig +from javelin_sdk.exceptions import RouteNotFoundError + +# Get API key from environment +api_key = os.getenv("JAVELIN_API_KEY") + +# Create configuration +config = JavelinConfig( + javelin_api_key=api_key, + base_url="https://api-dev.javelin.live" +) + +# Create client +client = JavelinClient(config) + +# Query a route +try: + response = client.query_route( + route_name="my_route", + query_body={ + "messages": [{"role": "user", "content": "Hello"}], + "model": "gpt-4" + } + ) + print(response) +except RouteNotFoundError as e: + print(f"Route not found: {e}") +finally: + client.close() +``` + +**v2 Code:** + +```python +import os +from highflame import Highflame, Config +from highflame.exceptions import RouteNotFoundError + +# Get API key from environment +api_key = os.getenv("HIGHFLAME_API_KEY") + +# Create configuration +config = Config( + api_key=api_key, + base_url="https://api.highflame.app" +) + +# Create client +client = Highflame(config) + +# Query a route +try: + response = client.query_route( + route_name="my_route", + query_body={ + "messages": [{"role": "user", "content": "Hello"}], + "model": "gpt-4" + } + ) + print(response) +except RouteNotFoundError as e: + print(f"Route not found: {e}") +finally: + client.close() +``` + +### Async/Await Support + +Async support remains unchanged in v2: + +```python +async with Highflame(config) as client: + response = await client.aquery_route( + route_name="my_route", + query_body={...} + ) +``` + +### Migration Checklist + +1. ✅ Update package installation: `pip install highflame` (instead of `javelin_sdk` or `highflame-sdk`) +2. ✅ Update imports: `from highflame import Highflame, Config` +3. ✅ Update class names: `JavelinClient` → `Highflame`, `JavelinConfig` → `Config` +4. ✅ Update environment variables: `JAVELIN_*` → `HIGHFLAME_*` +5. ✅ Update configuration field names: `javelin_api_key` → `api_key` +6. ✅ Update API endpoint if using custom base URL +7. ✅ Update exception imports: `JavelinClientError` → `ClientError` +8. ✅ Update CLI commands: `javelin` → `highflame` +9. ✅ Update cache directory references if any + +**Note:** HTTP headers are backward compatible - both old and new headers are sent automatically, so no immediate changes needed for header handling. The v2 SDK maintains **full API compatibility** with v1 in terms of functionality - all methods, parameters, and responses remain the same, only naming conventions have changed. + +--- ## Development Setup @@ -58,32 +354,40 @@ poetry install ```bash # Uninstall any existing version -pip uninstall highflame-sdk -y +pip uninstall highflame highflame-sdk javelin_sdk -y # Build the package poetry build # Install the newly built package -pip install dist/highflame_sdk--py3-none-any.whl +pip install dist/highflame--py3-none-any.whl ``` -## [Universal Endpoints](https://docs.getjavelin.io/docs/javelin-core/integration#unified-endpoints) +### Development Notes -HighFlame provides universal endpoints that allow you to use a consistent interface across different LLM providers. Here are the main patterns: +For local development, change `version = "RELEASE_VERSION"` with any semantic version (e.g., `version = "2.0.1"`) in `pyproject.toml`. -#### Azure OpenAI +**⚠️ Important:** Make sure to revert `pyproject.toml` before committing to main. + +--- + +## Universal Endpoints + +Highflame provides universal endpoints that allow you to use a consistent interface across different LLM providers. Here are the main patterns: + +### Azure OpenAI - [Basic Azure OpenAI integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/azure-openai/azure-universal.py) - [Universal endpoint implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/azure-openai/highflame_azureopenai_univ_endpoint.py) - [OpenAI-compatible interface](https://github.com/highflame-ai/highflame-python/blob/main/examples/azure-openai/openai_compatible_univ_azure.py) -#### Bedrock +### Bedrock - [Basic Bedrock integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/bedrock/bedrock_client_universal.py) - [Universal endpoint implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/bedrock/highflame_bedrock_univ_endpoint.py) - [OpenAI-compatible interface](https://github.com/highflame-ai/highflame-python/blob/main/examples/bedrock/openai_compatible_univ_bedrock.py) -#### Gemini +### Gemini - [Basic Gemini integration](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/gemini-universal.py) - [Universal endpoint implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/highflame_gemini_univ_endpoint.py) @@ -105,10 +409,196 @@ HighFlame provides universal endpoints that allow you to use a consistent interf - [Document processing](https://github.com/highflame-ai/highflame-python/blob/main/examples/gemini/document_processing.py) - [RAG implementation](https://github.com/highflame-ai/highflame-python/blob/main/examples/rag/highflame_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#3-aws-bedrock-api-endpoints) -- [Supported Language Models](https://docs.getjavelin.io/docs/javelin-core/supported-llms) +- [Azure OpenAI Integration](https://docs.highflame.ai/documentation/getting-started/gateway-integration-examples#id-2-azure-openai-api-endpoints) +- [AWS Bedrock Integration](https://docs.highflame.ai/documentation/getting-started/gateway-integration-examples#id-3-aws-bedrock-api-endpoints) +- [CLI Reference](https://docs.highflame.ai/api-reference/cli) + +--- + +## Type Hints & py.typed Marker + +This package includes a `py.typed` marker file, which indicates to type checkers (like `mypy`, `pyright`, `pylance`) that the package supports type checking. This allows IDEs and static analysis tools to provide better autocomplete, type checking, and refactoring support. + +**Usage:** + +```python +# With py.typed, type checkers can validate this: +from highflame import Highflame, Config + +config: Config = Config(api_key="your-key") +client: Highflame = Highflame(config) +``` + +--- + +## Logging + +The SDK includes logging support for debugging and observability. Logging is configured at the module level using Python's standard `logging` module. + +### Basic Configuration + +```python +import logging + +# Enable debug logging for the SDK +logging.basicConfig(level=logging.DEBUG) + +# Or set logging for specific modules +logging.getLogger("highflame").setLevel(logging.DEBUG) +logging.getLogger("highflame.services").setLevel(logging.DEBUG) +``` + +### Logging Levels + +- **DEBUG** - Detailed information for diagnosing problems + - Client initialization + - Route queries + - Service operations + - Tracing configuration +- **INFO** - General informational messages +- **WARNING** - Warning messages for potentially problematic situations +- **ERROR** - Error messages for failures + +### Example: Full Debug Logging + +```python +import logging +from highflame import Highflame, Config + +# Configure detailed logging +logging.basicConfig( + level=logging.DEBUG, + format='%(asctime)s - %(name)s - %(levelname)s - %(message)s' +) + +# Initialize client +config = Config(api_key="your-key") +client = Highflame(config) + +# Debug logs will show: +# - Client initialization with base URL +# - Route queries with route names +# - Tracing configuration (if enabled) +response = client.query_route( + route_name="my_route", + query_body={...} +) +``` + +### Production Configuration + +For production, use structured logging: + +```python +import logging +import json +from datetime import datetime + +# Use JSON logging for better observability +class JSONFormatter(logging.Formatter): + def format(self, record): + log_obj = { + "timestamp": datetime.utcnow().isoformat(), + "level": record.levelname, + "logger": record.name, + "message": record.getMessage(), + } + if record.exc_info: + log_obj["exception"] = self.formatException(record.exc_info) + return json.dumps(log_obj) + +# Configure handler +handler = logging.StreamHandler() +handler.setFormatter(JSONFormatter()) + +logger = logging.getLogger("highflame") +logger.addHandler(handler) +logger.setLevel(logging.INFO) +``` + +### Available Loggers + +| Logger | Purpose | +| ------------------------------------ | ----------------------------------- | +| `highflame.client` | Main Highflame client operations | +| `highflame.services.route_service` | Route querying and management | +| `highflame.services.gateway_service` | Gateway operations | +| `highflame.tracing_setup` | OpenTelemetry tracing configuration | + +--- + +## TODO + +### Code Quality Improvements + +- [ ] **Type Hints Coverage**: Add comprehensive type hints to all methods. Many internal methods currently return `Any` or lack return type annotations. Properties like `client`, `aclient`, `close()`, and helper methods need type hints. + +- [ ] **Error Handling**: Replace broad `except Exception` blocks (27+ locations) with specific exception types. This will improve debugging and error context. + +- [ ] **Backward Compatibility**: Phase out dual header support (`x-javelin-*` and `x-highflame-*`) after transition period. Create deprecation timeline and migration path. + +- [ ] **Request/Response Validation**: Add validation layer for requests and responses to catch errors early. + +- [ ] **HTTP Connection Pooling**: Add configuration options for HTTP connection pooling to improve performance. + +### CLI Improvements + +- [ ] **CLI Separation**: Separate CLI into its own `highflame-cli` package. Create separate repository, package, and PyPI distribution. + +- [ ] **CLI Error Messages**: Improve CLI error messages with troubleshooting hints and actionable guidance. + +- [ ] **CLI Testing**: Add comprehensive test suite for CLI commands and edge cases. + +- [ ] **CLI Documentation**: Update CLI documentation to reflect current bundled state vs. future separated state. + +### Reliability & Performance + +- [ ] **Automatic Retry Logic**: Implement retry logic with exponential backoff for transient failures. + +- [ ] **Rate Limit Detection**: Add automatic rate limit detection and backoff handling. + +- [ ] **Performance Metrics**: Add performance metrics tracking for requests, latency, and throughput. + +- [ ] **Circuit Breaker Pattern**: Implement circuit breaker pattern for resilience against failing services. + +- [ ] **Request Caching**: Add optional request caching layer for frequently accessed resources. + +### Developer Experience + +- [ ] **Deprecation Warnings**: Add deprecation warning module for v1 → v2 migration to help users transition. + +- [ ] **Structured Logging**: Enhance structured JSON logging implementation for production environments. + +- [ ] **Custom Middleware**: Add support for custom middleware to allow users to extend SDK functionality. + +- [ ] **Better Error Messages**: Implement error messages with troubleshooting steps and links to documentation. + +### Testing & Release + +- [ ] **Full Test Suite**: Run and expand comprehensive test suite covering all SDK functionality. + +- [ ] **Build & Distribution**: Test building distribution packages and verify installation process. + +- [ ] **Installation Testing**: Test `pip install highflame` and verify all imports work correctly. + +- [ ] **CLI Functionality Testing**: Test all CLI commands and verify they work as expected. + +- [ ] **Performance Testing**: Conduct performance testing and optimization. + +- [ ] **PyPI Publishing**: Publish `highflame` v2.0.0 to PyPI with proper release notes. + +- [ ] **Documentation Updates**: Update GitHub release notes and publish migration guide on docs site. + +### Architecture + +- [ ] **Client Class Refactoring**: Refactor large `Highflame` class (1645 lines) into smaller, focused classes for better maintainability. + +- [ ] **Constants Module**: Create centralized constants module for HTTP headers and configuration values. + +- [ ] **Service Layer Improvements**: Enhance service layer with better error handling and type safety. diff --git a/highflame/client.py b/highflame/client.py index d2cb334..df5423b 100644 --- a/highflame/client.py +++ b/highflame/client.py @@ -1,6 +1,7 @@ import functools import inspect import json +import logging import re import asyncio from typing import Any, Coroutine, Dict, Optional, Union @@ -402,7 +403,7 @@ def _capture_response_details(self, span, response, kwargs, system_name): try: response_data = self._extract_response_data(response) if response_data is None: - span.set_attribute("javelin.response.body", str(response)) + span.set_attribute("highflame.response.body", str(response)) return self._set_basic_response_attributes(span, response_data) @@ -412,7 +413,7 @@ def _capture_response_details(self, span, response, kwargs, system_name): except Exception as e: span.set_attribute("javelin.response.body", str(response)) - span.set_attribute("javelin.error", str(e)) + span.set_attribute("highflame.error", str(e)) def _extract_response_data(self, response): """Extract response data from various response types.""" @@ -761,12 +762,12 @@ def _create_bedrock_request_handlers( """Create request handlers for bedrock operations.""" def add_custom_headers(request: Any, **kwargs) -> None: - """Add Javelin headers to each request.""" + """Add Highflame headers to each request.""" request.headers.update(self._headers) def override_endpoint_url(request: Any, **kwargs) -> None: """ - Redirect Bedrock operations to the Javelin endpoint + Redirect Bedrock operations to the Highflame endpoint while preserving path and query. """ try: @@ -795,7 +796,7 @@ def override_endpoint_url(request: Any, **kwargs) -> None: request.headers["x-highflame-model"] = model_id # New header request.headers["x-javelin-model"] = model_id # Old header (for backward compatibility) - # Update the request URL to use the Javelin endpoint. + # Update the request URL to use the Highflame endpoint. parsed_base = urlparse(self.base_url) updated_url = original_url._replace( scheme=parsed_base.scheme, @@ -984,7 +985,7 @@ def _prepare_request(self, request: Request) -> tuple: if ( request.route and request.route.startswith("v1/admin/aispm") - and "x-javelin-accountid" in headers + and ("x-highflame-accountid" in headers or "x-javelin-accountid" in headers) ): # Remove both old and new headers for backward compatibility headers.pop("x-javelin-apikey", None) diff --git a/highflame/py.typed b/highflame/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/highflame/services/aispm_service.py b/highflame/services/aispm_service.py index f5e3beb..401b6d1 100644 --- a/highflame/services/aispm_service.py +++ b/highflame/services/aispm_service.py @@ -26,13 +26,20 @@ def _get_aispm_headers(self) -> Dict[str, str]: # Check if account_id is stored in client (set by get_highflame_client_aispm) account_id = getattr(self.client, "_aispm_account_id", None) if account_id: - headers["x-javelin-accountid"] = account_id + headers["x-highflame-accountid"] = account_id # New header + headers["x-javelin-accountid"] = account_id # Old header (for backward compatibility) + headers["x-highflame-user"] = getattr( + self.client, "_aispm_user", "test-user" + ) # New header headers["x-javelin-user"] = getattr( self.client, "_aispm_user", "test-user" - ) + ) # Old header (for backward compatibility) + headers["x-highflame-userrole"] = getattr( + self.client, "_aispm_userrole", "org:superadmin" + ) # New header headers["x-javelin-userrole"] = getattr( self.client, "_aispm_userrole", "org:superadmin" - ) + ) # Old header (for backward compatibility) return headers def _handle_response(self, response: Response) -> None: diff --git a/highflame/services/route_service.py b/highflame/services/route_service.py index 2c1445d..c2bbf7a 100644 --- a/highflame/services/route_service.py +++ b/highflame/services/route_service.py @@ -22,12 +22,12 @@ def __init__(self, client): self.client = client def _process_route_response_ok(self, response: httpx.Response) -> str: - """Process a successful response from the Javelin API.""" + """Process a successful response from the Highflame API.""" self._handle_route_response(response) return response.text def _process_route_response(self, response: httpx.Response) -> Route: - """Process a response from the Javelin API and return a Route object.""" + """Process a response from the Highflame API and return a Route object.""" self._handle_route_response(response) return Route(**response.json()) @@ -42,7 +42,7 @@ def _validate_route_name(self, route_name: str): def _process_route_response_json(self, response: httpx.Response) -> Dict[str, Any]: """ - Process a successful response from the Javelin API. + Process a successful response from the Highflame API. Parse body into a Dict[str, Any] object and return it. This is for Query() requests. """ diff --git a/highflame_cli/cli.py b/highflame_cli/cli.py index de4129b..760dc89 100644 --- a/highflame_cli/cli.py +++ b/highflame_cli/cli.py @@ -100,7 +100,7 @@ def main(): description="The CLI for HighFlame.", formatter_class=argparse.RawTextHelpFormatter, epilog=( - "See https://docs.getjavelin.io/docs/javelin-python/cli for more " + "See https://docs.highflame.ai/ for more " "detailed documentation." ), ) From 89bb1a7e101d12d09ec0307a903f4d763a9a3ac7 Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 13 Jan 2026 15:30:17 +0530 Subject: [PATCH 15/18] update cli commands --- CLI_PYPROJECT.toml | 2 +- README.md | 6 +++--- highflame_cli/cli.py | 4 ++-- pyproject.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CLI_PYPROJECT.toml b/CLI_PYPROJECT.toml index fc1d33e..e4ac10b 100644 --- a/CLI_PYPROJECT.toml +++ b/CLI_PYPROJECT.toml @@ -16,7 +16,7 @@ packages = [ ] [tool.poetry.scripts] -highflame = "highflame_cli.cli:main" +highflame-cli = "highflame_cli.cli:main" [tool.poetry.dependencies] python = "^3.9" diff --git a/README.md b/README.md index 533278d..f2d242f 100644 --- a/README.md +++ b/README.md @@ -182,8 +182,8 @@ javelin routes list **v2:** ```bash -highflame auth -highflame routes list +highflame-cli auth +highflame-cli route list ``` ### Exception Handling Changes @@ -311,7 +311,7 @@ async with Highflame(config) as client: 5. ✅ Update configuration field names: `javelin_api_key` → `api_key` 6. ✅ Update API endpoint if using custom base URL 7. ✅ Update exception imports: `JavelinClientError` → `ClientError` -8. ✅ Update CLI commands: `javelin` → `highflame` +8. ✅ Update CLI commands: `javelin` → `highflame-cli` 9. ✅ Update cache directory references if any **Note:** HTTP headers are backward compatible - both old and new headers are sent automatically, so no immediate changes needed for header handling. The v2 SDK maintains **full API compatibility** with v1 in terms of functionality - all methods, parameters, and responses remain the same, only naming conventions have changed. diff --git a/highflame_cli/cli.py b/highflame_cli/cli.py index 760dc89..5e117bb 100644 --- a/highflame_cli/cli.py +++ b/highflame_cli/cli.py @@ -69,7 +69,7 @@ def check_permissions(): cache_file = get_cache_file() if not cache_file.exists(): - print("❌ Not authenticated. Please run 'highflame auth' first.") + print("❌ Not authenticated. Please run 'highflame-cli auth' first.") sys.exit(1) try: @@ -93,7 +93,7 @@ def check_permissions(): def main(): # Fetch the version dynamically from the package package_version = importlib.metadata.version( - "highflame-sdk" + "highflame" ) parser = argparse.ArgumentParser( diff --git a/pyproject.toml b/pyproject.toml index b5b7422..0d140ad 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ packages = [ ] [tool.poetry.scripts] -highflame = "highflame_cli.cli:main" +highflame-cli = "highflame_cli.cli:main" [tool.poetry.dependencies] python = "^3.9" From 23084e9dbd0e50e8a66f7d4375e532d37ff7fddd Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 13 Jan 2026 15:56:05 +0530 Subject: [PATCH 16/18] fix: resolve gemini comments - Remove duplicate get_cache_file() from cli.py and import from commands.py to follow DRY principle - Rename JAVELIN_API_KEY to HIGHFLAME_API_KEY in adk_gemini_agent_highflame/agent.py - Rename javelin_api_key/javelin_base_url to highflame_* in openai_agents_highflame.py - Rename javelin_api_key to highflame_api_key in azure_function_call.py --- .../agents/adk_gemini_agent_highflame/agent.py | 12 ++++++------ examples/agents/openai_agents_highflame.py | 10 +++++----- examples/azure-openai/azure_function_call.py | 10 +++++----- highflame_cli/cli.py | 18 ++---------------- 4 files changed, 18 insertions(+), 32 deletions(-) diff --git a/examples/agents/adk_gemini_agent_highflame/agent.py b/examples/agents/adk_gemini_agent_highflame/agent.py index 65540d9..0eb3a2d 100644 --- a/examples/agents/adk_gemini_agent_highflame/agent.py +++ b/examples/agents/adk_gemini_agent_highflame/agent.py @@ -11,12 +11,12 @@ load_dotenv() GEMINI_API_KEY = os.getenv("GEMINI_API_KEY") -JAVELIN_API_KEY = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +HIGHFLAME_API_KEY = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") if not GEMINI_API_KEY: raise ValueError("Missing GEMINI_API_KEY") -if not JAVELIN_API_KEY: - raise ValueError("Missing JAVELIN_API_KEY") +if not HIGHFLAME_API_KEY: + raise ValueError("Missing HIGHFLAME_API_KEY") # Agent 1: Researcher research_agent = LlmAgent( @@ -25,7 +25,7 @@ api_base="https://api-dev.javelin.live/v1/", extra_headers={ "x-javelin-route": "google_univ", - "x-api-key": JAVELIN_API_KEY, + "x-api-key": HIGHFLAME_API_KEY, "Authorization": f"Bearer {GEMINI_API_KEY}", }, ), @@ -41,7 +41,7 @@ api_base="https://api-dev.javelin.live/v1/", extra_headers={ "x-javelin-route": "google_univ", - "x-api-key": JAVELIN_API_KEY, + "x-api-key": HIGHFLAME_API_KEY, "Authorization": f"Bearer {GEMINI_API_KEY}", }, ), @@ -57,7 +57,7 @@ api_base="https://api-dev.javelin.live/v1/", extra_headers={ "x-javelin-route": "google_univ", - "x-api-key": JAVELIN_API_KEY, + "x-api-key": HIGHFLAME_API_KEY, "Authorization": f"Bearer {GEMINI_API_KEY}", }, ), diff --git a/examples/agents/openai_agents_highflame.py b/examples/agents/openai_agents_highflame.py index ebaa8cb..ed1ef02 100644 --- a/examples/agents/openai_agents_highflame.py +++ b/examples/agents/openai_agents_highflame.py @@ -23,10 +23,10 @@ set_default_openai_api("chat_completions") openai_api_key = os.getenv("OPENAI_API_KEY", "") -javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "") -javelin_base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL", "") +highflame_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "") +highflame_base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL", "") -if not (openai_api_key and javelin_api_key and javelin_base_url): +if not (openai_api_key and highflame_api_key and highflame_base_url): raise ValueError( "Missing OPENAI_API_KEY, HIGHFLAME_API_KEY (or JAVELIN_API_KEY), or HIGHFLAME_BASE_URL (or JAVELIN_BASE_URL) in .env" ) @@ -34,9 +34,9 @@ # Create async OpenAI client async_openai_client = AsyncOpenAI(api_key=openai_api_key) -# Register with Javelin +# Register with Highflame javelin_client = JavelinClient( - JavelinConfig(javelin_api_key=javelin_api_key, base_url=javelin_base_url) + JavelinConfig(javelin_api_key=highflame_api_key, base_url=highflame_base_url) ) # Adjust route name if needed javelin_client.register_openai(async_openai_client, route_name="openai_univ") diff --git a/examples/azure-openai/azure_function_call.py b/examples/azure-openai/azure_function_call.py index cb235ce..f79e53b 100644 --- a/examples/azure-openai/azure_function_call.py +++ b/examples/azure-openai/azure_function_call.py @@ -9,10 +9,10 @@ def init_azure_client_with_javelin(): azure_api_key = os.getenv("AZURE_OPENAI_API_KEY") - javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + highflame_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") - if not azure_api_key or not javelin_api_key: - raise ValueError("Missing AZURE_OPENAI_API_KEY or JAVELIN_API_KEY") + if not azure_api_key or not highflame_api_key: + raise ValueError("Missing AZURE_OPENAI_API_KEY or HIGHFLAME_API_KEY") # Azure OpenAI setup azure_client = AzureOpenAI( @@ -21,8 +21,8 @@ def init_azure_client_with_javelin(): api_key=azure_api_key, ) - # Register with Javelin - config = JavelinConfig(javelin_api_key=javelin_api_key) + # Register with Highflame + config = JavelinConfig(javelin_api_key=highflame_api_key) client = JavelinClient(config) client.register_azureopenai(azure_client, route_name="azureopenai_univ") diff --git a/highflame_cli/cli.py b/highflame_cli/cli.py index 5e117bb..2689f5f 100644 --- a/highflame_cli/cli.py +++ b/highflame_cli/cli.py @@ -45,25 +45,11 @@ get_alerts, get_aws_config, get_azure_config, - delete_aws_config + delete_aws_config, + get_cache_file, ) -def get_cache_file(): - """Get cache file path, checking new location first, then falling back to old location""" - home_dir = Path.home() - # Try new location first - new_cache_file = home_dir / ".highflame" / "cache.json" - if new_cache_file.exists(): - return new_cache_file - # Fall back to old location for backward compatibility - old_cache_file = home_dir / ".javelin" / "cache.json" - if old_cache_file.exists(): - return old_cache_file - # Default to new location if neither exists - return new_cache_file - - def check_permissions(): """Check if user has permissions""" cache_file = get_cache_file() From 4d50656a0bf2b07dba33b8d3f7166ff99434361b Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 13 Jan 2026 17:57:12 +0530 Subject: [PATCH 17/18] add future backend changes and minor fixes --- Makefile | 2 +- README.md | 121 +++++++++++++++++++++++++++++++++++++++++ highflame/client.py | 2 +- swagger/sync_models.py | 2 +- 4 files changed, 124 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 29be6bd..d082c77 100644 --- a/Makefile +++ b/Makefile @@ -30,4 +30,4 @@ install: poetry install install-wheel: - pip install dist/highflame_sdk-*.whl --force-reinstall + pip install dist/highflame-*.whl --force-reinstall diff --git a/README.md b/README.md index f2d242f..16039e6 100644 --- a/README.md +++ b/README.md @@ -318,6 +318,127 @@ async with Highflame(config) as client: --- +## Backend Changes Required + +To complete the migration from Javelin to Highflame, the following backend changes are required: + +### 1. Database Schema Changes + +**File: `highflame-admin/internal/admin/module/keyvault/schema.go`** + +- Rename field: `JavelinSecretKey` → `HighflameSecretKey` +- Database column: `api_key_secret_key_javelin` → `api_key_secret_key_highflame` +- Database column: `api_key_secret_key_javelin_start` → `api_key_secret_key_highflame_start` + +**File: `highflame-admin/internal/admin/module/apikey/schema.go`** + +- Table name: `javelinapikeys` → `highflameapikeys` (or maintain backward compatibility) +- Struct name: `JavelinAPIKey` → `HighflameAPIKey` + +### 2. Go Model Changes + +**File: `highflame-admin/internal/admin/model/keyvault.go`** + +```go +// Change: +JavelinSecretKey string `json:"api_key_secret_key_javelin,omitempty"` + +// To: +HighflameSecretKey string `json:"api_key_secret_key_highflame,omitempty"` +``` + +**File: `highflame-admin/internal/admin/model/apikey.go`** + +```go +// Change: +type JavelinAPIKey struct { ... } + +// To: +type HighflameAPIKey struct { ... } +``` + +**File: `highflame-admin/internal/admin/model/chronicle.go`** + +```go +// Change: +JavelinResponseHeaders json.RawMessage `json:"javelin_response_headers"` + +// To: +HighflameResponseHeaders json.RawMessage `json:"highflame_response_headers"` +``` + +### 3. Service Layer Changes + +**File: `highflame-admin/internal/admin/module/keyvault/service.go`** + +- Update all `JavelinSecretKey` references to `HighflameSecretKey` +- Update variable names: `javelin_key` → `highflame_key`, etc. + +**File: `highflame-admin/internal/admin/module/audit/repo.go`** + +- Update field deletion: `"api_key_secret_key_javelin"` → `"api_key_secret_key_highflame"` + +### 4. Swagger/OpenAPI Specification Updates + +**Files to update:** + +- `highflame-admin/docs/swagger.yaml` +- `highflame-admin/docs/swagger.json` +- `highflame-admin/docs/docs.go` + +**Changes required:** + +- `api_key_secret_key_javelin` → `api_key_secret_key_highflame` +- `javelin_response_headers` → `highflame_response_headers` +- Model names: `JavelinAPIKey` → `HighflameAPIKey` + +After updating, regenerate the Swagger spec and sync Python SDK models using `swagger/sync_models.py`. + +### 5. Database Migration + +Create a migration script to: + +1. Add new columns alongside old ones (for zero-downtime migration) +2. Migrate existing data from old columns to new columns +3. Update application code to use new field names +4. Deprecate old columns after transition period +5. Remove old columns in a future release + +### 6. Other Backend Services + +**File: `highflame-core/pkg/persist/admin_client/aws_secrets.go`** + +- Update `JavelinSecretKey` field to `HighflameSecretKey` + +**File: `highflame-core/tests/e2e/promptfoo/extensions/shared/utils.js`** + +- Update test references from `api_key_secret_key_javelin` to `api_key_secret_key_highflame` + +### 7. API Header Support (Backward Compatibility) + +The Python SDK currently sends both `x-javelin-*` and `x-highflame-*` headers for backward compatibility. The backend should: + +- **Continue accepting** `x-javelin-*` headers during the transition period +- **Prefer** `x-highflame-*` headers when both are present +- **Plan deprecation timeline** for old headers (recommend 6-12 month transition period) +- **Log usage** of old headers to track migration progress + +### Backend Migration Checklist + +- [ ] Database schema: Add new `api_key_secret_key_highflame` column +- [ ] Database migration: Script to migrate data from old to new columns +- [ ] Go models: Rename `JavelinSecretKey` → `HighflameSecretKey` +- [ ] Go structs: Rename `JavelinAPIKey` → `HighflameAPIKey` +- [ ] Service layer: Update all field references +- [ ] Swagger spec: Regenerate with new field names +- [ ] Tests: Update all test references +- [ ] Documentation: Update API documentation +- [ ] Header support: Ensure both old and new headers are accepted +- [ ] Monitoring: Track usage of old vs new headers/fields +- [ ] Deprecation plan: Create timeline for removing old fields/headers + +--- + ## Development Setup ### Setting up Virtual Environment diff --git a/highflame/client.py b/highflame/client.py index df5423b..d6fb5e5 100644 --- a/highflame/client.py +++ b/highflame/client.py @@ -412,7 +412,7 @@ def _capture_response_details(self, span, response, kwargs, system_name): self._add_choice_events(span, response_data, system_name) except Exception as e: - span.set_attribute("javelin.response.body", str(response)) + span.set_attribute("highflame.response.body", str(response)) span.set_attribute("highflame.error", str(e)) def _extract_response_data(self, response): diff --git a/swagger/sync_models.py b/swagger/sync_models.py index fc756b1..7218265 100644 --- a/swagger/sync_models.py +++ b/swagger/sync_models.py @@ -8,7 +8,7 @@ SWAGGER_FILE_PATH = Path(os.path.join(os.path.dirname(__file__), "swagger.yaml")) MODELS_FILE_PATH = Path( - os.path.join(os.path.dirname(__file__), "..", "highflame_sdk", "models.py") + os.path.join(os.path.dirname(__file__), "..", "highflame", "models.py") ) FIELDS_TO_EXCLUDE = { From 47b36bb1b6814a39d56c876f2fd7df80247d02d0 Mon Sep 17 00:00:00 2001 From: Darshana Date: Tue, 13 Jan 2026 21:37:28 +0530 Subject: [PATCH 18/18] fix: resolve flake linting errors --- examples/agents/openai_agents_highflame.py | 11 +++-- examples/azure-openai/azure-universal.py | 5 ++- examples/azure-openai/azure_general_route.py | 10 ++++- .../highflame_azureopenai_univ_endpoint.py | 5 ++- .../langchain_chatmodel_example.py | 10 ++++- examples/bedrock/bedrock_general_route.py | 10 ++++- .../bedrock/langchain-bedrock-universal.py | 5 ++- examples/gemini/document_processing.py | 9 +++- .../gemini/highflame_gemini_univ_endpoint.py | 5 ++- .../gemini/langchain_chatmodel_example.py | 5 ++- .../gemini/openai_compatible_univ_gemini.py | 5 ++- .../mistral/mistral_function_tool_call.py | 5 ++- .../openai/highflame_openai_univ_endpoint.py | 5 ++- examples/openai/langchain-openai-universal.py | 10 ++++- examples/openai/langchain_callback_example.py | 10 ++++- .../openai/langchain_chatmodel_example.py | 5 ++- examples/openai/openai-universal.py | 10 ++++- examples/openai/openai_compatible_univ.py | 5 ++- examples/openai/openai_embedding_example.py | 5 ++- examples/openai/openai_general_route.py | 14 ++++-- examples/route_examples/aexample.py | 11 +++-- .../route_examples/drop_in_replacement.py | 11 +++-- examples/route_examples/example.py | 11 +++-- examples/route_examples/highflame_sdk_app.py | 11 +++-- highflame/client.py | 43 +++++++++++++------ highflame/models.py | 2 +- highflame/services/aispm_service.py | 3 +- highflame/services/route_service.py | 5 ++- highflame/tracing_setup.py | 9 ++-- highflame_cli/_internal/commands.py | 3 +- 30 files changed, 193 insertions(+), 65 deletions(-) diff --git a/examples/agents/openai_agents_highflame.py b/examples/agents/openai_agents_highflame.py index ed1ef02..1c23c30 100644 --- a/examples/agents/openai_agents_highflame.py +++ b/examples/agents/openai_agents_highflame.py @@ -23,12 +23,17 @@ set_default_openai_api("chat_completions") openai_api_key = os.getenv("OPENAI_API_KEY", "") -highflame_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "") -highflame_base_url = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL", "") +highflame_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "") +) +highflame_base_url = ( + os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL", "") +) if not (openai_api_key and highflame_api_key and highflame_base_url): raise ValueError( - "Missing OPENAI_API_KEY, HIGHFLAME_API_KEY (or JAVELIN_API_KEY), or HIGHFLAME_BASE_URL (or JAVELIN_BASE_URL) in .env" + "Missing OPENAI_API_KEY, HIGHFLAME_API_KEY (or JAVELIN_API_KEY), " + "or HIGHFLAME_BASE_URL (or JAVELIN_BASE_URL) in .env" ) # Create async OpenAI client diff --git a/examples/azure-openai/azure-universal.py b/examples/azure-openai/azure-universal.py index 6715681..c46678a 100644 --- a/examples/azure-openai/azure-universal.py +++ b/examples/azure-openai/azure-universal.py @@ -13,7 +13,10 @@ def initialize_client(): Creates the AzureOpenAI client and registers it with Javelin. Returns the AzureOpenAI client object if successful, else None. """ - javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") # add your API key here + # add your API key here + javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ) azure_openai_api_key = os.getenv( "AZURE_OPENAI_API_KEY" ) # Add your Azure OpenAI key diff --git a/examples/azure-openai/azure_general_route.py b/examples/azure-openai/azure_general_route.py index 20fd052..a738fab 100644 --- a/examples/azure-openai/azure_general_route.py +++ b/examples/azure-openai/azure_general_route.py @@ -25,7 +25,10 @@ def init_azure_client_sync(): javelin_headers = {"x-javelin-apikey": javelin_api_key} client = AzureOpenAI( api_key=llm_api_key, - base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai", + base_url=( + f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}" + "/v1/query/azure-openai" + ), default_headers=javelin_headers, api_version="2024-02-15-preview", ) @@ -144,7 +147,10 @@ async def init_async_azure_client(): # Include the API version in the base URL for the async client. client = AsyncOpenAI( api_key=llm_api_key, - base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1/query/azure-openai", + base_url=( + f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}" + "/v1/query/azure-openai" + ), default_headers=javelin_headers, ) return client diff --git a/examples/azure-openai/highflame_azureopenai_univ_endpoint.py b/examples/azure-openai/highflame_azureopenai_univ_endpoint.py index 3fc3ec4..0fd34e5 100644 --- a/examples/azure-openai/highflame_azureopenai_univ_endpoint.py +++ b/examples/azure-openai/highflame_azureopenai_univ_endpoint.py @@ -40,7 +40,10 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "azureopenai_univ", "x-javelin-provider": "https://javelinpreview.openai.azure.com/openai", - "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + # Use environment variable for security + "x-api-key": ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ), "api-key": os.getenv( "AZURE_OPENAI_API_KEY" ), # Use environment variable for security diff --git a/examples/azure-openai/langchain_chatmodel_example.py b/examples/azure-openai/langchain_chatmodel_example.py index f06e7c1..859caef 100644 --- a/examples/azure-openai/langchain_chatmodel_example.py +++ b/examples/azure-openai/langchain_chatmodel_example.py @@ -4,7 +4,10 @@ dotenv.load_dotenv() -url = os.path.join(os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), "v1") +base_url = ( + os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") +) +url = os.path.join(base_url, "v1") print(url) model = AzureChatOpenAI( azure_endpoint=url, @@ -12,7 +15,10 @@ openai_api_version="2023-03-15-preview", extra_headers={ "x-javelin-route": "azureopenai_univ", - "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), + "x-api-key": ( + os.environ.get("HIGHFLAME_API_KEY") + or os.environ.get("JAVELIN_API_KEY") + ), }, ) diff --git a/examples/bedrock/bedrock_general_route.py b/examples/bedrock/bedrock_general_route.py index d393af6..3c58b66 100644 --- a/examples/bedrock/bedrock_general_route.py +++ b/examples/bedrock/bedrock_general_route.py @@ -56,7 +56,10 @@ def get_bedrock_client(): aws_access_key_id = os.getenv("AWS_ACCESS_KEY_ID", "YOUR_ACCESS_KEY") aws_secret_access_key = os.getenv("AWS_SECRET_ACCESS_KEY", "YOUR_SECRET_KEY") - bedrock_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY", "YOUR_BEDROCK_API_KEY") + bedrock_api_key = ( + os.getenv("HIGHFLAME_API_KEY") + or os.getenv("JAVELIN_API_KEY", "YOUR_BEDROCK_API_KEY") + ) custom_headers = { "x-javelin-apikey": bedrock_api_key, @@ -66,7 +69,10 @@ def get_bedrock_client(): client = boto3.client( service_name="bedrock-runtime", region_name="us-east-1", - endpoint_url=os.path.join(os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), "v1"), + endpoint_url=os.path.join( + os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL"), + "v1", + ), aws_access_key_id=aws_access_key_id, aws_secret_access_key=aws_secret_access_key, ) diff --git a/examples/bedrock/langchain-bedrock-universal.py b/examples/bedrock/langchain-bedrock-universal.py index 4a78924..61e740a 100644 --- a/examples/bedrock/langchain-bedrock-universal.py +++ b/examples/bedrock/langchain-bedrock-universal.py @@ -28,7 +28,10 @@ def init_bedrock(): # Initialize Javelin client config = JavelinConfig( - javelin_api_key=os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") # add your API key here + # add your API key here + javelin_api_key=( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ) ) javelin_client = JavelinClient(config) diff --git a/examples/gemini/document_processing.py b/examples/gemini/document_processing.py index 3fa5474..f2649cc 100644 --- a/examples/gemini/document_processing.py +++ b/examples/gemini/document_processing.py @@ -19,9 +19,14 @@ # Initialize Javelin Client def initialize_javelin_client(): - javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ) + base_url = ( + os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") + ) config = JavelinConfig( - javelin_api_key=javelin_api_key, base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") + javelin_api_key=javelin_api_key, base_url=base_url ) return JavelinClient(config) diff --git a/examples/gemini/highflame_gemini_univ_endpoint.py b/examples/gemini/highflame_gemini_univ_endpoint.py index 255bd45..6bb1d38 100644 --- a/examples/gemini/highflame_gemini_univ_endpoint.py +++ b/examples/gemini/highflame_gemini_univ_endpoint.py @@ -32,7 +32,10 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "x-javelin-route": "google_univ", "x-javelin-model": "gemini-1.5-flash", "x-javelin-provider": "https://generativelanguage.googleapis.com/v1beta/openai", - "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + # Use environment variable for security + "x-api-key": ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ), # Use environment variable for security "Authorization": f"Bearer {os.getenv('GEMINI_API_KEY')}", } diff --git a/examples/gemini/langchain_chatmodel_example.py b/examples/gemini/langchain_chatmodel_example.py index 023a282..6290caa 100644 --- a/examples/gemini/langchain_chatmodel_example.py +++ b/examples/gemini/langchain_chatmodel_example.py @@ -11,7 +11,10 @@ base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", extra_headers={ "x-javelin-route": "google_univ", - "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), + "x-api-key": ( + os.environ.get("HIGHFLAME_API_KEY") + or os.environ.get("JAVELIN_API_KEY") + ), "Authorization": f"Bearer {os.environ.get('GEMINI_API_KEY')}", }, ) diff --git a/examples/gemini/openai_compatible_univ_gemini.py b/examples/gemini/openai_compatible_univ_gemini.py index ac4ee9b..349b948 100644 --- a/examples/gemini/openai_compatible_univ_gemini.py +++ b/examples/gemini/openai_compatible_univ_gemini.py @@ -31,7 +31,10 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "google_univ", "x-javelin-provider": "https://generativelanguage.googleapis.com/v1beta/openai", - "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + # Use environment variable for security + "x-api-key": ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ), # Use environment variable for security "Authorization": f"Bearer {os.getenv('GEMINI_API_KEY')}", } diff --git a/examples/mistral/mistral_function_tool_call.py b/examples/mistral/mistral_function_tool_call.py index f498130..19b3cc5 100644 --- a/examples/mistral/mistral_function_tool_call.py +++ b/examples/mistral/mistral_function_tool_call.py @@ -10,7 +10,10 @@ def init_mistral_model(): return init_chat_model( model_name="mistral-large-latest", model_provider="openai", - base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=( + f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}" + "/v1" + ), extra_headers={ "x-javelin-route": "mistral_univ", "x-api-key": os.environ.get("OPENAI_API_KEY"), diff --git a/examples/openai/highflame_openai_univ_endpoint.py b/examples/openai/highflame_openai_univ_endpoint.py index a7fad11..10b3d9c 100644 --- a/examples/openai/highflame_openai_univ_endpoint.py +++ b/examples/openai/highflame_openai_univ_endpoint.py @@ -32,7 +32,10 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "x-javelin-route": "openai_univ", "x-javelin-model": "gpt-4", "x-javelin-provider": "https://api.openai.com/v1", - "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + # Use environment variable for security + "x-api-key": ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ), # Use environment variable for security "Authorization": f"Bearer {os.getenv('OPENAI_API_KEY')}", } diff --git a/examples/openai/langchain-openai-universal.py b/examples/openai/langchain-openai-universal.py index 6297273..9bded68 100644 --- a/examples/openai/langchain-openai-universal.py +++ b/examples/openai/langchain-openai-universal.py @@ -16,11 +16,17 @@ # 1) Configuration # ----------------------------------------------------------------------------- OPENAI_API_KEY = os.environ.get("OPENAI_API_KEY") # add your openai api key here -JAVELIN_API_KEY = os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY") # add your javelin api key here +# add your javelin api key here +JAVELIN_API_KEY = ( + os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY") +) MODEL_NAME_CHAT = "gpt-3.5-turbo" # For chat MODEL_NAME_EMBED = "text-embedding-ada-002" ROUTE_NAME = "openai_univ" -BASE_URL = os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") # Default base URL +# Default base URL +BASE_URL = ( + os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") +) def init_chat_llm_non_streaming(): diff --git a/examples/openai/langchain_callback_example.py b/examples/openai/langchain_callback_example.py index 0f6bc2a..8ac48c5 100644 --- a/examples/openai/langchain_callback_example.py +++ b/examples/openai/langchain_callback_example.py @@ -13,7 +13,10 @@ class HeaderCallbackHandler(BaseCallbackHandler): """Custom callback handler that modifies the headers on chat model start.""" def __init__(self): - self.api_key = os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY") + self.api_key = ( + os.environ.get("HIGHFLAME_API_KEY") + or os.environ.get("JAVELIN_API_KEY") + ) def on_chain_start( self, serialized: Dict[str, Any], inputs: Dict[str, Any], **kwargs: Any @@ -57,7 +60,10 @@ def on_chat_model_start( base_url="http://127.0.0.1:8000/v1", extra_headers={ "x-javelin-route": "openai_univ", - "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), + "x-api-key": ( + os.environ.get("HIGHFLAME_API_KEY") + or os.environ.get("JAVELIN_API_KEY") + ), }, callbacks=[callback_handler], # Add our custom callback handler ) diff --git a/examples/openai/langchain_chatmodel_example.py b/examples/openai/langchain_chatmodel_example.py index 6876858..dc75613 100644 --- a/examples/openai/langchain_chatmodel_example.py +++ b/examples/openai/langchain_chatmodel_example.py @@ -11,7 +11,10 @@ base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", extra_headers={ "x-javelin-route": "openai_univ", - "x-api-key": os.environ.get("HIGHFLAME_API_KEY") or os.environ.get("JAVELIN_API_KEY"), + "x-api-key": ( + os.environ.get("HIGHFLAME_API_KEY") + or os.environ.get("JAVELIN_API_KEY") + ), }, ) diff --git a/examples/openai/openai-universal.py b/examples/openai/openai-universal.py index cfa406d..d7536da 100644 --- a/examples/openai/openai-universal.py +++ b/examples/openai/openai-universal.py @@ -111,9 +111,15 @@ def init_async_openai_client(): def init_javelin_client_async(openai_async_client): """Initialize JavelinClient for async usage and register the OpenAI route.""" try: - javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") # add your javelin api key here + # add your javelin api key here + javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ) + base_url = ( + os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") + ) config = JavelinConfig( - javelin_api_key=javelin_api_key, base_url=os.getenv("HIGHFLAME_BASE_URL") or os.getenv("JAVELIN_BASE_URL") + javelin_api_key=javelin_api_key, base_url=base_url ) client = JavelinClient(config) client.register_openai(openai_async_client, route_name="openai_univ") diff --git a/examples/openai/openai_compatible_univ.py b/examples/openai/openai_compatible_univ.py index 2c46608..1d39257 100644 --- a/examples/openai/openai_compatible_univ.py +++ b/examples/openai/openai_compatible_univ.py @@ -31,7 +31,10 @@ def print_response(provider: str, response: Dict[str, Any]) -> None: "Content-Type": "application/json", "x-javelin-route": "openai_univ", "x-javelin-provider": "https://api.openai.com/v1", - "x-api-key": os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY"), # Use environment variable for security + # Use environment variable for security + "x-api-key": ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ), # Use environment variable for security "Authorization": f"Bearer {os.getenv('OPENAI_API_KEY')}", } diff --git a/examples/openai/openai_embedding_example.py b/examples/openai/openai_embedding_example.py index e0626ef..7daaa4a 100644 --- a/examples/openai/openai_embedding_example.py +++ b/examples/openai/openai_embedding_example.py @@ -37,7 +37,10 @@ javelin_headers = {"x-api-key": javelin_api_key, "x-javelin-route": "myusers"} llm = ChatOpenAI( - openai_api_base=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1/query", + openai_api_base=( + f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}" + "/v1/query" + ), openai_api_key=llm_api_key, model_kwargs={"extra_headers": javelin_headers}, ) diff --git a/examples/openai/openai_general_route.py b/examples/openai/openai_general_route.py index 32ee0d8..8860f01 100644 --- a/examples/openai/openai_general_route.py +++ b/examples/openai/openai_general_route.py @@ -21,7 +21,10 @@ def init_sync_openai_client(): # This client is configured for chat completions. return OpenAI( api_key=openai_api_key, - base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=( + f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}" + "/v1" + ), default_headers=javelin_headers, ) except Exception as e: @@ -32,11 +35,16 @@ def init_async_openai_client(): """Initialize and return an asynchronous OpenAI client with Javelin headers.""" try: openai_api_key = os.getenv("OPENAI_API_KEY") - javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") + ) javelin_headers = {"x-javelin-apikey": javelin_api_key} return AsyncOpenAI( api_key=openai_api_key, - base_url=f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}/v1", + base_url=( + f"{os.getenv('HIGHFLAME_BASE_URL') or os.getenv('JAVELIN_BASE_URL')}" + "/v1" + ), default_headers=javelin_headers, ) except Exception as e: diff --git a/examples/route_examples/aexample.py b/examples/route_examples/aexample.py index 84af818..736f1cd 100644 --- a/examples/route_examples/aexample.py +++ b/examples/route_examples/aexample.py @@ -15,9 +15,14 @@ dotenv.load_dotenv() -# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) -javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: +# check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +) +javelin_virtualapikey = ( + os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +) llm_api_key = os.getenv("LLM_API_KEY") diff --git a/examples/route_examples/drop_in_replacement.py b/examples/route_examples/drop_in_replacement.py index 654fef8..91bada0 100644 --- a/examples/route_examples/drop_in_replacement.py +++ b/examples/route_examples/drop_in_replacement.py @@ -14,9 +14,14 @@ dotenv.load_dotenv() -# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) -javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: +# check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +) +javelin_virtualapikey = ( + os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +) llm_api_key = os.getenv("OPENAI_API_KEY") diff --git a/examples/route_examples/example.py b/examples/route_examples/example.py index f8666eb..da0aa33 100644 --- a/examples/route_examples/example.py +++ b/examples/route_examples/example.py @@ -14,9 +14,14 @@ dotenv.load_dotenv() -# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) -javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: +# check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +) +javelin_virtualapikey = ( + os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +) llm_api_key = os.getenv("LLM_API_KEY") diff --git a/examples/route_examples/highflame_sdk_app.py b/examples/route_examples/highflame_sdk_app.py index b0f8ccb..6dc15b4 100644 --- a/examples/route_examples/highflame_sdk_app.py +++ b/examples/route_examples/highflame_sdk_app.py @@ -7,9 +7,14 @@ dotenv.load_dotenv() -# Retrieve environment variables (backward compatible: check HIGHFLAME_* first, fall back to JAVELIN_*) -javelin_api_key = os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") -javelin_virtualapikey = os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +# Retrieve environment variables (backward compatible: +# check HIGHFLAME_* first, fall back to JAVELIN_*) +javelin_api_key = ( + os.getenv("HIGHFLAME_API_KEY") or os.getenv("JAVELIN_API_KEY") +) +javelin_virtualapikey = ( + os.getenv("HIGHFLAME_VIRTUALAPIKEY") or os.getenv("JAVELIN_VIRTUALAPIKEY") +) llm_api_key = os.getenv("LLM_API_KEY") diff --git a/highflame/client.py b/highflame/client.py index d6fb5e5..4329456 100644 --- a/highflame/client.py +++ b/highflame/client.py @@ -86,13 +86,16 @@ def __init__(self, config: Config) -> None: # Send both headers for backward compatibility (backend may accept either) self._headers = { "x-highflame-apikey": config.api_key, # New header - "x-javelin-apikey": config.api_key, # Old header (for backward compatibility) + # Old header (for backward compatibility) + "x-javelin-apikey": config.api_key, } if config.llm_api_key: self._headers["Authorization"] = f"Bearer {config.llm_api_key}" if config.virtual_api_key: - self._headers["x-highflame-virtualapikey"] = config.virtual_api_key # New header - self._headers["x-javelin-virtualapikey"] = config.virtual_api_key # Old header (for backward compatibility) + # New header + self._headers["x-highflame-virtualapikey"] = config.virtual_api_key + # Old header (for backward compatibility) + self._headers["x-javelin-virtualapikey"] = config.virtual_api_key self._client = None self._aclient = None self.bedrock_client = None @@ -194,8 +197,10 @@ def _setup_client_headers(self, openai_client, route_name): openai_client._custom_headers.update(self._headers) if route_name is not None: - openai_client._custom_headers["x-highflame-route"] = route_name # New header - openai_client._custom_headers["x-javelin-route"] = route_name # Old header (for backward compatibility) + # New header + openai_client._custom_headers["x-highflame-route"] = route_name + # Old header (for backward compatibility) + openai_client._custom_headers["x-javelin-route"] = route_name # Ensure the client uses the custom headers if hasattr(openai_client, "default_headers"): @@ -285,8 +290,10 @@ def _execute_with_tracing( def _setup_custom_headers(self, openai_client, model): """Setup custom headers for the OpenAI client.""" if model and hasattr(openai_client, "_custom_headers"): - openai_client._custom_headers["x-highflame-model"] = model # New header - openai_client._custom_headers["x-javelin-model"] = model # Old header (for backward compatibility) + # New header + openai_client._custom_headers["x-highflame-model"] = model + # Old header (for backward compatibility) + openai_client._custom_headers["x-javelin-model"] = model if not hasattr(openai_client, "_custom_headers"): return @@ -777,12 +784,20 @@ def override_endpoint_url(request: Any, **kwargs) -> None: base_url = f"{original_url.scheme}://{original_url.netloc}" # Set the header (dual support for backward compatibility) - request.headers["x-highflame-provider"] = base_url # New header - request.headers["x-javelin-provider"] = base_url # Old header (for backward compatibility) + # New header + request.headers["x-highflame-provider"] = base_url + # Old header (for backward compatibility) + request.headers["x-javelin-provider"] = base_url if self.use_default_bedrock_route and self.default_bedrock_route: - request.headers["x-highflame-route"] = self.default_bedrock_route # New header - request.headers["x-javelin-route"] = self.default_bedrock_route # Old header (for backward compatibility) + # New header + request.headers["x-highflame-route"] = ( + self.default_bedrock_route + ) + # Old header (for backward compatibility) + request.headers["x-javelin-route"] = ( + self.default_bedrock_route + ) path = original_url.path path = unquote(path) @@ -793,8 +808,10 @@ def override_endpoint_url(request: Any, **kwargs) -> None: if model_id: model_id = re.sub(r"-\d{8}(?=-)", "", model_id) - request.headers["x-highflame-model"] = model_id # New header - request.headers["x-javelin-model"] = model_id # Old header (for backward compatibility) + # New header + request.headers["x-highflame-model"] = model_id + # Old header (for backward compatibility) + request.headers["x-javelin-model"] = model_id # Update the request URL to use the Highflame endpoint. parsed_base = urlparse(self.base_url) diff --git a/highflame/models.py b/highflame/models.py index fdbb713..62138d4 100644 --- a/highflame/models.py +++ b/highflame/models.py @@ -3,7 +3,7 @@ from typing import Any, Dict, List, Optional from highflame.exceptions import UnauthorizedError -from pydantic import BaseModel, Field, field_validator, model_validator +from pydantic import BaseModel, Field, field_validator class GatewayConfig(BaseModel): diff --git a/highflame/services/aispm_service.py b/highflame/services/aispm_service.py index 401b6d1..97a750b 100644 --- a/highflame/services/aispm_service.py +++ b/highflame/services/aispm_service.py @@ -27,7 +27,8 @@ def _get_aispm_headers(self) -> Dict[str, str]: account_id = getattr(self.client, "_aispm_account_id", None) if account_id: headers["x-highflame-accountid"] = account_id # New header - headers["x-javelin-accountid"] = account_id # Old header (for backward compatibility) + # Old header (for backward compatibility) + headers["x-javelin-accountid"] = account_id headers["x-highflame-user"] = getattr( self.client, "_aispm_user", "test-user" ) # New header diff --git a/highflame/services/route_service.py b/highflame/services/route_service.py index c2bbf7a..60979cd 100644 --- a/highflame/services/route_service.py +++ b/highflame/services/route_service.py @@ -3,8 +3,8 @@ from typing import Any, AsyncGenerator, Dict, Generator, List, Optional, Union import httpx +from jsonpath_ng import parse -logger = logging.getLogger(__name__) from highflame.exceptions import ( BadRequest, InternalServerError, @@ -14,7 +14,8 @@ UnauthorizedError, ) from highflame.models import HttpMethod, Request, Route, Routes, UnivModelConfig -from jsonpath_ng import parse + +logger = logging.getLogger(__name__) class RouteService: diff --git a/highflame/tracing_setup.py b/highflame/tracing_setup.py index cb2cda2..a7b7025 100644 --- a/highflame/tracing_setup.py +++ b/highflame/tracing_setup.py @@ -5,16 +5,17 @@ from typing import Optional from opentelemetry import trace - -logger = logging.getLogger(__name__) - # from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter # Use the HTTP exporter instead of the gRPC one -from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter +from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( + OTLPSpanExporter, +) from opentelemetry.sdk.resources import Resource from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchSpanProcessor +logger = logging.getLogger(__name__) + # --- OpenTelemetry Setup --- # TRACES_ENDPOINT = os.getenv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT", # "https://api-dev.javelin.live/v1/admin/traces") diff --git a/highflame_cli/_internal/commands.py b/highflame_cli/_internal/commands.py index 419c884..91a3133 100644 --- a/highflame_cli/_internal/commands.py +++ b/highflame_cli/_internal/commands.py @@ -28,7 +28,8 @@ def get_cache_file(): - """Get cache file path, checking new location first, then falling back to old location""" + """Get cache file path, checking new location first, + then falling back to old location""" home_dir = Path.home() # Try new location first new_cache_file = home_dir / ".highflame" / "cache.json"