- list - Retrieve a list of namespaces
- create - Create a namespace.
- get - Retrieve a namespace
- update - Update a namespace.
- delete - Delete a namespace.
Retrieve a list of namespaces for the authenticated organization.
from agentset import Agentset
with Agentset(
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.namespaces.list()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.ListNamespacesResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Create a namespace for the authenticated organization.
from agentset import Agentset
with Agentset(
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.namespaces.create(name="<value>", slug="<value>", embedding_config={
"provider": "GOOGLE",
"model": "text-embedding-004",
"api_key": "<value>",
}, vector_store_config={
"provider": "PINECONE",
"api_key": "<value>",
"index_host": "https://example.svc.aped-1234-a56b.pinecone.io",
})
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
name |
str |
✔️ |
N/A |
slug |
str |
✔️ |
N/A |
embedding_config |
Optional[models.EmbeddingModelConfig] |
➖ |
The embedding model config. If not provided, our managed embedding model will be used. Note: You can't change the embedding model config after the namespace is created. |
vector_store_config |
Optional[models.CreateVectorStoreConfig] |
➖ |
The vector store config. If not provided, our MANAGED_PINECONE vector store will be used. Note: You can't change the vector store config after the namespace is created. |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.CreateNamespaceResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Retrieve the info for a namespace.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.namespaces.get()
# Handle response
print(res)
models.GetNamespaceResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Update a namespace for the authenticated organization. If there is no change, return it as it is.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.namespaces.update()
# Handle response
print(res)
| Parameter |
Type |
Required |
Description |
name |
Optional[str] |
➖ |
N/A |
slug |
Optional[str] |
➖ |
N/A |
retries |
Optional[utils.RetryConfig] |
➖ |
Configuration to override the default retry behavior of the client. |
models.UpdateNamespaceResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |
Delete a namespace for the authenticated organization. This will delete all the data associated with the namespace.
from agentset import Agentset
with Agentset(
namespace_id="ns_123",
token="AGENTSET_API_KEY",
) as a_client:
res = a_client.namespaces.delete()
# Handle response
print(res)
models.DeleteNamespaceResponse
| Error Type |
Status Code |
Content Type |
| errors.BadRequestError |
400 |
application/json |
| errors.UnauthorizedError |
401 |
application/json |
| errors.ForbiddenError |
403 |
application/json |
| errors.NotFoundError |
404 |
application/json |
| errors.ConflictError |
409 |
application/json |
| errors.InviteExpiredError |
410 |
application/json |
| errors.UnprocessableEntityError |
422 |
application/json |
| errors.RateLimitExceededError |
429 |
application/json |
| errors.InternalServerError |
500 |
application/json |
| errors.AgentsetDefaultError |
4XX, 5XX |
*/* |