(beta) Libraries API - manage access to a library.
- list - List all of the access to this library.
- update_or_create - Create or update an access level.
- delete - Delete an access level.
Given a library, list all of the Entity that have access and to what level.
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.libraries.accesses.list(library_id="d2169833-d8e2-416e-a372-76518d3d99c2")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
library_id |
str |
✔️ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListSharingResponse
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |
Given a library id, you can create or update the access level of an entity. You have to be owner of the library to share a library. An owner cannot change their own role. A library cannot be shared outside of the organization.
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.libraries.accesses.update_or_create(library_id="36de3a24-5b1c-4c8f-9d84-d5642205a976", level="Viewer", share_with_uuid="0ae92ecb-21ed-47c5-9f7e-0b2cbe325a20", share_with_type="User")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
library_id |
str |
✔️ |
N/A |
level |
models.ShareEnum |
✔️ |
N/A |
share_with_uuid |
str |
✔️ |
The id of the entity (user, workspace or organization) to share with |
share_with_type |
models.EntityType |
✔️ |
The type of entity, used to share a library. |
org_id |
OptionalNullable[str] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Sharing
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |
Given a library id, you can delete the access level of an entity. An owner cannot delete its own access. You have to be the owner of the library to delete an access other than yours.
from mistralai.client import Mistral
import os
with Mistral(
api_key=os.getenv("MISTRAL_API_KEY", ""),
) as mistral:
res = mistral.beta.libraries.accesses.delete(library_id="709e3cad-9fb2-4f4e-bf88-143cf1808107", share_with_uuid="b843cc47-ce8f-4354-8cfc-5fcd7fb2865b", share_with_type="User")
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
library_id |
str |
✔️ |
N/A |
share_with_uuid |
str |
✔️ |
The id of the entity (user, workspace or organization) to share with |
share_with_type |
models.EntityType |
✔️ |
The type of entity, used to share a library. |
org_id |
OptionalNullable[str] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.Sharing
| Error Type |
Status Code |
Content Type |
| errors.HTTPValidationError |
422 |
application/json |
| errors.SDKError |
4XX, 5XX |
*/* |