veris-ai 1.14.0__py3-none-any.whl → 1.14.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of veris-ai might be problematic. Click here for more details.
- veris_ai/api_client.py +20 -8
- veris_ai/tool_mock.py +3 -1
- {veris_ai-1.14.0.dist-info → veris_ai-1.14.1.dist-info}/METADATA +1 -1
- {veris_ai-1.14.0.dist-info → veris_ai-1.14.1.dist-info}/RECORD +6 -6
- {veris_ai-1.14.0.dist-info → veris_ai-1.14.1.dist-info}/WHEEL +0 -0
- {veris_ai-1.14.0.dist-info → veris_ai-1.14.1.dist-info}/licenses/LICENSE +0 -0
veris_ai/api_client.py
CHANGED
|
@@ -20,9 +20,15 @@ class SimulatorAPIClient:
|
|
|
20
20
|
changes reflected without recreating the singleton.
|
|
21
21
|
"""
|
|
22
22
|
|
|
23
|
-
def __init__(self) -> None:
|
|
23
|
+
def __init__(self, timeout: float | None = None, base_url: str | None = None) -> None:
|
|
24
24
|
"""Initialize the API client with static timeout configuration."""
|
|
25
|
-
self.
|
|
25
|
+
self._timeout = timeout or float(os.getenv("VERIS_MOCK_TIMEOUT", "300.0"))
|
|
26
|
+
self._base_url = base_url
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def base_url(self) -> str:
|
|
30
|
+
"""Get the resolved base URL."""
|
|
31
|
+
return self._get_base_url()
|
|
26
32
|
|
|
27
33
|
def _get_base_url(self) -> str:
|
|
28
34
|
"""Resolve the base URL from environment.
|
|
@@ -33,7 +39,7 @@ class SimulatorAPIClient:
|
|
|
33
39
|
(do not fall back). This supports tests expecting connection
|
|
34
40
|
failures when an invalid endpoint is provided.
|
|
35
41
|
"""
|
|
36
|
-
return os.getenv("VERIS_API_URL") or "https://simulator.api.veris.ai"
|
|
42
|
+
return self._base_url or os.getenv("VERIS_API_URL") or "https://simulator.api.veris.ai"
|
|
37
43
|
|
|
38
44
|
def _build_headers(self) -> dict[str, str] | None:
|
|
39
45
|
"""Build headers including OpenTelemetry tracing and API key."""
|
|
@@ -55,7 +61,7 @@ class SimulatorAPIClient:
|
|
|
55
61
|
if not endpoint.startswith(("http://", "https://")):
|
|
56
62
|
raise httpx.ConnectError("Invalid endpoint URL (not absolute): {endpoint}")
|
|
57
63
|
|
|
58
|
-
with httpx.Client(timeout=self.
|
|
64
|
+
with httpx.Client(timeout=self._timeout) as client:
|
|
59
65
|
response = client.post(endpoint, json=payload, headers=headers)
|
|
60
66
|
response.raise_for_status()
|
|
61
67
|
return response.json() if response.content else None
|
|
@@ -73,7 +79,7 @@ class SimulatorAPIClient:
|
|
|
73
79
|
error_msg = f"Invalid endpoint URL (not absolute): {endpoint}"
|
|
74
80
|
raise httpx.ConnectError(error_msg)
|
|
75
81
|
|
|
76
|
-
async with httpx.AsyncClient(timeout=self.
|
|
82
|
+
async with httpx.AsyncClient(timeout=self._timeout) as client:
|
|
77
83
|
response = await client.post(endpoint, json=payload, headers=headers)
|
|
78
84
|
response.raise_for_status()
|
|
79
85
|
return response.json() if response.content else None
|
|
@@ -81,15 +87,15 @@ class SimulatorAPIClient:
|
|
|
81
87
|
@property
|
|
82
88
|
def tool_mock_endpoint(self) -> str:
|
|
83
89
|
"""Get the tool mock endpoint URL."""
|
|
84
|
-
return urljoin(self.
|
|
90
|
+
return urljoin(self.base_url, "v3/tool_mock")
|
|
85
91
|
|
|
86
92
|
def get_log_tool_call_endpoint(self, session_id: str) -> str:
|
|
87
93
|
"""Get the log tool call endpoint URL."""
|
|
88
|
-
return urljoin(self.
|
|
94
|
+
return urljoin(self.base_url, f"v3/log_tool_call?session_id={session_id}")
|
|
89
95
|
|
|
90
96
|
def get_log_tool_response_endpoint(self, session_id: str) -> str:
|
|
91
97
|
"""Get the log tool response endpoint URL."""
|
|
92
|
-
return urljoin(self.
|
|
98
|
+
return urljoin(self.base_url, f"v3/log_tool_response?session_id={session_id}")
|
|
93
99
|
|
|
94
100
|
|
|
95
101
|
# Global singleton instance
|
|
@@ -99,3 +105,9 @@ _api_client = SimulatorAPIClient()
|
|
|
99
105
|
def get_api_client() -> SimulatorAPIClient:
|
|
100
106
|
"""Get the global API client instance."""
|
|
101
107
|
return _api_client
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
def set_api_client_params(base_url: str | None = None, timeout: float | None = None) -> None:
|
|
111
|
+
"""Set the global API client instance for testing purposes."""
|
|
112
|
+
global _api_client # noqa: PLW0603
|
|
113
|
+
_api_client = SimulatorAPIClient(base_url=base_url, timeout=timeout)
|
veris_ai/tool_mock.py
CHANGED
|
@@ -16,7 +16,7 @@ from typing import (
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
from veris_ai.models import ResponseExpectation, ToolCallOptions
|
|
19
|
-
from veris_ai.api_client import get_api_client
|
|
19
|
+
from veris_ai.api_client import get_api_client, set_api_client_params
|
|
20
20
|
from veris_ai.utils import (
|
|
21
21
|
convert_to_type,
|
|
22
22
|
execute_callback,
|
|
@@ -92,6 +92,8 @@ class VerisSDK:
|
|
|
92
92
|
|
|
93
93
|
self._set_session_id(token_data["session_id"])
|
|
94
94
|
self._set_thread_id(token_data["thread_id"])
|
|
95
|
+
if token_data.get("api_url"):
|
|
96
|
+
set_api_client_params(base_url=token_data["api_url"])
|
|
95
97
|
logger.info(
|
|
96
98
|
f"Session ID set to {token_data['session_id']}, "
|
|
97
99
|
f"Thread ID set to {token_data['thread_id']} - mocking enabled"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: veris-ai
|
|
3
|
-
Version: 1.14.
|
|
3
|
+
Version: 1.14.1
|
|
4
4
|
Summary: A Python package for Veris AI tools
|
|
5
5
|
Project-URL: Homepage, https://github.com/veris-ai/veris-python-sdk
|
|
6
6
|
Project-URL: Bug Tracker, https://github.com/veris-ai/veris-python-sdk/issues
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
veris_ai/README.md,sha256=Mxg9fyNt6hFkQaFBYZq85Kw9akw4cN2uu6j_mXZtNCs,3871
|
|
2
2
|
veris_ai/__init__.py,sha256=enl_gEa6BQAjWvzCtsn_hFVJVVlJZ_dMsLL--E5W3nU,1907
|
|
3
3
|
veris_ai/agents_wrapper.py,sha256=gLUd_0TyCVsqqilQLvsSJIpsU5uu2CdjjWOQ4QJjoJk,12786
|
|
4
|
-
veris_ai/api_client.py,sha256=
|
|
4
|
+
veris_ai/api_client.py,sha256=ZtxskNdAG_ASx_y2VhzV0vdG2kW5Ph5gPDBn-FG44-4,4654
|
|
5
5
|
veris_ai/models.py,sha256=xKeheSJQle2tBeJG1DsGJzMDwv24p5jECjX6RAa39n4,495
|
|
6
6
|
veris_ai/observability.py,sha256=eSIXmk6fpOAoWM-sDbsvzyUASh1ZwU6tRIPduy09RxY,4206
|
|
7
|
-
veris_ai/tool_mock.py,sha256=
|
|
7
|
+
veris_ai/tool_mock.py,sha256=A1k_llfjbMsMXP9J1M9pLhYVyNGxaLACaL6vsTc0zoI,25108
|
|
8
8
|
veris_ai/utils.py,sha256=qwPPxS0CrsS36OoN_924hricz9jGRXx9FSDgLok0wgY,18940
|
|
9
9
|
veris_ai/jaeger_interface/README.md,sha256=kd9rKcE5xf3EyNaiHu0tjn-0oES9sfaK6Ih-OhhTyCM,2821
|
|
10
10
|
veris_ai/jaeger_interface/__init__.py,sha256=KD7NSiMYRG_2uF6dOLKkGG5lNQe4K9ptEwucwMT4_aw,1128
|
|
11
11
|
veris_ai/jaeger_interface/client.py,sha256=yJrh86wRR0Dk3Gq12DId99WogcMIVbL0QQFqVSevvlE,8772
|
|
12
12
|
veris_ai/jaeger_interface/models.py,sha256=e64VV6IvOEFuzRUgvDAMQFyOZMRb56I-PUPZLBZ3rX0,1864
|
|
13
|
-
veris_ai-1.14.
|
|
14
|
-
veris_ai-1.14.
|
|
15
|
-
veris_ai-1.14.
|
|
16
|
-
veris_ai-1.14.
|
|
13
|
+
veris_ai-1.14.1.dist-info/METADATA,sha256=C2JsiZwQNZcdW5uIX45fN2-sU3feqUyZJYMLR--VWKk,16684
|
|
14
|
+
veris_ai-1.14.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
15
|
+
veris_ai-1.14.1.dist-info/licenses/LICENSE,sha256=2g4i20atAgtD5einaKzhQrIB-JrPhyQgD3bC0wkHcCI,1065
|
|
16
|
+
veris_ai-1.14.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|