docent-python 0.1.27a0__tar.gz → 0.1.29a0__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.27a0 → docent_python-0.1.29a0}/PKG-INFO +1 -1
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/sdk/client.py +32 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/trace.py +60 -49
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/pyproject.toml +1 -1
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/.gitignore +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/LICENSE.md +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/README.md +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/data_models/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/data_models/exceptions.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/data_models/llm_output.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/llm_cache.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/llm_svc.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/model_registry.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/anthropic.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/common.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/google.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/openai.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/openrouter.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/preference_types.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/provider_registry.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_log_util/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_log_util/logger.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/_tiktoken_util.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/agent_run.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/chat/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/chat/content.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/chat/message.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/chat/tool.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/citation.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/judge.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/metadata_util.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/regex.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/remove_invalid_citation_ranges.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/shared_types.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/transcript.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/data_models/util.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/analysis.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/impl.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/runner.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/stats.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/types.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/util/forgiving_json.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/util/meta_schema.json +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/util/meta_schema.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/util/parse_output.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/judges/util/voting.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/loaders/load_inspect.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/py.typed +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/samples/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/samples/load.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/samples/log.eval +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/samples/tb_airline.json +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/sdk/__init__.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/sdk/agent_run_writer.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/trace_temp.py +0 -0
- {docent_python-0.1.27a0 → docent_python-0.1.29a0}/uv.lock +0 -0
|
@@ -450,6 +450,38 @@ class Docent:
|
|
|
450
450
|
logger.info(f"Successfully shared Collection '{collection_id}' with {email}")
|
|
451
451
|
return response.json()
|
|
452
452
|
|
|
453
|
+
def collection_exists(self, collection_id: str) -> bool:
|
|
454
|
+
"""Check if a collection exists without raising if it does not."""
|
|
455
|
+
url = f"{self._server_url}/{collection_id}/exists"
|
|
456
|
+
response = self._session.get(url)
|
|
457
|
+
self._handle_response_errors(response)
|
|
458
|
+
return bool(response.json())
|
|
459
|
+
|
|
460
|
+
def has_collection_permission(self, collection_id: str, permission: str = "write") -> bool:
|
|
461
|
+
"""Check whether the authenticated user has a specific permission on a collection.
|
|
462
|
+
|
|
463
|
+
Args:
|
|
464
|
+
collection_id: Collection to check.
|
|
465
|
+
permission: Permission level to verify (`read`, `write`, or `admin`).
|
|
466
|
+
|
|
467
|
+
Returns:
|
|
468
|
+
bool: True if the current API key has the requested permission; otherwise False.
|
|
469
|
+
|
|
470
|
+
Raises:
|
|
471
|
+
ValueError: If an unsupported permission value is provided.
|
|
472
|
+
requests.exceptions.HTTPError: If the API request fails.
|
|
473
|
+
"""
|
|
474
|
+
valid_permissions = {"read", "write", "admin"}
|
|
475
|
+
if permission not in valid_permissions:
|
|
476
|
+
raise ValueError(f"permission must be one of {sorted(valid_permissions)}")
|
|
477
|
+
|
|
478
|
+
url = f"{self._server_url}/{collection_id}/has_permission"
|
|
479
|
+
response = self._session.get(url, params={"permission": permission})
|
|
480
|
+
self._handle_response_errors(response)
|
|
481
|
+
|
|
482
|
+
payload = response.json()
|
|
483
|
+
return bool(payload.get("has_permission", False))
|
|
484
|
+
|
|
453
485
|
def get_dql_schema(self, collection_id: str) -> dict[str, Any]:
|
|
454
486
|
"""Retrieve the DQL schema for a collection.
|
|
455
487
|
|
|
@@ -56,6 +56,27 @@ DISABLED_TRANSCRIPT_ID = "disabled"
|
|
|
56
56
|
DISABLED_TRANSCRIPT_GROUP_ID = "disabled"
|
|
57
57
|
|
|
58
58
|
|
|
59
|
+
def _get_disabled_agent_run_id(agent_run_id: Optional[str]) -> str:
|
|
60
|
+
"""Return sentinel value for agent run ID when tracing is disabled."""
|
|
61
|
+
if agent_run_id is None:
|
|
62
|
+
return DISABLED_AGENT_RUN_ID
|
|
63
|
+
return agent_run_id
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def _get_disabled_transcript_id(transcript_id: Optional[str]) -> str:
|
|
67
|
+
"""Return sentinel value for transcript ID when tracing is disabled."""
|
|
68
|
+
if transcript_id is None:
|
|
69
|
+
return DISABLED_TRANSCRIPT_ID
|
|
70
|
+
return transcript_id
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def _get_disabled_transcript_group_id(transcript_group_id: Optional[str]) -> str:
|
|
74
|
+
"""Return sentinel value for transcript group ID when tracing is disabled."""
|
|
75
|
+
if transcript_group_id is None:
|
|
76
|
+
return DISABLED_TRANSCRIPT_GROUP_ID
|
|
77
|
+
return transcript_group_id
|
|
78
|
+
|
|
79
|
+
|
|
59
80
|
class DocentTelemetryRequestError(RuntimeError):
|
|
60
81
|
"""Raised when the Docent telemetry backend rejects a client request."""
|
|
61
82
|
|
|
@@ -91,9 +112,9 @@ class DocentTracer:
|
|
|
91
112
|
):
|
|
92
113
|
self._initialized: bool = False
|
|
93
114
|
# Check if tracing is disabled via environment variable
|
|
94
|
-
if
|
|
115
|
+
if _global_tracing_disabled:
|
|
95
116
|
self._disabled = True
|
|
96
|
-
logger.info("Docent tracing disabled
|
|
117
|
+
logger.info("Docent tracing disabled.")
|
|
97
118
|
return
|
|
98
119
|
|
|
99
120
|
self.collection_name: str = collection_name
|
|
@@ -246,7 +267,7 @@ class DocentTracer:
|
|
|
246
267
|
return
|
|
247
268
|
|
|
248
269
|
# If tracing is disabled, mark as initialized but don't set up anything
|
|
249
|
-
if self.
|
|
270
|
+
if self.is_disabled():
|
|
250
271
|
self._initialized = True
|
|
251
272
|
return
|
|
252
273
|
|
|
@@ -459,7 +480,7 @@ class DocentTracer:
|
|
|
459
480
|
1. Flushes all span processors to ensure data is exported
|
|
460
481
|
2. Shuts down the tracer provider and releases resources
|
|
461
482
|
"""
|
|
462
|
-
if self.
|
|
483
|
+
if self.is_disabled():
|
|
463
484
|
return
|
|
464
485
|
|
|
465
486
|
try:
|
|
@@ -473,7 +494,7 @@ class DocentTracer:
|
|
|
473
494
|
|
|
474
495
|
def close(self):
|
|
475
496
|
"""Explicitly close the Docent tracing manager."""
|
|
476
|
-
if self.
|
|
497
|
+
if self.is_disabled():
|
|
477
498
|
return
|
|
478
499
|
|
|
479
500
|
try:
|
|
@@ -486,7 +507,7 @@ class DocentTracer:
|
|
|
486
507
|
|
|
487
508
|
def flush(self) -> None:
|
|
488
509
|
"""Force flush all spans to exporters."""
|
|
489
|
-
if self.
|
|
510
|
+
if self.is_disabled():
|
|
490
511
|
return
|
|
491
512
|
|
|
492
513
|
try:
|
|
@@ -501,7 +522,7 @@ class DocentTracer:
|
|
|
501
522
|
|
|
502
523
|
def is_disabled(self) -> bool:
|
|
503
524
|
"""Check if tracing is disabled."""
|
|
504
|
-
return self._disabled
|
|
525
|
+
return _global_tracing_disabled or self._disabled
|
|
505
526
|
|
|
506
527
|
def set_disabled(self, disabled: bool) -> None:
|
|
507
528
|
"""Enable or disable tracing."""
|
|
@@ -551,7 +572,7 @@ class DocentTracer:
|
|
|
551
572
|
Yields:
|
|
552
573
|
Tuple of (agent_run_id, transcript_id)
|
|
553
574
|
"""
|
|
554
|
-
if self.
|
|
575
|
+
if self.is_disabled():
|
|
555
576
|
agent_run_id = self.get_disabled_agent_run_id(agent_run_id)
|
|
556
577
|
transcript_id = self.get_disabled_transcript_id(transcript_id)
|
|
557
578
|
yield agent_run_id, transcript_id
|
|
@@ -605,7 +626,7 @@ class DocentTracer:
|
|
|
605
626
|
Yields:
|
|
606
627
|
Tuple of (agent_run_id, transcript_id)
|
|
607
628
|
"""
|
|
608
|
-
if self.
|
|
629
|
+
if self.is_disabled():
|
|
609
630
|
agent_run_id = self.get_disabled_agent_run_id(agent_run_id)
|
|
610
631
|
transcript_id = self.get_disabled_transcript_id(transcript_id)
|
|
611
632
|
yield agent_run_id, transcript_id
|
|
@@ -848,7 +869,7 @@ class DocentTracer:
|
|
|
848
869
|
score: Numeric score value
|
|
849
870
|
attributes: Optional additional attributes
|
|
850
871
|
"""
|
|
851
|
-
if self.
|
|
872
|
+
if self.is_disabled():
|
|
852
873
|
return
|
|
853
874
|
|
|
854
875
|
collection_id = self.collection_id
|
|
@@ -864,7 +885,7 @@ class DocentTracer:
|
|
|
864
885
|
self._post_json("/v1/scores", payload)
|
|
865
886
|
|
|
866
887
|
def send_agent_run_metadata(self, agent_run_id: str, metadata: Dict[str, Any]) -> None:
|
|
867
|
-
if self.
|
|
888
|
+
if self.is_disabled():
|
|
868
889
|
return
|
|
869
890
|
|
|
870
891
|
self._ensure_json_serializable_metadata(metadata, "Agent run")
|
|
@@ -896,7 +917,7 @@ class DocentTracer:
|
|
|
896
917
|
transcript_group_id: Optional transcript group ID
|
|
897
918
|
metadata: Optional metadata to send
|
|
898
919
|
"""
|
|
899
|
-
if self.
|
|
920
|
+
if self.is_disabled():
|
|
900
921
|
return
|
|
901
922
|
|
|
902
923
|
collection_id = self.collection_id
|
|
@@ -965,7 +986,7 @@ class DocentTracer:
|
|
|
965
986
|
Yields:
|
|
966
987
|
The transcript ID
|
|
967
988
|
"""
|
|
968
|
-
if self.
|
|
989
|
+
if self.is_disabled():
|
|
969
990
|
transcript_id = self.get_disabled_transcript_id(transcript_id)
|
|
970
991
|
yield transcript_id
|
|
971
992
|
return
|
|
@@ -1025,7 +1046,7 @@ class DocentTracer:
|
|
|
1025
1046
|
Yields:
|
|
1026
1047
|
The transcript ID
|
|
1027
1048
|
"""
|
|
1028
|
-
if self.
|
|
1049
|
+
if self.is_disabled():
|
|
1029
1050
|
transcript_id = self.get_disabled_transcript_id(transcript_id)
|
|
1030
1051
|
yield transcript_id
|
|
1031
1052
|
return
|
|
@@ -1081,7 +1102,7 @@ class DocentTracer:
|
|
|
1081
1102
|
parent_transcript_group_id: Optional parent transcript group ID
|
|
1082
1103
|
metadata: Optional metadata to send
|
|
1083
1104
|
"""
|
|
1084
|
-
if self.
|
|
1105
|
+
if self.is_disabled():
|
|
1085
1106
|
return
|
|
1086
1107
|
|
|
1087
1108
|
collection_id = self.collection_id
|
|
@@ -1156,7 +1177,7 @@ class DocentTracer:
|
|
|
1156
1177
|
Yields:
|
|
1157
1178
|
The transcript group ID
|
|
1158
1179
|
"""
|
|
1159
|
-
if self.
|
|
1180
|
+
if self.is_disabled():
|
|
1160
1181
|
transcript_group_id = self.get_disabled_transcript_group_id(transcript_group_id)
|
|
1161
1182
|
yield transcript_group_id
|
|
1162
1183
|
return
|
|
@@ -1218,7 +1239,7 @@ class DocentTracer:
|
|
|
1218
1239
|
Yields:
|
|
1219
1240
|
The transcript group ID
|
|
1220
1241
|
"""
|
|
1221
|
-
if self.
|
|
1242
|
+
if self.is_disabled():
|
|
1222
1243
|
transcript_group_id = self.get_disabled_transcript_group_id(transcript_group_id)
|
|
1223
1244
|
yield transcript_group_id
|
|
1224
1245
|
return
|
|
@@ -1259,7 +1280,7 @@ class DocentTracer:
|
|
|
1259
1280
|
self._transcript_group_id_var.reset(transcript_group_id_token)
|
|
1260
1281
|
|
|
1261
1282
|
def _send_trace_done(self) -> None:
|
|
1262
|
-
if self.
|
|
1283
|
+
if self.is_disabled():
|
|
1263
1284
|
return
|
|
1264
1285
|
|
|
1265
1286
|
collection_id = self.collection_id
|
|
@@ -1272,6 +1293,7 @@ class DocentTracer:
|
|
|
1272
1293
|
|
|
1273
1294
|
|
|
1274
1295
|
_global_tracer: Optional[DocentTracer] = None
|
|
1296
|
+
_global_tracing_disabled: bool = os.environ.get("DOCENT_DISABLE_TRACING", "").lower() == "true"
|
|
1275
1297
|
|
|
1276
1298
|
|
|
1277
1299
|
def initialize_tracing(
|
|
@@ -1386,6 +1408,8 @@ def is_initialized() -> bool:
|
|
|
1386
1408
|
|
|
1387
1409
|
def is_disabled() -> bool:
|
|
1388
1410
|
"""Check if global tracing is disabled."""
|
|
1411
|
+
if _global_tracing_disabled:
|
|
1412
|
+
return True
|
|
1389
1413
|
if _global_tracer:
|
|
1390
1414
|
return _global_tracer.is_disabled()
|
|
1391
1415
|
return True
|
|
@@ -1393,6 +1417,8 @@ def is_disabled() -> bool:
|
|
|
1393
1417
|
|
|
1394
1418
|
def set_disabled(disabled: bool) -> None:
|
|
1395
1419
|
"""Enable or disable global tracing."""
|
|
1420
|
+
global _global_tracing_disabled
|
|
1421
|
+
_global_tracing_disabled = disabled
|
|
1396
1422
|
if _global_tracer:
|
|
1397
1423
|
_global_tracer.set_disabled(disabled)
|
|
1398
1424
|
|
|
@@ -1406,10 +1432,10 @@ def agent_run_score(name: str, score: float, attributes: Optional[Dict[str, Any]
|
|
|
1406
1432
|
score: Numeric score value
|
|
1407
1433
|
attributes: Optional additional attributes for the score event
|
|
1408
1434
|
"""
|
|
1435
|
+
if is_disabled():
|
|
1436
|
+
return
|
|
1409
1437
|
try:
|
|
1410
1438
|
tracer: DocentTracer = get_tracer()
|
|
1411
|
-
if tracer.is_disabled():
|
|
1412
|
-
return
|
|
1413
1439
|
agent_run_id = tracer.get_current_agent_run_id()
|
|
1414
1440
|
|
|
1415
1441
|
if not agent_run_id:
|
|
@@ -1444,10 +1470,10 @@ def agent_run_metadata(metadata: Dict[str, Any]) -> None:
|
|
|
1444
1470
|
agent_run_metadata({"user": "John", "id": 123, "flagged": True})
|
|
1445
1471
|
agent_run_metadata({"user": {"id": "123", "name": "John"}, "config": {"model": "gpt-4"}})
|
|
1446
1472
|
"""
|
|
1473
|
+
if is_disabled():
|
|
1474
|
+
return
|
|
1447
1475
|
try:
|
|
1448
1476
|
tracer = get_tracer()
|
|
1449
|
-
if tracer.is_disabled():
|
|
1450
|
-
return
|
|
1451
1477
|
agent_run_id = tracer.get_current_agent_run_id()
|
|
1452
1478
|
if not agent_run_id:
|
|
1453
1479
|
logger.warning("No active agent run context. Metadata will not be sent.")
|
|
@@ -1483,10 +1509,10 @@ def transcript_metadata(
|
|
|
1483
1509
|
transcript_group_id="group-123",
|
|
1484
1510
|
)
|
|
1485
1511
|
"""
|
|
1512
|
+
if is_disabled():
|
|
1513
|
+
return
|
|
1486
1514
|
try:
|
|
1487
1515
|
tracer = get_tracer()
|
|
1488
|
-
if tracer.is_disabled():
|
|
1489
|
-
return
|
|
1490
1516
|
transcript_id = tracer.get_current_transcript_id()
|
|
1491
1517
|
if not transcript_id:
|
|
1492
1518
|
logger.warning("No active transcript context. Metadata will not be sent.")
|
|
@@ -1524,10 +1550,10 @@ def transcript_group_metadata(
|
|
|
1524
1550
|
parent_transcript_group_id="root-group",
|
|
1525
1551
|
)
|
|
1526
1552
|
"""
|
|
1553
|
+
if is_disabled():
|
|
1554
|
+
return
|
|
1527
1555
|
try:
|
|
1528
1556
|
tracer = get_tracer()
|
|
1529
|
-
if tracer.is_disabled():
|
|
1530
|
-
return
|
|
1531
1557
|
transcript_group_id = tracer.get_current_transcript_group_id()
|
|
1532
1558
|
if not transcript_group_id:
|
|
1533
1559
|
logger.warning("No active transcript group context. Metadata will not be sent.")
|
|
@@ -1560,9 +1586,8 @@ class AgentRunContext:
|
|
|
1560
1586
|
def __enter__(self) -> tuple[str, str]:
|
|
1561
1587
|
"""Sync context manager entry."""
|
|
1562
1588
|
if is_disabled():
|
|
1563
|
-
|
|
1564
|
-
self.
|
|
1565
|
-
self.transcript_id = tracer.get_disabled_transcript_id(self.transcript_id)
|
|
1589
|
+
self.agent_run_id = _get_disabled_agent_run_id(self.agent_run_id)
|
|
1590
|
+
self.transcript_id = _get_disabled_transcript_id(self.transcript_id)
|
|
1566
1591
|
return self.agent_run_id, self.transcript_id
|
|
1567
1592
|
self._sync_context = get_tracer().agent_run_context(
|
|
1568
1593
|
self.agent_run_id, self.transcript_id, metadata=self.metadata, **self.attributes
|
|
@@ -1577,9 +1602,8 @@ class AgentRunContext:
|
|
|
1577
1602
|
async def __aenter__(self) -> tuple[str, str]:
|
|
1578
1603
|
"""Async context manager entry."""
|
|
1579
1604
|
if is_disabled():
|
|
1580
|
-
|
|
1581
|
-
self.
|
|
1582
|
-
self.transcript_id = tracer.get_disabled_transcript_id(self.transcript_id)
|
|
1605
|
+
self.agent_run_id = _get_disabled_agent_run_id(self.agent_run_id)
|
|
1606
|
+
self.transcript_id = _get_disabled_transcript_id(self.transcript_id)
|
|
1583
1607
|
return self.agent_run_id, self.transcript_id
|
|
1584
1608
|
self._async_context = get_tracer().async_agent_run_context(
|
|
1585
1609
|
self.agent_run_id, self.transcript_id, metadata=self.metadata, **self.attributes
|
|
@@ -1722,8 +1746,7 @@ class TranscriptContext:
|
|
|
1722
1746
|
def __enter__(self) -> str:
|
|
1723
1747
|
"""Sync context manager entry."""
|
|
1724
1748
|
if is_disabled():
|
|
1725
|
-
|
|
1726
|
-
self.transcript_id = tracer.get_disabled_transcript_id(self.transcript_id)
|
|
1749
|
+
self.transcript_id = _get_disabled_transcript_id(self.transcript_id)
|
|
1727
1750
|
return self.transcript_id
|
|
1728
1751
|
self._sync_context = get_tracer().transcript_context(
|
|
1729
1752
|
name=self.name,
|
|
@@ -1742,8 +1765,7 @@ class TranscriptContext:
|
|
|
1742
1765
|
async def __aenter__(self) -> str:
|
|
1743
1766
|
"""Async context manager entry."""
|
|
1744
1767
|
if is_disabled():
|
|
1745
|
-
|
|
1746
|
-
self.transcript_id = tracer.get_disabled_transcript_id(self.transcript_id)
|
|
1768
|
+
self.transcript_id = _get_disabled_transcript_id(self.transcript_id)
|
|
1747
1769
|
return self.transcript_id
|
|
1748
1770
|
self._async_context = get_tracer().async_transcript_context(
|
|
1749
1771
|
name=self.name,
|
|
@@ -1907,10 +1929,7 @@ class TranscriptGroupContext:
|
|
|
1907
1929
|
def __enter__(self) -> str:
|
|
1908
1930
|
"""Sync context manager entry."""
|
|
1909
1931
|
if is_disabled():
|
|
1910
|
-
|
|
1911
|
-
self.transcript_group_id = tracer.get_disabled_transcript_group_id(
|
|
1912
|
-
self.transcript_group_id
|
|
1913
|
-
)
|
|
1932
|
+
self.transcript_group_id = _get_disabled_transcript_group_id(self.transcript_group_id)
|
|
1914
1933
|
return self.transcript_group_id
|
|
1915
1934
|
self._sync_context = get_tracer().transcript_group_context(
|
|
1916
1935
|
name=self.name,
|
|
@@ -1929,10 +1948,7 @@ class TranscriptGroupContext:
|
|
|
1929
1948
|
async def __aenter__(self) -> str:
|
|
1930
1949
|
"""Async context manager entry."""
|
|
1931
1950
|
if is_disabled():
|
|
1932
|
-
|
|
1933
|
-
self.transcript_group_id = tracer.get_disabled_transcript_group_id(
|
|
1934
|
-
self.transcript_group_id
|
|
1935
|
-
)
|
|
1951
|
+
self.transcript_group_id = _get_disabled_transcript_group_id(self.transcript_group_id)
|
|
1936
1952
|
return self.transcript_group_id
|
|
1937
1953
|
self._async_context = get_tracer().async_transcript_group_context(
|
|
1938
1954
|
name=self.name,
|
|
@@ -2076,11 +2092,6 @@ def transcript_group_context(
|
|
|
2076
2092
|
)
|
|
2077
2093
|
|
|
2078
2094
|
|
|
2079
|
-
def _is_tracing_disabled() -> bool:
|
|
2080
|
-
"""Check if tracing is disabled via environment variable."""
|
|
2081
|
-
return os.environ.get("DOCENT_DISABLE_TRACING", "").lower() == "true"
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
2095
|
def _is_notebook() -> bool:
|
|
2085
2096
|
"""Check if we're running in a Jupyter notebook."""
|
|
2086
2097
|
try:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{docent_python-0.1.27a0 → docent_python-0.1.29a0}/docent/_llm_util/data_models/exceptions.py
RENAMED
|
File without changes
|
{docent_python-0.1.27a0 → docent_python-0.1.29a0}/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.27a0 → docent_python-0.1.29a0}/docent/_llm_util/providers/preference_types.py
RENAMED
|
File without changes
|
{docent_python-0.1.27a0 → docent_python-0.1.29a0}/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
|
|
File without changes
|