docent-python 0.1.0a9__py3-none-any.whl → 0.1.1a0__py3-none-any.whl
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/sdk/client.py +49 -2
- {docent_python-0.1.0a9.dist-info → docent_python-0.1.1a0.dist-info}/METADATA +1 -1
- {docent_python-0.1.0a9.dist-info → docent_python-0.1.1a0.dist-info}/RECORD +5 -5
- {docent_python-0.1.0a9.dist-info → docent_python-0.1.1a0.dist-info}/WHEEL +0 -0
- {docent_python-0.1.0a9.dist-info → docent_python-0.1.1a0.dist-info}/licenses/LICENSE.md +0 -0
docent/sdk/client.py
CHANGED
|
@@ -24,8 +24,8 @@ class Docent:
|
|
|
24
24
|
|
|
25
25
|
def __init__(
|
|
26
26
|
self,
|
|
27
|
-
server_url: str = "https://
|
|
28
|
-
web_url: str = "https://docent
|
|
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()
|
|
@@ -20,8 +20,8 @@ docent/samples/load.py,sha256=ZGE07r83GBNO4A0QBh5aQ18WAu3mTWA1vxUoHd90nrM,207
|
|
|
20
20
|
docent/samples/log.eval,sha256=orrW__9WBfANq7NwKsPSq9oTsQRcG6KohG5tMr_X_XY,397708
|
|
21
21
|
docent/samples/tb_airline.json,sha256=eR2jFFRtOw06xqbEglh6-dPewjifOk-cuxJq67Dtu5I,47028
|
|
22
22
|
docent/sdk/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
23
|
-
docent/sdk/client.py,sha256=
|
|
24
|
-
docent_python-0.1.
|
|
25
|
-
docent_python-0.1.
|
|
26
|
-
docent_python-0.1.
|
|
27
|
-
docent_python-0.1.
|
|
23
|
+
docent/sdk/client.py,sha256=uyhTisb9bHk7Hd2G4UKLdfvuiAmYOOqJiwEPbYWN9IE,12371
|
|
24
|
+
docent_python-0.1.1a0.dist-info/METADATA,sha256=vJB2C1iwFm3vnidCBH7cE6ioU-riz3la285O2E2x-ws,521
|
|
25
|
+
docent_python-0.1.1a0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
docent_python-0.1.1a0.dist-info/licenses/LICENSE.md,sha256=vOHzq3K4Ndu0UV9hPrtXvlD7pHOjyDQmGjHuLSIkRQY,1087
|
|
27
|
+
docent_python-0.1.1a0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|