Create a new Collection
APIs to create a new Collection in OramaCore.
A collection is a group of indexes. Each index can be thought of as a separate collection of documents, where each document is a JSON object.
For example, let's say you're writing a support chatbot system. Some of your data may come from your documentation, some from your FAQ, some from your Slack channel and some from your GitHub issues.
You can create a single collection called "support"
and then create 4 indexes inside it:
"documentation"
: all the documents from your documentation."faq"
: all the documents from your FAQ."slack"
: all the messages from your community Slack channel."github"
: all the issues from your GitHub repository.
This way, you can programmaticaly decide where to search for specific information on each query, narrowing down the search results to the most relevant indexes.
When creating a collection, you can specify the read and write API keys for the collection. If they're not provided, OramaCore will generate them for you and return them in the response body.
Creating a new Collection
API Key type: master. Do not expose it to the public.
Creating a new collection is as simple as:
curl -X POST \
http://localhost:8080/v1/collections/create \
-H 'Authorization: Bearer <master-api-key>' \
-d '{
"id": "support",
"write_api_key": "my-write-api-key",
"read_api_key": "my-read-api-key"
}'
A more complete example, with all the optional fields:
curl -X POST \
http://localhost:8080/v1/collections/create \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <master-api-key>' \
-d '{
"id": "support",
"write_api_key": "my-write-api-key",
"read_api_key": "my-read-api-key",
"description": "My optional description about this collection of support documents",
"language": "english",
"embeddingsModel": "BGESmall",
}'
In the next sections, we'll explain each of the parameters in detail.
Parameters
Name | Type | Description | Required | Default |
---|---|---|---|---|
id | string | The id of the collection. Can be a name you use to identify it. | Yes | - |
write_api_key | string | The write API key for this collection. | Yes | - |
read_api_key | string | The read API key for this collection. | Yes | - |
description | string | A description for this collection. | No | - |
language | string | The language of the documents in this collection. | No | english |
embeddingsModel | string | The embeddings model to use for the collection | No | BGESmall |
Creating an index
Once you have created a collection, you'll need to create at least one index inside of it.
As an example, let's create an index called "faq"
inside the "support"
collection:
# Please note that the URL contains the collection ID:
# http://localhost:8080/v1/collections/{COLLECTION_ID}/indexes/create
curl -X POST \
http://localhost:8080/v1/collections/support/indexes/create \
-H 'Authorization: Bearer <write-api-key>' \
-d '{
"id": "faq",
"embedding": "automatic",
}'
Both id
and embeddings
are optional. If you don't provide an id
, OramaCore will generate one for you. If you don't provide an embeddings
value, OramaCore will use automatic
by default, meaning it will automatically detect the best document properties to concatenate for generating the embeddings at insert time.
Parameters
Name | Type | Description | Required | Default |
---|---|---|---|---|
id | string | The id of the index. Can be a name you use to identify it. | No | - |
embeddings | string | The embeddings to use for this index. Can be automatic , manual or none . | No | automatic |
Last updated on