logfire-api 4.31.2__tar.gz → 4.32.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.
- {logfire_api-4.31.2 → logfire_api-4.32.1}/PKG-INFO +1 -1
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/experimental/api_client.pyi +126 -33
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/experimental/query_client.pyi +0 -1
- {logfire_api-4.31.2 → logfire_api-4.32.1}/pyproject.toml +1 -1
- {logfire_api-4.31.2 → logfire_api-4.32.1}/.gitignore +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/README.md +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/__init__.py +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/ast_utils.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/async_.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/auth.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/auto_trace/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/auto_trace/import_hook.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/auto_trace/rewrite_ast.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/auto_trace/types.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/baggage.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/cli/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/cli/auth.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/cli/prompt.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/cli/run.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/cli.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/client.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/collect_system_info.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/config.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/config_params.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/constants.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/db_statement_summary.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/console.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/dynamic_batch.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/logs.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/otlp.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/processor_wrapper.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/quiet_metrics.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/remove_pending.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/tail_sampling.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/wrapper.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/formatter.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/instrument.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/aiohttp_client.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/aiohttp_server.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/asgi.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/asyncpg.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/aws_lambda.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/celery.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/claude_agent_sdk.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/django.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/dspy.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/executors.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/fastapi.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/flask.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/google_genai.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/httpx.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/litellm.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/mcp.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/mysql.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/openai_agents.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/print.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/psycopg.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/pydantic_ai.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/pymongo.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/pytest.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/redis.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/requests.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/sqlalchemy.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/sqlite3.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/starlette.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/surrealdb.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/system_metrics.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/wsgi.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/json_encoder.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/json_formatter.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/json_schema.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/json_types.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/logs.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/main.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/metrics.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/scrubbing.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/stack_info.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/tracer.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/ulid.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/utils.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/cli.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/db_api.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/exceptions.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/experimental/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/experimental/annotations.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/experimental/datasets/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/experimental/forwarding.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/aiohttp_client.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/flask.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/httpx.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/logging.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/loguru.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/psycopg.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/pydantic.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/redis.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/sqlalchemy.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/structlog.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/integrations/wsgi.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/propagate.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/py.typed +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/query_client.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/sampling/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/sampling/_tail_sampling.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/types.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/variables/__init__.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/variables/abstract.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/variables/config.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/variables/local.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/variables/remote.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/variables/variable.pyi +0 -0
- {logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/version.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: logfire-api
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.32.1
|
|
4
4
|
Summary: Shim for the Logfire SDK which does nothing unless Logfire is installed
|
|
5
5
|
Author-email: Pydantic Team <engineering@pydantic.dev>, Samuel Colvin <samuel@pydantic.dev>, Hasan Ramezani <hasan@pydantic.dev>, Adrian Garcia Badaracco <adrian@pydantic.dev>, David Montague <david@pydantic.dev>, Marcelo Trylesinski <marcelo@pydantic.dev>, David Hewitt <david.hewitt@pydantic.dev>, Alex Hall <alex@pydantic.dev>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -6,7 +6,7 @@ from logfire._internal.config import get_base_url_from_token as get_base_url_fro
|
|
|
6
6
|
from pydantic_evals import Case, Dataset
|
|
7
7
|
from pydantic_evals.evaluators import Evaluator
|
|
8
8
|
from types import TracebackType
|
|
9
|
-
from typing import Any, Generic, TypeVar, overload
|
|
9
|
+
from typing import Any, Generic, Literal, TypeVar, overload
|
|
10
10
|
from typing_extensions import Self
|
|
11
11
|
|
|
12
12
|
Case = Any
|
|
@@ -42,8 +42,9 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
42
42
|
Example usage:
|
|
43
43
|
```python skip-run="true" skip-reason="external-connection"
|
|
44
44
|
from dataclasses import dataclass
|
|
45
|
+
from pydantic_evals import Case, Dataset
|
|
46
|
+
|
|
45
47
|
from logfire.experimental.api_client import LogfireAPIClient
|
|
46
|
-
from pydantic_evals import Case
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
@dataclass
|
|
@@ -56,21 +57,17 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
56
57
|
answer: str
|
|
57
58
|
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
name=\'
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
)
|
|
60
|
+
local_dataset = Dataset[MyInput, MyOutput, None](
|
|
61
|
+
name=\'qa-dataset\',
|
|
62
|
+
cases=[
|
|
63
|
+
Case(name=\'q1\', inputs=MyInput(\'Hello?\'), expected_output=MyOutput(\'Hi!\')),
|
|
64
|
+
],
|
|
65
|
+
)
|
|
66
66
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
Case(name=\'q1\', inputs=MyInput(\'Hello?\'), expected_output=MyOutput(\'Hi!\')),
|
|
72
|
-
],
|
|
73
|
-
)
|
|
67
|
+
|
|
68
|
+
with LogfireAPIClient(api_key=\'your-api-key\') as client:
|
|
69
|
+
# Publish the local dataset to hosted
|
|
70
|
+
client.push_dataset(local_dataset)
|
|
74
71
|
|
|
75
72
|
# Get as pydantic-evals Dataset
|
|
76
73
|
dataset = client.get_dataset(\'qa-dataset\', MyInput, MyOutput)
|
|
@@ -93,7 +90,7 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
93
90
|
Returns:
|
|
94
91
|
List of dataset summaries with id, name, description, case_count, etc.
|
|
95
92
|
"""
|
|
96
|
-
def create_dataset(self, name: str, *, input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None = None
|
|
93
|
+
def create_dataset(self, name: str, *, input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None = None) -> dict[str, Any]:
|
|
97
94
|
'''Create a new dataset with optional type schemas.
|
|
98
95
|
|
|
99
96
|
Args:
|
|
@@ -102,8 +99,6 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
102
99
|
output_type: Type for expected outputs. JSON schema will be generated from this type.
|
|
103
100
|
metadata_type: Type for case metadata. JSON schema will be generated from this type.
|
|
104
101
|
description: Optional description of the dataset.
|
|
105
|
-
guidance: Instructions for AI-assisted population.
|
|
106
|
-
ai_managed_guidance: Whether guidance is managed by AI.
|
|
107
102
|
|
|
108
103
|
Returns:
|
|
109
104
|
The created dataset.
|
|
@@ -130,7 +125,7 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
130
125
|
)
|
|
131
126
|
```
|
|
132
127
|
'''
|
|
133
|
-
def update_dataset(self, id_or_name: str, *, name: str = ..., input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None =
|
|
128
|
+
def update_dataset(self, id_or_name: str, *, name: str = ..., input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None = ...) -> dict[str, Any]:
|
|
134
129
|
"""Update an existing dataset.
|
|
135
130
|
|
|
136
131
|
Args:
|
|
@@ -140,8 +135,6 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
140
135
|
output_type: New output type (generates schema).
|
|
141
136
|
metadata_type: New metadata type (generates schema).
|
|
142
137
|
description: New description. Pass None to clear.
|
|
143
|
-
guidance: New guidance instructions. Pass None to clear.
|
|
144
|
-
ai_managed_guidance: Whether guidance is managed by AI.
|
|
145
138
|
|
|
146
139
|
Returns:
|
|
147
140
|
The updated dataset.
|
|
@@ -158,12 +151,11 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
158
151
|
Raises:
|
|
159
152
|
DatasetNotFoundError: If the dataset does not exist.
|
|
160
153
|
"""
|
|
161
|
-
def list_cases(self, dataset_id_or_name: str
|
|
154
|
+
def list_cases(self, dataset_id_or_name: str) -> list[dict[str, Any]]:
|
|
162
155
|
"""List all cases in a dataset.
|
|
163
156
|
|
|
164
157
|
Args:
|
|
165
158
|
dataset_id_or_name: The dataset ID (UUID) or name.
|
|
166
|
-
tags: Optional list of tags to filter cases by.
|
|
167
159
|
|
|
168
160
|
Returns:
|
|
169
161
|
List of cases with full details.
|
|
@@ -185,7 +177,79 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
185
177
|
DatasetNotFoundError: If the dataset does not exist.
|
|
186
178
|
CaseNotFoundError: If the case does not exist.
|
|
187
179
|
"""
|
|
188
|
-
def
|
|
180
|
+
def push_dataset(self, dataset: Dataset[InputsT, OutputT, MetadataT], *, name: str | None = None, description: str | None = ..., on_case_conflict: Literal['update', 'error'] = 'update') -> dict[str, Any]:
|
|
181
|
+
'''Publish a local `pydantic_evals.Dataset` to the hosted datasets API.
|
|
182
|
+
|
|
183
|
+
This is the high-level "push my dataset to hosted" helper. It creates a
|
|
184
|
+
hosted dataset when one does not exist yet, updates the hosted dataset
|
|
185
|
+
when one already exists with the same name, uploads all local cases
|
|
186
|
+
through the existing import/upsert API, and finally returns hosted
|
|
187
|
+
dataset metadata.
|
|
188
|
+
|
|
189
|
+
The JSON schemas for inputs, expected outputs, and metadata are
|
|
190
|
+
inferred from the `Dataset[InputsT, OutputT, MetadataT]` generic
|
|
191
|
+
parameters of the dataset you pass in — instantiate your local dataset
|
|
192
|
+
with the types you want hosted.
|
|
193
|
+
|
|
194
|
+
Args:
|
|
195
|
+
dataset: The local `pydantic_evals.Dataset` to publish. Case-level
|
|
196
|
+
evaluators are uploaded with their cases. Dataset-level
|
|
197
|
+
`evaluators` and `report_evaluators` are not supported yet and
|
|
198
|
+
will raise `ValueError`.
|
|
199
|
+
name: Optional hosted dataset name override. Defaults to
|
|
200
|
+
`dataset.name`.
|
|
201
|
+
description: Hosted dataset description. Omit this argument to leave
|
|
202
|
+
the existing description unchanged when updating an existing
|
|
203
|
+
dataset. Pass `None` to clear the description on update. On
|
|
204
|
+
initial create, `None` means no description is set.
|
|
205
|
+
on_case_conflict: Conflict behavior for uploaded cases. The default
|
|
206
|
+
`\'update\'` makes repeated pushes idempotent for named cases.
|
|
207
|
+
Pass `\'error\'` to fail instead of updating an existing case with
|
|
208
|
+
the same name.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
Hosted dataset metadata as returned by
|
|
212
|
+
`get_dataset(..., include_cases=False)`.
|
|
213
|
+
|
|
214
|
+
Raises:
|
|
215
|
+
ValueError: If neither `dataset.name` nor `name` is provided, or if
|
|
216
|
+
the dataset contains unsupported dataset-level evaluators.
|
|
217
|
+
DatasetApiError: If the API returns an error other than the expected
|
|
218
|
+
`409` conflict used to trigger an update flow.
|
|
219
|
+
DatasetNotFoundError: If the hosted dataset cannot be fetched after
|
|
220
|
+
the push completes.
|
|
221
|
+
|
|
222
|
+
Example:
|
|
223
|
+
```python skip-run="true" skip-reason="external-connection"
|
|
224
|
+
from dataclasses import dataclass
|
|
225
|
+
|
|
226
|
+
from pydantic_evals import Case, Dataset
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
@dataclass
|
|
230
|
+
class MyInput:
|
|
231
|
+
question: str
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
@dataclass
|
|
235
|
+
class MyOutput:
|
|
236
|
+
answer: str
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
local_dataset = Dataset[MyInput, MyOutput, None](
|
|
240
|
+
name=\'qa-dataset\',
|
|
241
|
+
cases=[
|
|
242
|
+
Case(name=\'q1\', inputs=MyInput(\'Hello?\'), expected_output=MyOutput(\'Hi!\')),
|
|
243
|
+
],
|
|
244
|
+
)
|
|
245
|
+
|
|
246
|
+
dataset_info = client.push_dataset(
|
|
247
|
+
local_dataset,
|
|
248
|
+
description=\'Golden test cases for the Q&A task\',
|
|
249
|
+
)
|
|
250
|
+
```
|
|
251
|
+
'''
|
|
252
|
+
def add_cases(self, dataset_id_or_name: str, cases: Sequence[Case[InputsT, OutputT, MetadataT]] | Sequence[dict[str, Any]], *, on_conflict: str = 'update') -> list[dict[str, Any]]:
|
|
189
253
|
'''Add cases to a dataset.
|
|
190
254
|
|
|
191
255
|
Accepts either pydantic-evals Case objects or plain dicts.
|
|
@@ -197,7 +261,6 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
197
261
|
Args:
|
|
198
262
|
dataset_id_or_name: The dataset ID (UUID) or name.
|
|
199
263
|
cases: A sequence of pydantic-evals Case objects or dicts.
|
|
200
|
-
tags: Optional list of tags to associate with all cases.
|
|
201
264
|
on_conflict: Conflict resolution strategy: `\'update\'` (default) to
|
|
202
265
|
upsert cases with matching names, or `\'error\'` to fail on conflicts.
|
|
203
266
|
|
|
@@ -220,7 +283,7 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
220
283
|
)
|
|
221
284
|
```
|
|
222
285
|
'''
|
|
223
|
-
def update_case(self, dataset_id_or_name: str, case_id: str, *, name: str | None = ..., inputs: Any | None = None, expected_output: Any | None = ..., metadata: Any | None = ..., evaluators: Sequence[Evaluator[Any, Any, Any]] | None =
|
|
286
|
+
def update_case(self, dataset_id_or_name: str, case_id: str, *, name: str | None = ..., inputs: Any | None = None, expected_output: Any | None = ..., metadata: Any | None = ..., evaluators: Sequence[Evaluator[Any, Any, Any]] | None = ...) -> dict[str, Any]:
|
|
224
287
|
"""Update an existing case.
|
|
225
288
|
|
|
226
289
|
Args:
|
|
@@ -231,7 +294,6 @@ class LogfireAPIClient(_BaseLogfireAPIClient[Client]):
|
|
|
231
294
|
expected_output: New expected output (dict or typed object). Pass None to clear.
|
|
232
295
|
metadata: New metadata (dict or typed object). Pass None to clear.
|
|
233
296
|
evaluators: New evaluators. Pass None to clear.
|
|
234
|
-
tags: New tags for the case. Pass None to clear.
|
|
235
297
|
|
|
236
298
|
Returns:
|
|
237
299
|
The updated case.
|
|
@@ -266,17 +328,48 @@ class AsyncLogfireAPIClient(_BaseLogfireAPIClient[AsyncClient]):
|
|
|
266
328
|
async def __aexit__(self, exc_type: type[BaseException] | None = None, exc_value: BaseException | None = None, traceback: TracebackType | None = None) -> None: ...
|
|
267
329
|
async def list_datasets(self) -> list[dict[str, Any]]:
|
|
268
330
|
"""List all datasets."""
|
|
269
|
-
async def create_dataset(self, name: str, *, input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None = None
|
|
331
|
+
async def create_dataset(self, name: str, *, input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None = None) -> dict[str, Any]:
|
|
270
332
|
"""Create a new dataset."""
|
|
271
|
-
async def update_dataset(self, id_or_name: str, *, name: str = ..., input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None =
|
|
333
|
+
async def update_dataset(self, id_or_name: str, *, name: str = ..., input_type: type[Any] | None = None, output_type: type[Any] | None = None, metadata_type: type[Any] | None = None, description: str | None = ...) -> dict[str, Any]:
|
|
272
334
|
"""Update an existing dataset."""
|
|
273
335
|
async def delete_dataset(self, id_or_name: str) -> None:
|
|
274
336
|
"""Delete a dataset."""
|
|
275
|
-
async def list_cases(self, dataset_id_or_name: str
|
|
337
|
+
async def list_cases(self, dataset_id_or_name: str) -> list[dict[str, Any]]:
|
|
276
338
|
"""List all cases in a dataset."""
|
|
277
339
|
async def get_case(self, dataset_id_or_name: str, case_id: str) -> dict[str, Any]:
|
|
278
340
|
"""Get a specific case from a dataset."""
|
|
279
|
-
async def
|
|
341
|
+
async def push_dataset(self, dataset: Dataset[InputsT, OutputT, MetadataT], *, name: str | None = None, description: str | None = ..., on_case_conflict: Literal['update', 'error'] = 'update') -> dict[str, Any]:
|
|
342
|
+
"""Async version of `LogfireAPIClient.push_dataset`.
|
|
343
|
+
|
|
344
|
+
Args:
|
|
345
|
+
dataset: The local `pydantic_evals.Dataset` to publish. Case-level
|
|
346
|
+
evaluators are uploaded with their cases. Dataset-level
|
|
347
|
+
`evaluators` and `report_evaluators` are not supported yet and
|
|
348
|
+
will raise `ValueError`.
|
|
349
|
+
name: Optional hosted dataset name override. Defaults to
|
|
350
|
+
`dataset.name`.
|
|
351
|
+
description: Hosted dataset description. Omit this argument to leave
|
|
352
|
+
the existing description unchanged when updating an existing
|
|
353
|
+
dataset. Pass `None` to clear the description on update. On
|
|
354
|
+
initial create, `None` means no description is set.
|
|
355
|
+
on_case_conflict: Conflict behavior for uploaded cases. The default
|
|
356
|
+
`'update'` makes repeated pushes idempotent for named cases.
|
|
357
|
+
Pass `'error'` to fail instead of updating an existing case with
|
|
358
|
+
the same name.
|
|
359
|
+
|
|
360
|
+
Returns:
|
|
361
|
+
Hosted dataset metadata as returned by
|
|
362
|
+
`get_dataset(..., include_cases=False)`.
|
|
363
|
+
|
|
364
|
+
Raises:
|
|
365
|
+
ValueError: If neither `dataset.name` nor `name` is provided, or if
|
|
366
|
+
the dataset contains unsupported dataset-level evaluators.
|
|
367
|
+
DatasetApiError: If the API returns an error other than the expected
|
|
368
|
+
`409` conflict used to trigger an update flow.
|
|
369
|
+
DatasetNotFoundError: If the hosted dataset cannot be fetched after
|
|
370
|
+
the push completes.
|
|
371
|
+
"""
|
|
372
|
+
async def add_cases(self, dataset_id_or_name: str, cases: Sequence[Case[InputsT, OutputT, MetadataT]] | Sequence[dict[str, Any]], *, on_conflict: str = 'update') -> list[dict[str, Any]]:
|
|
280
373
|
"""Add cases to a dataset.
|
|
281
374
|
|
|
282
375
|
Accepts either pydantic-evals Case objects or plain dicts.
|
|
@@ -285,7 +378,7 @@ class AsyncLogfireAPIClient(_BaseLogfireAPIClient[AsyncClient]):
|
|
|
285
378
|
case in the dataset are updated; cases without a name or with a new name
|
|
286
379
|
are created. Set `on_conflict='error'` to fail on name conflicts instead.
|
|
287
380
|
"""
|
|
288
|
-
async def update_case(self, dataset_id_or_name: str, case_id: str, *, name: str | None = ..., inputs: Any | None = None, expected_output: Any | None = ..., metadata: Any | None = ..., evaluators: Sequence[Evaluator[Any, Any, Any]] | None =
|
|
381
|
+
async def update_case(self, dataset_id_or_name: str, case_id: str, *, name: str | None = ..., inputs: Any | None = None, expected_output: Any | None = ..., metadata: Any | None = ..., evaluators: Sequence[Evaluator[Any, Any, Any]] | None = ...) -> dict[str, Any]:
|
|
289
382
|
"""Update an existing case."""
|
|
290
383
|
async def delete_case(self, dataset_id_or_name: str, case_id: str) -> None:
|
|
291
384
|
"""Delete a case from a dataset."""
|
|
@@ -48,7 +48,6 @@ class _BaseLogfireQueryClient(Generic[T]):
|
|
|
48
48
|
timeout: Incomplete
|
|
49
49
|
client: T
|
|
50
50
|
def __init__(self, base_url: str, read_token: str, timeout: Timeout, client: type[T], **client_kwargs: Any) -> None: ...
|
|
51
|
-
def build_query_params(self, sql: str, min_timestamp: datetime | None = None, max_timestamp: datetime | None = None, limit: int | None = None, row_oriented: bool = False) -> dict[str, str]: ...
|
|
52
51
|
def handle_response_errors(self, response: Response) -> None: ...
|
|
53
52
|
|
|
54
53
|
class LogfireQueryClient(_BaseLogfireQueryClient[Client]):
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "logfire-api"
|
|
7
|
-
version = "4.
|
|
7
|
+
version = "4.32.1"
|
|
8
8
|
description = "Shim for the Logfire SDK which does nothing unless Logfire is installed"
|
|
9
9
|
authors = [
|
|
10
10
|
{ name = "Pydantic Team", email = "engineering@pydantic.dev" },
|
|
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
|
|
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
|
|
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
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/processor_wrapper.pyi
RENAMED
|
File without changes
|
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/exporters/remove_pending.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/aiohttp_client.pyi
RENAMED
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/aiohttp_server.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/claude_agent_sdk.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/google_genai.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/openai_agents.pyi
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/pydantic_ai.pyi
RENAMED
|
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
|
{logfire_api-4.31.2 → logfire_api-4.32.1}/logfire_api/_internal/integrations/system_metrics.pyi
RENAMED
|
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
|
|
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
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|