|
| 1 | +--- |
| 2 | +title: "Creating Organizations and Datasets with Trieve" |
| 3 | +description: "Learn how to create and manage organizations and datasets with Trieve" |
| 4 | +icon: "users" |
| 5 | +iconType: "regular" |
| 6 | +--- |
| 7 | + |
| 8 | +## Overview |
| 9 | + |
| 10 | +We provide the ability to create and independently manage organizations and datasets for multi-tenant use cases. With Trieve, you have full control of each organization's users, configurations, and datasets. |
| 11 | + |
| 12 | +## Creating an Organization |
| 13 | + |
| 14 | +The main route we use to expose this functionality is the [create organization route](/api-reference/organization/create-organization). Use the `name` parameter to pass a arbitrary, unique name which will be used to identify the organization. |
| 15 | + |
| 16 | +Example of creating an organization on demand through the API: |
| 17 | + |
| 18 | +```json curl |
| 19 | +curl --request PUT \ |
| 20 | + --url https://api.trieve.ai/api/organization \ |
| 21 | + --header 'Authorization: <api-key>' \ |
| 22 | + --header 'Content-Type: application/json' \ |
| 23 | + --header 'TR-Organization: <tr-organization>' \ |
| 24 | + --data '{ |
| 25 | + "name": "My Organization" // Replace with a unique name for your organization |
| 26 | +}' |
| 27 | +``` |
| 28 | + |
| 29 | +## Creating a Dataset |
| 30 | + |
| 31 | +To create a dataset, use the [create dataset route](/api-reference/dataset/create-dataset). |
| 32 | + |
| 33 | +### Important parameters |
| 34 | + |
| 35 | +- `crawl_options`: Provides the options to setup crawling to populate your dataset (e.g., include/exclude paths, tags, and more). |
| 36 | +- `dataset_name`: The name of the dataset. This must be a unique within the organization. |
| 37 | +- `server_configuration`: Provide the server configuration for the dataset such as RAG and system prompt, stop tokens, embedding models, and more. |
| 38 | +- `tracking_id`: A unique, optional tracking ID for the dataset that can be used to track the dataset in external systems. |
| 39 | + |
| 40 | +Example of creating a dataset through the API: |
| 41 | + |
| 42 | +```json curl |
| 43 | +curl --request POST \ |
| 44 | + --url https://api.trieve.ai/api/dataset \ |
| 45 | + --header 'Authorization: <api-key>' \ |
| 46 | + --header 'Content-Type: application/json' \ |
| 47 | + --header 'TR-Organization: <tr-organization>' \ |
| 48 | + --data '{ |
| 49 | + "dataset_name": "New Dataset", // Replace with a name for your dataset |
| 50 | + "organization_id": "********-****-****-****-************", |
| 51 | + |
| 52 | + // Update with the desired configurations for your dataset |
| 53 | + "server_configuration": { |
| 54 | + "BM25_ENABLED": true, |
| 55 | + "DISTANCE_METRIC": "cosine", |
| 56 | + "EMBEDDING_MODEL_NAME": "text-embedding-3-small", |
| 57 | + "LLM_DEFAULT_MODEL": "gpt-3.5-turbo-1106", |
| 58 | + "RAG_PROMPT": "Use the following retrieved documents...", |
| 59 | + "SEMANTIC_ENABLED": true, |
| 60 | + "SYSTEM_PROMPT": "You are a helpful assistant", |
| 61 | + } |
| 62 | +}' |
| 63 | +``` |
| 64 | + |
| 65 | +## Managing multiple organizations |
| 66 | + |
| 67 | +Trieve provides a solution for multi-tenanted environments, allowing users to manage and operate across multiple organizations. Each organization can have its own datasets, configurations, and users. |
| 68 | + |
| 69 | +To access different organizations, use the `TR-Organization` header. For example, to fetch the details of a specific organization, you can do: |
| 70 | + |
| 71 | +```json curl |
| 72 | +curl --request GET \ |
| 73 | + --url https://api.trieve.ai/api/organization/{organization_id} \ |
| 74 | + --header 'Authorization: <api-key>' \ |
| 75 | + --header 'TR-Organization: <tr-organization>' // The id of the organization you want to fetch |
| 76 | +``` |
| 77 | + |
| 78 | +## Update configuration across datasets |
| 79 | + |
| 80 | +To update all dataset configs in an organization, use the [update all dataset configurations route](/api-reference/organization/update-all-dataset-configurations). Use the `server_configuration` parameter to pass in a new configuration for all datasets in the organization. |
| 81 | + |
| 82 | +Example of updating all dataset configurations in an organization: |
| 83 | + |
| 84 | +```json curl |
| 85 | +curl --request POST \ |
| 86 | + --url https://api.trieve.ai/api/organization/update_dataset_configs \ |
| 87 | + --header 'Authorization: <api-key>' \ |
| 88 | + --header 'Content-Type: application/json' \ |
| 89 | + --header 'TR-Organization: <tr-organization>' \ // Specify the organization whose dataset configurations you want to update |
| 90 | + --data '{ |
| 91 | + "organization_id": "********-****-****-****-************", |
| 92 | + "server_configuration": { |
| 93 | + // Keys that you would like to change |
| 94 | + } |
| 95 | +}' |
| 96 | +``` |
| 97 | + |
| 98 | +<Note> |
| 99 | + Only the specified keys in the `server_configuration` object will be updated |
| 100 | + for each dataset, keeping the unique values for other fields unchanged. |
| 101 | +</Note> |
0 commit comments