veris-ai 1.14.0__tar.gz → 1.14.1__tar.gz

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.

Files changed (44) hide show
  1. {veris_ai-1.14.0 → veris_ai-1.14.1}/PKG-INFO +1 -1
  2. {veris_ai-1.14.0 → veris_ai-1.14.1}/pyproject.toml +1 -1
  3. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/api_client.py +20 -8
  4. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/tool_mock.py +3 -1
  5. veris_ai-1.14.1/tests/test_api_client.py +140 -0
  6. {veris_ai-1.14.0 → veris_ai-1.14.1}/uv.lock +1 -1
  7. {veris_ai-1.14.0 → veris_ai-1.14.1}/.cursor/rules/documentation-management.mdc +0 -0
  8. {veris_ai-1.14.0 → veris_ai-1.14.1}/.github/workflows/release.yml +0 -0
  9. {veris_ai-1.14.0 → veris_ai-1.14.1}/.github/workflows/test.yml +0 -0
  10. {veris_ai-1.14.0 → veris_ai-1.14.1}/.gitignore +0 -0
  11. {veris_ai-1.14.0 → veris_ai-1.14.1}/.pre-commit-config.yaml +0 -0
  12. {veris_ai-1.14.0 → veris_ai-1.14.1}/CHANGELOG.md +0 -0
  13. {veris_ai-1.14.0 → veris_ai-1.14.1}/CLAUDE.md +0 -0
  14. {veris_ai-1.14.0 → veris_ai-1.14.1}/LICENSE +0 -0
  15. {veris_ai-1.14.0 → veris_ai-1.14.1}/README.md +0 -0
  16. {veris_ai-1.14.0 → veris_ai-1.14.1}/examples/README.md +0 -0
  17. {veris_ai-1.14.0 → veris_ai-1.14.1}/examples/__init__.py +0 -0
  18. {veris_ai-1.14.0 → veris_ai-1.14.1}/examples/import_options.py +0 -0
  19. {veris_ai-1.14.0 → veris_ai-1.14.1}/examples/openai_agents_example.py +0 -0
  20. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/README.md +0 -0
  21. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/__init__.py +0 -0
  22. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/agents_wrapper.py +0 -0
  23. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/jaeger_interface/README.md +0 -0
  24. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/jaeger_interface/__init__.py +0 -0
  25. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/jaeger_interface/client.py +0 -0
  26. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/jaeger_interface/models.py +0 -0
  27. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/models.py +0 -0
  28. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/observability.py +0 -0
  29. {veris_ai-1.14.0 → veris_ai-1.14.1}/src/veris_ai/utils.py +0 -0
  30. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/README.md +0 -0
  31. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/__init__.py +0 -0
  32. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/conftest.py +0 -0
  33. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/fixtures/__init__.py +0 -0
  34. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/fixtures/http_server.py +0 -0
  35. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/fixtures/simple_app.py +0 -0
  36. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_agents_wrapper_extract.py +0 -0
  37. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_agents_wrapper_simple.py +0 -0
  38. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_helpers.py +0 -0
  39. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_mcp_protocol_server_mocked.py +0 -0
  40. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_side_effects.py +0 -0
  41. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_token_decoding.py +0 -0
  42. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_tool_mock.py +0 -0
  43. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_utils.py +0 -0
  44. {veris_ai-1.14.0 → veris_ai-1.14.1}/tests/test_veris_runner_tool_options.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: veris-ai
3
- Version: 1.14.0
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "veris-ai"
7
- version = "1.14.0"
7
+ version = "1.14.1"
8
8
  description = "A Python package for Veris AI tools"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.11"
@@ -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.timeout = float(os.getenv("VERIS_MOCK_TIMEOUT", "90.0"))
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.timeout) as client:
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.timeout) as client:
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._get_base_url(), "v3/tool_mock")
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._get_base_url(), f"v3/log_tool_call?session_id={session_id}")
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._get_base_url(), f"v3/log_tool_response?session_id={session_id}")
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)
@@ -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"
@@ -0,0 +1,140 @@
1
+ """Tests for SimulatorAPIClient endpoint URL generation and configuration."""
2
+
3
+ import os
4
+ from unittest.mock import patch
5
+
6
+ import pytest
7
+
8
+ from veris_ai.api_client import SimulatorAPIClient, get_api_client, set_api_client_params
9
+
10
+
11
+ def test_tool_mock_endpoint_default():
12
+ """Test that tool_mock_endpoint property returns correct URL with default base_url."""
13
+ client = SimulatorAPIClient()
14
+ endpoint = client.tool_mock_endpoint
15
+
16
+ # Should use default base URL
17
+ assert endpoint == "https://simulator.api.veris.ai/v3/tool_mock"
18
+
19
+
20
+ def test_tool_mock_endpoint_custom_base_url():
21
+ """Test that tool_mock_endpoint uses cached base_url from constructor."""
22
+ client = SimulatorAPIClient(base_url="https://custom.api.com")
23
+ endpoint = client.tool_mock_endpoint
24
+
25
+ assert endpoint == "https://custom.api.com/v3/tool_mock"
26
+
27
+
28
+ def test_tool_mock_endpoint_with_env_var():
29
+ """Test that tool_mock_endpoint respects VERIS_API_URL environment variable."""
30
+ with patch.dict(os.environ, {"VERIS_API_URL": "https://test.api.veris.ai"}):
31
+ client = SimulatorAPIClient()
32
+ endpoint = client.tool_mock_endpoint
33
+
34
+ assert endpoint == "https://test.api.veris.ai/v3/tool_mock"
35
+
36
+
37
+ def test_log_tool_call_endpoint():
38
+ """Test get_log_tool_call_endpoint generates correct URL."""
39
+ client = SimulatorAPIClient(base_url="https://test.api.com")
40
+ endpoint = client.get_log_tool_call_endpoint("session-123")
41
+
42
+ assert endpoint == "https://test.api.com/v3/log_tool_call?session_id=session-123"
43
+
44
+
45
+ def test_log_tool_response_endpoint():
46
+ """Test get_log_tool_response_endpoint generates correct URL."""
47
+ client = SimulatorAPIClient(base_url="https://test.api.com")
48
+ endpoint = client.get_log_tool_response_endpoint("session-456")
49
+
50
+ assert endpoint == "https://test.api.com/v3/log_tool_response?session_id=session-456"
51
+
52
+
53
+ def test_base_url_without_protocol_behavior():
54
+ """Test that base_url without protocol is treated as relative path by urljoin."""
55
+ # Note: urljoin treats URLs without protocol as relative paths
56
+ client = SimulatorAPIClient(base_url="api.example.com")
57
+ endpoint = client.tool_mock_endpoint
58
+
59
+ # urljoin treats "api.example.com" as a relative path, so result is just the path component
60
+ assert endpoint == "v3/tool_mock"
61
+
62
+
63
+ def test_base_url_with_trailing_slash():
64
+ """Test that base_url with trailing slash is handled correctly."""
65
+ client = SimulatorAPIClient(base_url="https://test.api.com/")
66
+ endpoint = client.tool_mock_endpoint
67
+
68
+ # urljoin should handle trailing slash correctly
69
+ assert endpoint == "https://test.api.com/v3/tool_mock"
70
+
71
+
72
+ def test_custom_timeout():
73
+ """Test that custom timeout is set correctly."""
74
+ client = SimulatorAPIClient(timeout=30.0)
75
+ assert client._timeout == 30.0
76
+
77
+
78
+ def test_default_timeout():
79
+ """Test that default timeout is used when not specified."""
80
+ with patch.dict(os.environ, {"VERIS_MOCK_TIMEOUT": "120.0"}):
81
+ client = SimulatorAPIClient()
82
+ assert client._timeout == 120.0
83
+
84
+
85
+ def test_set_api_client_params():
86
+ """Test that set_api_client_params reconfigures the global client."""
87
+ # Get original client
88
+ original_client = get_api_client()
89
+ original_endpoint = original_client.tool_mock_endpoint
90
+
91
+ # Reconfigure with custom parameters
92
+ set_api_client_params(base_url="https://custom.test.api", timeout=60.0)
93
+
94
+ # Get new client and verify it's been updated
95
+ new_client = get_api_client()
96
+ assert new_client.tool_mock_endpoint == "https://custom.test.api/v3/tool_mock"
97
+ assert new_client._timeout == 60.0
98
+
99
+ # Restore original client
100
+ set_api_client_params()
101
+
102
+
103
+ def test_set_api_client_params_partial():
104
+ """Test that set_api_client_params can set only base_url or timeout."""
105
+ # Set only base_url
106
+ set_api_client_params(base_url="https://partial.test")
107
+ client = get_api_client()
108
+ assert client.tool_mock_endpoint == "https://partial.test/v3/tool_mock"
109
+ assert client._timeout == 300 # Should use default
110
+
111
+ # Set only timeout
112
+ set_api_client_params(timeout=45.0)
113
+ client = get_api_client()
114
+ assert client._timeout == 45.0
115
+
116
+ # Restore defaults
117
+ set_api_client_params()
118
+
119
+
120
+ def test_multiple_endpoint_calls_use_cached_base_url():
121
+ """Test that multiple endpoint property accesses use the same cached base_url."""
122
+ client = SimulatorAPIClient(base_url="https://cached.api")
123
+
124
+ # Call multiple endpoint methods
125
+ endpoint1 = client.tool_mock_endpoint
126
+ endpoint2 = client.get_log_tool_call_endpoint("session-1")
127
+ endpoint3 = client.get_log_tool_response_endpoint("session-2")
128
+
129
+ # All should use the same base URL
130
+ assert endpoint1.startswith("https://cached.api/")
131
+ assert endpoint2.startswith("https://cached.api/")
132
+ assert endpoint3.startswith("https://cached.api/")
133
+
134
+
135
+ def test_empty_env_var_uses_default():
136
+ """Test that empty VERIS_API_URL falls back to default."""
137
+ with patch.dict(os.environ, {"VERIS_API_URL": ""}, clear=True):
138
+ client = SimulatorAPIClient()
139
+ # Empty string should NOT be used, should fall back to default
140
+ assert client._get_base_url() == "https://simulator.api.veris.ai"
@@ -1571,7 +1571,7 @@ wheels = [
1571
1571
 
1572
1572
  [[package]]
1573
1573
  name = "veris-ai"
1574
- version = "1.13.0"
1574
+ version = "1.14.0"
1575
1575
  source = { editable = "." }
1576
1576
  dependencies = [
1577
1577
  { name = "httpx" },
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes