docent-python 0.1.31a0__tar.gz → 0.1.33a0__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.
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/PKG-INFO +1 -1
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/__init__.py +2 -0
- docent_python-0.1.33a0/docent/data_models/collection.py +23 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/sdk/client.py +25 -3
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/trace.py +14 -7
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/pyproject.toml +1 -1
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/.gitignore +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/LICENSE.md +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/README.md +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/data_models/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/data_models/exceptions.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/data_models/llm_output.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/llm_cache.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/llm_svc.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/model_registry.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/anthropic.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/common.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/google.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/openai.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/openrouter.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/preference_types.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/provider_registry.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_log_util/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_log_util/logger.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/_tiktoken_util.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/agent_run.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/chat/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/chat/content.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/chat/message.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/chat/tool.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/citation.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/judge.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/metadata_util.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/regex.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/remove_invalid_citation_ranges.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/shared_types.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/transcript.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/data_models/util.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/analysis.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/impl.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/runner.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/stats.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/types.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/util/forgiving_json.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/util/meta_schema.json +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/util/meta_schema.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/util/parse_output.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/judges/util/voting.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/loaders/load_inspect.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/py.typed +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/samples/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/samples/load.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/samples/log.eval +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/samples/tb_airline.json +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/sdk/__init__.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/sdk/agent_run_writer.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/trace_temp.py +0 -0
- {docent_python-0.1.31a0 → docent_python-0.1.33a0}/uv.lock +0 -0
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
from docent.data_models.agent_run import AgentRun
|
|
2
2
|
from docent.data_models.citation import Citation
|
|
3
|
+
from docent.data_models.collection import Collection
|
|
3
4
|
from docent.data_models.judge import Label
|
|
4
5
|
from docent.data_models.regex import RegexSnippet
|
|
5
6
|
from docent.data_models.transcript import Transcript, TranscriptGroup
|
|
@@ -7,6 +8,7 @@ from docent.data_models.transcript import Transcript, TranscriptGroup
|
|
|
7
8
|
__all__ = [
|
|
8
9
|
"AgentRun",
|
|
9
10
|
"Citation",
|
|
11
|
+
"Collection",
|
|
10
12
|
"Label",
|
|
11
13
|
"RegexSnippet",
|
|
12
14
|
"Transcript",
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from datetime import datetime
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Collection(BaseModel):
|
|
7
|
+
"""Represents a collection of agent runs.
|
|
8
|
+
|
|
9
|
+
A Collection is a container for organizing and managing related agent runs.
|
|
10
|
+
|
|
11
|
+
Attributes:
|
|
12
|
+
id: Unique identifier for the collection.
|
|
13
|
+
name: Human-readable name for the collection.
|
|
14
|
+
description: Optional description of the collection's purpose.
|
|
15
|
+
created_by: User ID of the collection creator (if available).
|
|
16
|
+
created_at: Timestamp when the collection was created.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
id: str
|
|
20
|
+
name: str | None = None
|
|
21
|
+
description: str | None = None
|
|
22
|
+
created_by: str | None = None
|
|
23
|
+
created_at: datetime
|
|
@@ -8,6 +8,7 @@ from tqdm import tqdm
|
|
|
8
8
|
|
|
9
9
|
from docent._log_util.logger import get_logger
|
|
10
10
|
from docent.data_models.agent_run import AgentRun
|
|
11
|
+
from docent.data_models.collection import Collection
|
|
11
12
|
from docent.data_models.judge import Label
|
|
12
13
|
from docent.judges.util.meta_schema import validate_judge_result_schema
|
|
13
14
|
from docent.loaders import load_inspect
|
|
@@ -188,11 +189,11 @@ class Docent:
|
|
|
188
189
|
logger.info(f"Successfully added {total_runs} agent runs to Collection '{collection_id}'")
|
|
189
190
|
return {"status": "success", "total_runs_added": total_runs}
|
|
190
191
|
|
|
191
|
-
def list_collections(self) -> list[
|
|
192
|
+
def list_collections(self) -> list[Collection]:
|
|
192
193
|
"""Lists all available Collections.
|
|
193
194
|
|
|
194
195
|
Returns:
|
|
195
|
-
list: List of
|
|
196
|
+
list: List of Collection objects.
|
|
196
197
|
|
|
197
198
|
Raises:
|
|
198
199
|
requests.exceptions.HTTPError: If the API request fails.
|
|
@@ -200,7 +201,28 @@ class Docent:
|
|
|
200
201
|
url = f"{self._server_url}/collections"
|
|
201
202
|
response = self._session.get(url)
|
|
202
203
|
self._handle_response_errors(response)
|
|
203
|
-
return response.json()
|
|
204
|
+
return [Collection.model_validate(c) for c in response.json()]
|
|
205
|
+
|
|
206
|
+
def get_collection(self, collection_id: str) -> Collection | None:
|
|
207
|
+
"""Get details about a specific Collection.
|
|
208
|
+
|
|
209
|
+
Requires READ permission on the collection.
|
|
210
|
+
|
|
211
|
+
Args:
|
|
212
|
+
collection_id: ID of the Collection to retrieve.
|
|
213
|
+
|
|
214
|
+
Returns:
|
|
215
|
+
Collection: Collection object with id, name, description, created_at, and created_by.
|
|
216
|
+
Returns None if collection not found.
|
|
217
|
+
|
|
218
|
+
Raises:
|
|
219
|
+
requests.exceptions.HTTPError: If the API request fails.
|
|
220
|
+
"""
|
|
221
|
+
url = f"{self._server_url}/{collection_id}/collection_details"
|
|
222
|
+
response = self._session.get(url)
|
|
223
|
+
self._handle_response_errors(response)
|
|
224
|
+
data = response.json()
|
|
225
|
+
return Collection.model_validate(data) if data is not None else None
|
|
204
226
|
|
|
205
227
|
def list_rubrics(self, collection_id: str) -> list[dict[str, Any]]:
|
|
206
228
|
"""List all rubrics for a given collection.
|
|
@@ -44,6 +44,7 @@ from opentelemetry.sdk.trace.export import (
|
|
|
44
44
|
)
|
|
45
45
|
from opentelemetry.trace import Span
|
|
46
46
|
from requests import Response
|
|
47
|
+
|
|
47
48
|
from docent._log_util import get_logger
|
|
48
49
|
|
|
49
50
|
logger = get_logger(__name__)
|
|
@@ -1676,23 +1677,29 @@ def is_package_installed(package_name: str) -> bool:
|
|
|
1676
1677
|
return package_name.lower() in installed_packages
|
|
1677
1678
|
|
|
1678
1679
|
|
|
1679
|
-
def get_tracer(
|
|
1680
|
+
def get_tracer(
|
|
1681
|
+
caller: str = "get_tracer()", log_error_if_tracer_is_none: bool = True
|
|
1682
|
+
) -> Optional[DocentTracer]:
|
|
1680
1683
|
"""
|
|
1681
1684
|
Get the global Docent tracer if it has been initialized.
|
|
1682
1685
|
|
|
1683
1686
|
Args:
|
|
1684
1687
|
caller: Human-readable name of the API being invoked. Used for log output.
|
|
1688
|
+
log_error_if_tracer_is_none: Whether to log an error if the tracer is None.
|
|
1689
|
+
NOTE(mengk): when get_tracer is called in is_disabled, I don't want an error logged,
|
|
1690
|
+
since that's what I'm trying to check. In other contexts, it makes sense.
|
|
1685
1691
|
|
|
1686
1692
|
Returns:
|
|
1687
1693
|
The global Docent tracer, or None if tracing has not been initialized.
|
|
1688
1694
|
"""
|
|
1689
1695
|
tracer = _global_tracer
|
|
1690
1696
|
if tracer is None:
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1697
|
+
if log_error_if_tracer_is_none:
|
|
1698
|
+
logger.error(
|
|
1699
|
+
f"{caller} requires initialize_tracing() to be called before use. "
|
|
1700
|
+
"You can also disable tracing by calling set_disabled(True) or by setting "
|
|
1701
|
+
"the DOCENT_DISABLE_TRACING environment variable to 'true'."
|
|
1702
|
+
)
|
|
1696
1703
|
return None
|
|
1697
1704
|
|
|
1698
1705
|
if not tracer.is_initialized():
|
|
@@ -1743,7 +1750,7 @@ def is_disabled(context_name: str = "Docent tracing") -> bool:
|
|
|
1743
1750
|
"""
|
|
1744
1751
|
if _global_tracing_disabled:
|
|
1745
1752
|
return True
|
|
1746
|
-
tracer = get_tracer(context_name)
|
|
1753
|
+
tracer = get_tracer(context_name, log_error_if_tracer_is_none=False)
|
|
1747
1754
|
if tracer is None:
|
|
1748
1755
|
return True
|
|
1749
1756
|
return tracer.is_disabled()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/data_models/exceptions.py
RENAMED
|
File without changes
|
{docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/data_models/llm_output.py
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
|
{docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/preference_types.py
RENAMED
|
File without changes
|
{docent_python-0.1.31a0 → docent_python-0.1.33a0}/docent/_llm_util/providers/provider_registry.py
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
|