Skip to content

Updated versions of underlying dependencies #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 28, 2025
Merged
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 aimon/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "aimon"
__version__ = "0.10.0"
__version__ = "0.10.1"
22 changes: 11 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,21 @@
name='aimon',
python_requires='>3.8.0',
packages=find_packages(),
version="0.10.0",
version="0.10.1",
install_requires=[
"annotated-types==0.6.0",
"anyio==4.4.0",
"certifi==2024.7.4",
"distro==1.8.0",
"anyio==4.9.0",
"certifi==2025.4.26",
"distro==1.9.0",
"exceptiongroup==1.2.2",
"h11==0.14.0",
"httpcore==1.0.2",
"h11==0.16.0",
"httpcore==1.0.9",
"httpx==0.28.1",
"idna==3.4",
"pydantic==2.10.3",
"pydantic-core==2.27.1",
"sniffio==1.3.0",
"typing-extensions==4.12.2"
"idna==3.10",
"pydantic==2.11.3",
"pydantic-core==2.33.1",
"sniffio==1.3.1",
"typing-extensions==4.13.2"
],
author='AIMon',
author_email='info@aimon.ai',
Expand Down
49 changes: 43 additions & 6 deletions tests/test_low_level_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,29 @@
import logging
import json
import time
from datetime import datetime
from aimon import Client, APIStatusError

def parse_datetime(dt_str):
"""Parse datetime string in various formats to ensure compatibility with Pydantic."""
if not dt_str or not isinstance(dt_str, str):
return dt_str
try:
# Try to parse RFC 1123 format (e.g., 'Mon, 28 Apr 2025 19:40:50 GMT')
formats = [
'%a, %d %b %Y %H:%M:%S GMT', # RFC 1123 format
'%Y-%m-%dT%H:%M:%S.%fZ', # ISO 8601 format
'%Y-%m-%dT%H:%M:%SZ', # ISO 8601 without microseconds
]
for fmt in formats:
try:
return datetime.strptime(dt_str, fmt)
except ValueError:
continue
return dt_str # Return original if parsing fails
except Exception:
return dt_str # Return original on any error

class TestLowLevelAPIWithRealService:
"""Test the low-level API client functions with the real AIMon service."""

Expand Down Expand Up @@ -386,9 +407,9 @@ def test_evaluation_run_create(self):
collection = self.client.datasets.collection.create(name=self.collection_name, dataset_ids=[dataset.sha], description=f"Prereq collection {self.timestamp}")
evaluation = self.client.evaluations.create(
name=self.evaluation_name,
application_id=app.id,
model_id=model.id,
dataset_collection_id=collection.id
application_id=str(app.id), # Convert to string to avoid Pydantic warnings
model_id=str(model.id), # Convert to string to avoid Pydantic warnings
dataset_collection_id=str(collection.id) # Convert to string to avoid Pydantic warnings
)
self.log_info("Prerequisites created", {"evaluation": evaluation.id})
except Exception as e:
Expand All @@ -397,12 +418,28 @@ def test_evaluation_run_create(self):
# Create Evaluation Run
try:
metrics_config = {'hallucination': {'detector_name': 'default'}, 'toxicity': {'detector_name': 'default'}}

# Handle creation_time and completed_time if they come as string responses
creation_time = None
completed_time = None

# When creating an evaluation run, use the helper to handle date strings
create_response = self.client.evaluations.run.create(
evaluation_id=evaluation.id,
metrics_config=metrics_config
evaluation_id=str(evaluation.id), # Convert to string to avoid Pydantic warnings
metrics_config=metrics_config,
creation_time=creation_time,
completed_time=completed_time
)

# Post-process the response if needed
if hasattr(create_response, 'creation_time') and isinstance(create_response.creation_time, str):
create_response.creation_time = parse_datetime(create_response.creation_time)

if hasattr(create_response, 'completed_time') and isinstance(create_response.completed_time, str):
create_response.completed_time = parse_datetime(create_response.completed_time)

self.log_info("Create Run Response", create_response.model_dump())
assert create_response.evaluation_id == evaluation.id
assert create_response.evaluation_id == str(evaluation.id) # Convert to string for comparison
assert create_response.id is not None
self.log_info("Create Run Response. metrics config?", create_response)
# assert 'hallucination' in create_response.metrics_config
Expand Down