Skip to content

Commit 43112bb

Browse files
pjoshi30Preetam Joshi
andauthored
Updated versions of underlying dependencies (#60)
Co-authored-by: Preetam Joshi <info@aimon.ai>
1 parent 2b8f7a3 commit 43112bb

File tree

3 files changed

+55
-18
lines changed

3 files changed

+55
-18
lines changed

aimon/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "aimon"
4-
__version__ = "0.10.0"
4+
__version__ = "0.10.1"

setup.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
name='aimon',
99
python_requires='>3.8.0',
1010
packages=find_packages(),
11-
version="0.10.0",
11+
version="0.10.1",
1212
install_requires=[
1313
"annotated-types==0.6.0",
14-
"anyio==4.4.0",
15-
"certifi==2024.7.4",
16-
"distro==1.8.0",
14+
"anyio==4.9.0",
15+
"certifi==2025.4.26",
16+
"distro==1.9.0",
1717
"exceptiongroup==1.2.2",
18-
"h11==0.14.0",
19-
"httpcore==1.0.2",
18+
"h11==0.16.0",
19+
"httpcore==1.0.9",
2020
"httpx==0.28.1",
21-
"idna==3.4",
22-
"pydantic==2.10.3",
23-
"pydantic-core==2.27.1",
24-
"sniffio==1.3.0",
25-
"typing-extensions==4.12.2"
21+
"idna==3.10",
22+
"pydantic==2.11.3",
23+
"pydantic-core==2.33.1",
24+
"sniffio==1.3.1",
25+
"typing-extensions==4.13.2"
2626
],
2727
author='AIMon',
2828
author_email='info@aimon.ai',

tests/test_low_level_api.py

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,29 @@
33
import logging
44
import json
55
import time
6+
from datetime import datetime
67
from aimon import Client, APIStatusError
78

9+
def parse_datetime(dt_str):
10+
"""Parse datetime string in various formats to ensure compatibility with Pydantic."""
11+
if not dt_str or not isinstance(dt_str, str):
12+
return dt_str
13+
try:
14+
# Try to parse RFC 1123 format (e.g., 'Mon, 28 Apr 2025 19:40:50 GMT')
15+
formats = [
16+
'%a, %d %b %Y %H:%M:%S GMT', # RFC 1123 format
17+
'%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 format
18+
'%Y-%m-%dT%H:%M:%SZ', # ISO 8601 without microseconds
19+
]
20+
for fmt in formats:
21+
try:
22+
return datetime.strptime(dt_str, fmt)
23+
except ValueError:
24+
continue
25+
return dt_str # Return original if parsing fails
26+
except Exception:
27+
return dt_str # Return original on any error
28+
829
class TestLowLevelAPIWithRealService:
930
"""Test the low-level API client functions with the real AIMon service."""
1031

@@ -386,9 +407,9 @@ def test_evaluation_run_create(self):
386407
collection = self.client.datasets.collection.create(name=self.collection_name, dataset_ids=[dataset.sha], description=f"Prereq collection {self.timestamp}")
387408
evaluation = self.client.evaluations.create(
388409
name=self.evaluation_name,
389-
application_id=app.id,
390-
model_id=model.id,
391-
dataset_collection_id=collection.id
410+
application_id=str(app.id), # Convert to string to avoid Pydantic warnings
411+
model_id=str(model.id), # Convert to string to avoid Pydantic warnings
412+
dataset_collection_id=str(collection.id) # Convert to string to avoid Pydantic warnings
392413
)
393414
self.log_info("Prerequisites created", {"evaluation": evaluation.id})
394415
except Exception as e:
@@ -397,12 +418,28 @@ def test_evaluation_run_create(self):
397418
# Create Evaluation Run
398419
try:
399420
metrics_config = {'hallucination': {'detector_name': 'default'}, 'toxicity': {'detector_name': 'default'}}
421+
422+
# Handle creation_time and completed_time if they come as string responses
423+
creation_time = None
424+
completed_time = None
425+
426+
# When creating an evaluation run, use the helper to handle date strings
400427
create_response = self.client.evaluations.run.create(
401-
evaluation_id=evaluation.id,
402-
metrics_config=metrics_config
428+
evaluation_id=str(evaluation.id), # Convert to string to avoid Pydantic warnings
429+
metrics_config=metrics_config,
430+
creation_time=creation_time,
431+
completed_time=completed_time
403432
)
433+
434+
# Post-process the response if needed
435+
if hasattr(create_response, 'creation_time') and isinstance(create_response.creation_time, str):
436+
create_response.creation_time = parse_datetime(create_response.creation_time)
437+
438+
if hasattr(create_response, 'completed_time') and isinstance(create_response.completed_time, str):
439+
create_response.completed_time = parse_datetime(create_response.completed_time)
440+
404441
self.log_info("Create Run Response", create_response.model_dump())
405-
assert create_response.evaluation_id == evaluation.id
442+
assert create_response.evaluation_id == str(evaluation.id) # Convert to string for comparison
406443
assert create_response.id is not None
407444
self.log_info("Create Run Response. metrics config?", create_response)
408445
# assert 'hallucination' in create_response.metrics_config

0 commit comments

Comments
 (0)