veris-ai 1.10.1__tar.gz → 1.11.0__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.
- {veris_ai-1.10.1 → veris_ai-1.11.0}/.github/workflows/test.yml +1 -1
- {veris_ai-1.10.1 → veris_ai-1.11.0}/PKG-INFO +3 -19
- {veris_ai-1.10.1 → veris_ai-1.11.0}/README.md +2 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/pyproject.toml +26 -30
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/README.md +4 -4
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/observability.py +2 -1
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/tool_mock.py +29 -6
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/test_tool_mock.py +9 -5
- {veris_ai-1.10.1 → veris_ai-1.11.0}/uv.lock +410 -429
- {veris_ai-1.10.1 → veris_ai-1.11.0}/.cursor/rules/documentation-management.mdc +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/.github/workflows/release.yml +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/.gitignore +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/.pre-commit-config.yaml +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/CHANGELOG.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/CLAUDE.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/LICENSE +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/examples/README.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/examples/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/examples/import_options.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/examples/openai_agents_example.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/agents_wrapper.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/api_client.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/jaeger_interface/README.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/jaeger_interface/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/jaeger_interface/client.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/jaeger_interface/models.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/models.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/src/veris_ai/utils.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/README.md +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/conftest.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/fixtures/__init__.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/fixtures/http_server.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/fixtures/simple_app.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/test_agents_wrapper_extract.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/test_agents_wrapper_simple.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/test_mcp_protocol_server_mocked.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/tests/test_utils.py +0 -0
- {veris_ai-1.10.1 → veris_ai-1.11.0}/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.
|
|
3
|
+
Version: 1.11.0
|
|
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
|
|
@@ -21,28 +21,12 @@ Requires-Dist: opentelemetry-sdk>=1.34.1
|
|
|
21
21
|
Requires-Dist: pydantic>=2.0.0
|
|
22
22
|
Requires-Dist: requests>=2.31.0
|
|
23
23
|
Requires-Dist: tenacity>=9.1.2
|
|
24
|
-
Provides-Extra: agents
|
|
25
|
-
Requires-Dist: openai-agents>=0.0.1; extra == 'agents'
|
|
26
|
-
Provides-Extra: dev
|
|
27
|
-
Requires-Dist: black>=23.7.0; extra == 'dev'
|
|
28
|
-
Requires-Dist: mypy>=1.5.1; extra == 'dev'
|
|
29
|
-
Requires-Dist: openai-agents>=0.2.5; extra == 'dev'
|
|
30
|
-
Requires-Dist: pre-commit>=3.3.3; extra == 'dev'
|
|
31
|
-
Requires-Dist: pytest-asyncio>=0.21.1; extra == 'dev'
|
|
32
|
-
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
33
|
-
Requires-Dist: pytest>=7.4.0; extra == 'dev'
|
|
34
|
-
Requires-Dist: ruff>=0.11.4; extra == 'dev'
|
|
35
|
-
Provides-Extra: fastapi
|
|
36
|
-
Requires-Dist: fastapi; extra == 'fastapi'
|
|
37
|
-
Requires-Dist: fastapi-mcp>=0.4.0; extra == 'fastapi'
|
|
38
|
-
Provides-Extra: instrument
|
|
39
|
-
Requires-Dist: opentelemetry-api; extra == 'instrument'
|
|
40
|
-
Requires-Dist: opentelemetry-sdk; extra == 'instrument'
|
|
41
|
-
Requires-Dist: wrapt; extra == 'instrument'
|
|
42
24
|
Description-Content-Type: text/markdown
|
|
43
25
|
|
|
44
26
|
# Veris AI Python SDK
|
|
45
27
|
|
|
28
|
+
For more information visit us at https://veris.ai
|
|
29
|
+
|
|
46
30
|
A Python package for Veris AI tools with simulation capabilities and FastAPI MCP (Model Context Protocol) integration.
|
|
47
31
|
|
|
48
32
|
## Quick Reference
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "veris-ai"
|
|
7
|
-
version = "1.
|
|
7
|
+
version = "1.11.0"
|
|
8
8
|
description = "A Python package for Veris AI tools"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -28,30 +28,6 @@ dependencies = [
|
|
|
28
28
|
"tenacity>=9.1.2",
|
|
29
29
|
]
|
|
30
30
|
|
|
31
|
-
[project.optional-dependencies]
|
|
32
|
-
dev = [
|
|
33
|
-
"ruff>=0.11.4",
|
|
34
|
-
"pytest>=7.4.0",
|
|
35
|
-
"pytest-asyncio>=0.21.1",
|
|
36
|
-
"pytest-cov>=4.1.0",
|
|
37
|
-
"black>=23.7.0",
|
|
38
|
-
"mypy>=1.5.1",
|
|
39
|
-
"pre-commit>=3.3.3",
|
|
40
|
-
"openai-agents>=0.2.5",
|
|
41
|
-
]
|
|
42
|
-
fastapi = [
|
|
43
|
-
"fastapi",
|
|
44
|
-
"fastapi-mcp>=0.4.0",
|
|
45
|
-
]
|
|
46
|
-
agents = [
|
|
47
|
-
"openai-agents>=0.0.1",
|
|
48
|
-
]
|
|
49
|
-
instrument = [
|
|
50
|
-
"wrapt",
|
|
51
|
-
"opentelemetry-api",
|
|
52
|
-
"opentelemetry-sdk",
|
|
53
|
-
]
|
|
54
|
-
|
|
55
31
|
[project.urls]
|
|
56
32
|
"Homepage" = "https://github.com/veris-ai/veris-python-sdk"
|
|
57
33
|
"Bug Tracker" = "https://github.com/veris-ai/veris-python-sdk/issues"
|
|
@@ -63,6 +39,17 @@ packages = ["src/veris_ai"]
|
|
|
63
39
|
testpaths = ["tests"]
|
|
64
40
|
python_files = ["test_*.py"]
|
|
65
41
|
|
|
42
|
+
[tool.mypy]
|
|
43
|
+
ignore_missing_imports = false
|
|
44
|
+
|
|
45
|
+
[[tool.mypy.overrides]]
|
|
46
|
+
module = [
|
|
47
|
+
"fastapi.*",
|
|
48
|
+
"fastapi_mcp.*",
|
|
49
|
+
"agents.*",
|
|
50
|
+
]
|
|
51
|
+
ignore_missing_imports = true
|
|
52
|
+
|
|
66
53
|
[tool.ruff]
|
|
67
54
|
line-length = 100
|
|
68
55
|
target-version = "py311"
|
|
@@ -171,13 +158,22 @@ veris-ai = { workspace = true }
|
|
|
171
158
|
|
|
172
159
|
[dependency-groups]
|
|
173
160
|
dev = [
|
|
174
|
-
"
|
|
175
|
-
"fastapi-mcp>=0.4.0",
|
|
176
|
-
"mypy>=1.17.0",
|
|
177
|
-
"openai-agents>=0.0.1",
|
|
161
|
+
"ruff>=0.12.4",
|
|
178
162
|
"pytest>=8.4.1",
|
|
179
163
|
"pytest-asyncio>=1.1.0",
|
|
180
164
|
"pytest-cov>=6.2.1",
|
|
181
|
-
"
|
|
165
|
+
"mypy>=1.17.0",
|
|
182
166
|
"types-requests>=2.32.4.20250611",
|
|
167
|
+
"pre-commit>=3.3.3",
|
|
168
|
+
"uvicorn>=0.30.0",
|
|
169
|
+
]
|
|
170
|
+
fastapi = [
|
|
171
|
+
"fastapi>=0.116.1",
|
|
172
|
+
"fastapi-mcp>=0.4.0",
|
|
173
|
+
]
|
|
174
|
+
agents = [
|
|
175
|
+
"openai-agents>=0.2.5",
|
|
176
|
+
]
|
|
177
|
+
instrument = [
|
|
178
|
+
"wrapt>=1.14.0",
|
|
183
179
|
]
|
|
@@ -27,16 +27,16 @@ This module contains the core implementation of the Veris AI Python SDK. Each co
|
|
|
27
27
|
|
|
28
28
|
### Mock Flow
|
|
29
29
|
1. **Decoration**: `@veris.mock()` captures function metadata
|
|
30
|
-
2. **
|
|
31
|
-
3. **API Call**: POST to
|
|
30
|
+
2. **Session Check**: Presence of session ID determines behavior
|
|
31
|
+
3. **API Call**: POST to VERIS API endpoint `/v2/tool_mock` (auto-configured)
|
|
32
32
|
4. **Type Conversion**: Response converted using `extract_json_schema()`
|
|
33
33
|
|
|
34
34
|
**Implementation**: [`tool_mock.py:200-250`](tool_mock.py)
|
|
35
35
|
|
|
36
36
|
### Spy Flow
|
|
37
|
-
1. **Pre-execution Logging**: Call details sent to `/v2/log_tool_call`
|
|
37
|
+
1. **Pre-execution Logging**: Call details sent to `/v2/simulations/{session_id}/log_tool_call`
|
|
38
38
|
2. **Function Execution**: Original function runs normally
|
|
39
|
-
3. **Post-execution Logging**: Response sent to `/v2/log_tool_response`
|
|
39
|
+
3. **Post-execution Logging**: Response sent to `/v2/simulations/{session_id}/log_tool_response`
|
|
40
40
|
|
|
41
41
|
**Implementation**: [`tool_mock.py:250-300`](tool_mock.py)
|
|
42
42
|
|
|
@@ -16,7 +16,7 @@ logger = getLogger(__name__)
|
|
|
16
16
|
def init_observability() -> None: # noqa: PLR0912
|
|
17
17
|
"""Initialize tracing/export and set W3C propagation.
|
|
18
18
|
|
|
19
|
-
- Initializes
|
|
19
|
+
- Initializes Traceloop if available (acts as OTel bootstrap/exporter)
|
|
20
20
|
- Sets global propagator to TraceContext + Baggage (W3C)
|
|
21
21
|
- Instruments MCP, requests, httpx if instrumentation packages are present
|
|
22
22
|
- Adds a request hook to capture outbound traceparent for debugging
|
|
@@ -35,6 +35,7 @@ def init_observability() -> None: # noqa: PLR0912
|
|
|
35
35
|
logfire.instrument_mcp()
|
|
36
36
|
|
|
37
37
|
except Exception as e:
|
|
38
|
+
# Tracing is optional; continue without Traceloop
|
|
38
39
|
msg = "Logfire not found: " + str(e)
|
|
39
40
|
raise RuntimeError(msg) from e
|
|
40
41
|
|
|
@@ -62,13 +62,14 @@ class VerisSDK:
|
|
|
62
62
|
FastApiMCP,
|
|
63
63
|
)
|
|
64
64
|
|
|
65
|
-
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token")
|
|
65
|
+
oauth2_scheme = OAuth2PasswordBearer(tokenUrl="token", auto_error=False)
|
|
66
66
|
|
|
67
67
|
async def authenticate_request(
|
|
68
|
-
|
|
69
|
-
token: str = Depends(oauth2_scheme),
|
|
68
|
+
request: Request, # noqa: ARG001
|
|
69
|
+
token: str | None = Depends(oauth2_scheme),
|
|
70
70
|
) -> None:
|
|
71
|
-
|
|
71
|
+
if token:
|
|
72
|
+
self.set_session_id(token)
|
|
72
73
|
|
|
73
74
|
# Create auth config with dependencies
|
|
74
75
|
auth_config = AuthConfig(
|
|
@@ -267,6 +268,17 @@ def mock_tool_call(
|
|
|
267
268
|
return_type_obj = type_hints.pop("return", Any)
|
|
268
269
|
# Get function docstring
|
|
269
270
|
docstring = inspect.getdoc(func) or ""
|
|
271
|
+
|
|
272
|
+
# Clean up parameters for V3 - just send values, not the nested dict
|
|
273
|
+
clean_params: dict[str, Any] = {}
|
|
274
|
+
for key, value in parameters.items():
|
|
275
|
+
if isinstance(value, dict) and "value" in value:
|
|
276
|
+
# Extract just the value from the nested structure
|
|
277
|
+
clean_params[key] = value["value"]
|
|
278
|
+
else:
|
|
279
|
+
# Already clean or unexpected format
|
|
280
|
+
clean_params[key] = value
|
|
281
|
+
|
|
270
282
|
# Determine response expectation
|
|
271
283
|
payload = {
|
|
272
284
|
"session_id": session_id,
|
|
@@ -274,7 +286,7 @@ def mock_tool_call(
|
|
|
274
286
|
"cache_response": bool(options.cache_response),
|
|
275
287
|
"tool_call": {
|
|
276
288
|
"function_name": func.__name__,
|
|
277
|
-
"parameters":
|
|
289
|
+
"parameters": clean_params,
|
|
278
290
|
"return_type": json.dumps(extract_json_schema(return_type_obj)),
|
|
279
291
|
"docstring": docstring,
|
|
280
292
|
},
|
|
@@ -299,9 +311,20 @@ def log_tool_call(
|
|
|
299
311
|
"""Log tool call synchronously to the VERIS logging endpoint."""
|
|
300
312
|
api_client = get_api_client()
|
|
301
313
|
endpoint = api_client.get_log_tool_call_endpoint(session_id)
|
|
314
|
+
|
|
315
|
+
# Clean up parameters for V3 - just send values, not the nested dict
|
|
316
|
+
clean_params: dict[str, Any] = {}
|
|
317
|
+
for key, value in parameters.items():
|
|
318
|
+
if isinstance(value, dict) and "value" in value:
|
|
319
|
+
# Extract just the value from the nested structure
|
|
320
|
+
clean_params[key] = value["value"]
|
|
321
|
+
else:
|
|
322
|
+
# Already clean or unexpected format
|
|
323
|
+
clean_params[key] = value
|
|
324
|
+
|
|
302
325
|
payload = {
|
|
303
326
|
"function_name": function_name,
|
|
304
|
-
"parameters":
|
|
327
|
+
"parameters": clean_params,
|
|
305
328
|
"docstring": docstring,
|
|
306
329
|
}
|
|
307
330
|
try:
|
|
@@ -91,8 +91,9 @@ async def test_mock_http_error(simulation_env):
|
|
|
91
91
|
|
|
92
92
|
@pytest.mark.asyncio
|
|
93
93
|
async def test_mock_missing_endpoint():
|
|
94
|
-
"""Test that missing endpoint raises
|
|
95
|
-
|
|
94
|
+
"""Test that missing endpoint raises ConnectError when invalid URL is used."""
|
|
95
|
+
# Use invalid URL that will trigger ConnectError
|
|
96
|
+
with patch.dict(os.environ, {"VERIS_API_URL": "http://invalid-nonexistent-domain-12345.local"}):
|
|
96
97
|
|
|
97
98
|
@veris.mock()
|
|
98
99
|
async def test_func():
|
|
@@ -101,15 +102,18 @@ async def test_mock_missing_endpoint():
|
|
|
101
102
|
# Set session_id to enable simulation mode
|
|
102
103
|
veris.set_session_id("test-session")
|
|
103
104
|
|
|
104
|
-
#
|
|
105
|
-
# We'll test that the connection fails with httpx.ConnectError
|
|
105
|
+
# Invalid domain will cause ConnectError
|
|
106
106
|
with pytest.raises(httpx.ConnectError):
|
|
107
107
|
await test_func()
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
@pytest.mark.asyncio
|
|
111
111
|
async def test_mock_invalid_endpoint(simulation_env):
|
|
112
|
-
|
|
112
|
+
# Use invalid URL that will trigger ConnectError
|
|
113
|
+
with (
|
|
114
|
+
patch.dict(os.environ, {"VERIS_API_URL": "http://invalid-nonexistent-domain-67890.local"}),
|
|
115
|
+
pytest.raises(httpx.ConnectError),
|
|
116
|
+
):
|
|
113
117
|
|
|
114
118
|
@veris.mock()
|
|
115
119
|
async def test_func():
|