docent-python 0.1.8a0__tar.gz → 0.1.9a0__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.

Potentially problematic release.


This version of docent-python might be problematic. Click here for more details.

Files changed (31) hide show
  1. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/PKG-INFO +1 -1
  2. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/chat/__init__.py +2 -1
  3. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/trace.py +19 -2
  4. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/pyproject.toml +1 -1
  5. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/.gitignore +0 -0
  6. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/LICENSE.md +0 -0
  7. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/README.md +0 -0
  8. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/__init__.py +0 -0
  9. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/_log_util/__init__.py +0 -0
  10. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/_log_util/logger.py +0 -0
  11. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/__init__.py +0 -0
  12. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/_tiktoken_util.py +0 -0
  13. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/agent_run.py +0 -0
  14. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/chat/content.py +0 -0
  15. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/chat/message.py +0 -0
  16. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/chat/tool.py +0 -0
  17. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/citation.py +0 -0
  18. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/metadata.py +0 -0
  19. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/regex.py +0 -0
  20. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/shared_types.py +0 -0
  21. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/data_models/transcript.py +0 -0
  22. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/loaders/load_inspect.py +0 -0
  23. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/py.typed +0 -0
  24. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/samples/__init__.py +0 -0
  25. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/samples/load.py +0 -0
  26. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/samples/log.eval +0 -0
  27. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/samples/tb_airline.json +0 -0
  28. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/sdk/__init__.py +0 -0
  29. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/sdk/client.py +0 -0
  30. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/docent/trace_temp.py +0 -0
  31. {docent_python-0.1.8a0 → docent_python-0.1.9a0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: docent-python
3
- Version: 0.1.8a0
3
+ Version: 0.1.9a0
4
4
  Summary: Docent SDK
5
5
  Project-URL: Homepage, https://github.com/TransluceAI/docent
6
6
  Project-URL: Issues, https://github.com/TransluceAI/docent/issues
@@ -7,7 +7,7 @@ from docent.data_models.chat.message import (
7
7
  UserMessage,
8
8
  parse_chat_message,
9
9
  )
10
- from docent.data_models.chat.tool import ToolCall, ToolInfo, ToolParams
10
+ from docent.data_models.chat.tool import ToolCall, ToolCallContent, ToolInfo, ToolParams
11
11
 
12
12
  __all__ = [
13
13
  "ChatMessage",
@@ -19,6 +19,7 @@ __all__ = [
19
19
  "ContentReasoning",
20
20
  "ContentText",
21
21
  "ToolCall",
22
+ "ToolCallContent",
22
23
  "ToolInfo",
23
24
  "ToolParams",
24
25
  "parse_chat_message",
@@ -200,7 +200,6 @@ class DocentTracer:
200
200
  def _signal_handler(self, signum: int, frame: Optional[object]):
201
201
  """Handle shutdown signals."""
202
202
  self.cleanup()
203
- sys.exit(0)
204
203
 
205
204
  def _init_spans_exporter(self, endpoint: str) -> Optional[Union[HTTPExporter, GRPCExporter]]:
206
205
  """Initialize the appropriate span exporter based on endpoint."""
@@ -463,6 +462,10 @@ class DocentTracer:
463
462
  except Exception as e:
464
463
  logger.error(f"Error during flush: {e}")
465
464
 
465
+ def is_disabled(self) -> bool:
466
+ """Check if tracing is disabled."""
467
+ return self._disabled
468
+
466
469
  def set_disabled(self, disabled: bool) -> None:
467
470
  """Enable or disable tracing."""
468
471
  self._disabled = disabled
@@ -616,9 +619,10 @@ class DocentTracer:
616
619
  Returns:
617
620
  Dictionary of headers including Authorization
618
621
  """
622
+
619
623
  return {
620
624
  "Content-Type": "application/json",
621
- "Authorization": f"Bearer {self.headers.get('Authorization', '').replace('Bearer ', '')}",
625
+ "Authorization": self.headers.get("Authorization", ""),
622
626
  }
623
627
 
624
628
  def _post_json(self, path: str, data: Dict[str, Any]) -> None:
@@ -1163,6 +1167,13 @@ def verify_initialized() -> bool:
1163
1167
  return _global_tracer.verify_initialized()
1164
1168
 
1165
1169
 
1170
+ def is_disabled() -> bool:
1171
+ """Check if global tracing is disabled."""
1172
+ if _global_tracer:
1173
+ return _global_tracer.is_disabled()
1174
+ return True
1175
+
1176
+
1166
1177
  def set_disabled(disabled: bool) -> None:
1167
1178
  """Enable or disable global tracing."""
1168
1179
  if _global_tracer:
@@ -1180,6 +1191,8 @@ def agent_run_score(name: str, score: float, attributes: Optional[Dict[str, Any]
1180
1191
  """
1181
1192
  try:
1182
1193
  tracer: DocentTracer = get_tracer()
1194
+ if tracer.is_disabled():
1195
+ return
1183
1196
  agent_run_id = tracer.get_current_agent_run_id()
1184
1197
 
1185
1198
  if not agent_run_id:
@@ -1216,6 +1229,8 @@ def agent_run_metadata(metadata: Dict[str, Any]) -> None:
1216
1229
  """
1217
1230
  try:
1218
1231
  tracer = get_tracer()
1232
+ if tracer.is_disabled():
1233
+ return
1219
1234
  agent_run_id = tracer.get_current_agent_run_id()
1220
1235
  if not agent_run_id:
1221
1236
  logger.warning("No active agent run context. Metadata will not be sent.")
@@ -1248,6 +1263,8 @@ def transcript_metadata(
1248
1263
  """
1249
1264
  try:
1250
1265
  tracer = get_tracer()
1266
+ if tracer.is_disabled():
1267
+ return
1251
1268
  transcript_id = tracer.get_current_transcript_id()
1252
1269
  if not transcript_id:
1253
1270
  logger.warning("No active transcript context. Metadata will not be sent.")
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "docent-python"
3
3
  description = "Docent SDK"
4
- version = "0.1.8-alpha"
4
+ version = "0.1.9-alpha"
5
5
  authors = [
6
6
  { name="Transluce", email="info@transluce.org" },
7
7
  ]
File without changes