docent-python 0.1.0a9__tar.gz → 0.1.2a0__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 (32) hide show
  1. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/.gitignore +1 -0
  2. docent_python-0.1.2a0/PKG-INFO +24 -0
  3. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/transcript.py +3 -1
  4. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/sdk/client.py +49 -2
  5. docent_python-0.1.2a0/docent/trace.py +1072 -0
  6. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/pyproject.toml +12 -1
  7. docent_python-0.1.2a0/uv.lock +955 -0
  8. docent_python-0.1.0a9/PKG-INFO +0 -15
  9. docent_python-0.1.0a9/uv.lock +0 -361
  10. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/LICENSE.md +0 -0
  11. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/README.md +0 -0
  12. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/__init__.py +0 -0
  13. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/_log_util/__init__.py +0 -0
  14. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/_log_util/logger.py +0 -0
  15. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/__init__.py +0 -0
  16. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/_tiktoken_util.py +0 -0
  17. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/agent_run.py +0 -0
  18. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/chat/__init__.py +0 -0
  19. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/chat/content.py +0 -0
  20. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/chat/message.py +0 -0
  21. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/chat/tool.py +0 -0
  22. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/citation.py +0 -0
  23. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/metadata.py +0 -0
  24. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/regex.py +0 -0
  25. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/data_models/shared_types.py +0 -0
  26. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/loaders/load_inspect.py +0 -0
  27. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/py.typed +0 -0
  28. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/samples/__init__.py +0 -0
  29. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/samples/load.py +0 -0
  30. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/samples/log.eval +0 -0
  31. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/samples/tb_airline.json +0 -0
  32. {docent_python-0.1.0a9 → docent_python-0.1.2a0}/docent/sdk/__init__.py +0 -0
@@ -133,6 +133,7 @@ celerybeat.pid
133
133
 
134
134
  # Environments
135
135
  .env
136
+ .env.*
136
137
  .venv
137
138
  env/
138
139
  venv/
@@ -0,0 +1,24 @@
1
+ Metadata-Version: 2.4
2
+ Name: docent-python
3
+ Version: 0.1.2a0
4
+ Summary: Docent SDK
5
+ Project-URL: Homepage, https://github.com/TransluceAI/docent
6
+ Project-URL: Issues, https://github.com/TransluceAI/docent/issues
7
+ Project-URL: Docs, https://transluce-docent.readthedocs-hosted.com/en/latest
8
+ Author-email: Transluce <info@transluce.org>
9
+ License-Expression: MIT
10
+ License-File: LICENSE.md
11
+ Requires-Python: >=3.11
12
+ Requires-Dist: opentelemetry-api>=1.35.0
13
+ Requires-Dist: opentelemetry-exporter-otlp-proto-grpc>=1.35.0
14
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=1.35.0
15
+ Requires-Dist: opentelemetry-instrumentation-anthropic>=0.42.0
16
+ Requires-Dist: opentelemetry-instrumentation-bedrock>=0.42.0
17
+ Requires-Dist: opentelemetry-instrumentation-langchain>=0.43.1
18
+ Requires-Dist: opentelemetry-instrumentation-openai>=0.42.0
19
+ Requires-Dist: opentelemetry-instrumentation-threading>=0.56b0
20
+ Requires-Dist: opentelemetry-sdk>=1.35.0
21
+ Requires-Dist: pydantic>=2.11.7
22
+ Requires-Dist: pyyaml>=6.0.2
23
+ Requires-Dist: tiktoken>=0.7.0
24
+ Requires-Dist: tqdm>=4.67.1
@@ -151,7 +151,9 @@ class Transcript(BaseModel):
151
151
 
152
152
  # System messages are their own unit
153
153
  if role == "system":
154
- assert not current_unit, "System message should be the first message"
154
+ # Start a new unit if there's a current unit in progress
155
+ if current_unit:
156
+ _start_new_unit()
155
157
  units.append([i])
156
158
 
157
159
  # User message always starts a new unit UNLESS the previous message was a user message
@@ -24,8 +24,8 @@ class Docent:
24
24
 
25
25
  def __init__(
26
26
  self,
27
- server_url: str = "https://aws-docent-backend.transluce.org",
28
- web_url: str = "https://docent-alpha.transluce.org",
27
+ server_url: str = "https://api.docent.transluce.org",
28
+ web_url: str = "https://docent.transluce.org",
29
29
  api_key: str | None = None,
30
30
  ):
31
31
  self._server_url = server_url.rstrip("/") + "/rest"
@@ -291,3 +291,50 @@ class Docent:
291
291
  # We do this to avoid metadata validation failing
292
292
  # TODO(mengk): kinda hacky
293
293
  return AgentRunWithoutMetadataValidator.model_validate(response.json())
294
+
295
+ def make_collection_public(self, collection_id: str) -> dict[str, Any]:
296
+ """Make a collection publicly accessible to anyone with the link.
297
+
298
+ Args:
299
+ collection_id: ID of the Collection to make public.
300
+
301
+ Returns:
302
+ dict: API response data.
303
+
304
+ Raises:
305
+ requests.exceptions.HTTPError: If the API request fails.
306
+ """
307
+ url = f"{self._server_url}/{collection_id}/make_public"
308
+ response = self._session.post(url)
309
+ response.raise_for_status()
310
+
311
+ logger.info(f"Successfully made Collection '{collection_id}' public")
312
+ return response.json()
313
+
314
+ def share_collection_with_email(self, collection_id: str, email: str) -> dict[str, Any]:
315
+ """Share a collection with a specific user by email address.
316
+
317
+ Args:
318
+ collection_id: ID of the Collection to share.
319
+ email: Email address of the user to share with.
320
+
321
+ Returns:
322
+ dict: API response data.
323
+
324
+ Raises:
325
+ requests.exceptions.HTTPError: If the API request fails.
326
+ """
327
+ url = f"{self._server_url}/{collection_id}/share_with_email"
328
+ payload = {"email": email}
329
+ response = self._session.post(url, json=payload)
330
+
331
+ try:
332
+ response.raise_for_status()
333
+ except requests.exceptions.HTTPError:
334
+ if response.status_code == 404:
335
+ raise ValueError(f"The user you are trying to share with ({email}) does not exist.")
336
+ else:
337
+ raise # Re-raise the original exception
338
+
339
+ logger.info(f"Successfully shared Collection '{collection_id}' with {email}")
340
+ return response.json()