Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "qualifire"
version = "0.15.0"
version = "0.16.0"
description = "Qualifire Python SDK"
authors = [{ name = "qualifire-dev", email = "dror@qualifire.ai" }]
requires-python = ">=3.8,<4"
Expand Down
4 changes: 2 additions & 2 deletions qualifire/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def evaluate(
)
```
""" # noqa E501
url = f"{self._base_url}/api/evaluation/evaluate"
url = f"{self._base_url}/api/v1/evaluation/evaluate"
request = EvaluationRequest(
input=input,
output=output,
Expand Down Expand Up @@ -269,7 +269,7 @@ def invoke_evaluation(
available_tools: Optional[List[LLMToolDefinition]] = None,
metadata: Optional[Dict[str, str]] = None,
) -> EvaluationResponse:
url = f"{self._base_url}/api/evaluation/invoke/"
url = f"{self._base_url}/api/v1/evaluation/invoke/"

if messages is not None:
if isinstance(messages, list) and all(
Expand Down
4 changes: 3 additions & 1 deletion qualifire/consts.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
QUALIFIRE_API_KEY_ENV_VAR = "QUALIFIRE_API_KEY"
QUALIFIRE_BASE_URL_ENV_VAR = "QUALIFIRE_BASE_URL"
_DEFAULT_BASE_URL = "https://proxy.qualifire.ai/"
QUALIFIRE_TRACING_URL_ENV_VAR = "QUALIFIRE_TRACING_URL"
_DEFAULT_BASE_URL = "https://api.qualifire.ai/"
_DEFAULT_TRACING_URL = "https://tracing.qualifire.ai"
Comment on lines +3 to +5
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Default base URL should remain the proxy endpoint.

Changing _DEFAULT_BASE_URL to https://api.qualifire.ai/ alters the fallback behavior for get_base_url() and conflicts with the expected proxy default. If the proxy is still the supported default, keep the prior value or explicitly treat this as a breaking change.

✅ Suggested fix
-_DEFAULT_BASE_URL = "https://api.qualifire.ai/"
+_DEFAULT_BASE_URL = "https://proxy.qualifire.ai/"

Based on learnings use environment variables QUALIFIRE_API_KEY for API key and QUALIFIRE_BASE_URL for base URL resolution (defaults to https://proxy.qualifire.ai/).

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
QUALIFIRE_TRACING_URL_ENV_VAR = "QUALIFIRE_TRACING_URL"
_DEFAULT_BASE_URL = "https://api.qualifire.ai/"
_DEFAULT_TRACING_URL = "https://tracing.qualifire.ai"
QUALIFIRE_TRACING_URL_ENV_VAR = "QUALIFIRE_TRACING_URL"
_DEFAULT_BASE_URL = "https://proxy.qualifire.ai/"
_DEFAULT_TRACING_URL = "https://tracing.qualifire.ai"
🤖 Prompt for AI Agents
In `@qualifire/consts.py` around lines 3 - 5, Restore the proxy default by
changing _DEFAULT_BASE_URL back to "https://proxy.qualifire.ai/" (so
get_base_url() falls back to the proxy), keep _DEFAULT_TRACING_URL as-is, and
ensure environment variable names used for resolution are QUALIFIRE_API_KEY for
the API key and QUALIFIRE_BASE_URL for overriding the base URL; update any
references or resolution logic that currently use QUALIFIRE_TRACING_URL or the
new hardcoded "https://api.qualifire.ai/" to use these constants
(_DEFAULT_BASE_URL, QUALIFIRE_BASE_URL env) so behavior remains
backward-compatible unless deliberately making a breaking change.

4 changes: 2 additions & 2 deletions qualifire/tracer_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
except ImportError:
traceloop_installed = False

from .utils import get_api_key, get_base_url
from .utils import get_api_key, get_tracing_url

R = TypeVar("R")

Expand All @@ -37,7 +37,7 @@ def __configure_tracer(api_key: str) -> None:
__suppress_prints(
Traceloop.init,
app_name="qualifire-agent",
api_endpoint=f"{get_base_url()}/api/telemetry", # /v1/traces is automatically added # noqa: E501
api_endpoint=f"{get_tracing_url()}/api/telemetry", # /v1/traces is automatically added # noqa: E501
headers={"X-Qualifire-API-Key": api_key},
telemetry_enabled=False,
traceloop_sync_enabled=False,
Expand Down
9 changes: 9 additions & 0 deletions qualifire/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from .consts import (
_DEFAULT_BASE_URL,
_DEFAULT_TRACING_URL,
QUALIFIRE_API_KEY_ENV_VAR,
QUALIFIRE_BASE_URL_ENV_VAR,
QUALIFIRE_TRACING_URL_ENV_VAR,
)


Expand All @@ -19,3 +21,10 @@ def get_base_url() -> str:
if not base_url:
return _DEFAULT_BASE_URL
return base_url


def get_tracing_url() -> str:
tracing_url = os.getenv(QUALIFIRE_TRACING_URL_ENV_VAR)
if not tracing_url:
return _DEFAULT_TRACING_URL
return tracing_url
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.