Create an account

To get started, sign up for a free account at dashboard.trieve.ai. With a free account, you can upload up to 1000 chunks and 512 mb of files.

Download the Trieve CLI

The Trieve CLI is a command line interface that helps you manage your Trieve account and projects. Install it globally with cargo.

If you don’t have cargo installed, you can download it here.

cargo install trieve

Authenticate the CLI

To authenticate the CLI, you simply need to run the following command and follow the instructions:

trieve login

Create a new dataset

Using Trieve CLI

To create a new dataset, run the following command:

trieve dataset create

Using dashboard.trieve.ai

Alternatively, you can also create a dataset at dashboard.trieve.ai by clicking on the “Create Dataset” button:

create-dataset-on-dashboard

Upload sample data

On the free tier you are able to create up to 1000 chunks and upload 512 mb worth of files.

Using Trieve CLI

To upload a sample dataset, run the following command:

trieve dataset example

Using Trieve API

Alternatively, you can also upload your own chunks using the Trieve API through a POST to the /api/chunk route. See the API reference for the create chunk(s) endpoint to see all of the available options for adding things like location, metadata, or timestamp to your chunks.

1. Copy a dataset_id

Get an id from the output of the trieve dataset list command or create a new dataset with the trieve dataset create command and copy the id from the output.

2. Copy an api-key

Get an api-key from the result of the trieve api-key generate command making sure that it has both read and write permissions.

3. POST to the /api/chunk endpoint

See the API reference for the create chunk(s) endpoint to see all of the available options for adding things like location, metadata, or timestamp to your chunks.

Below is a sample curl command to add a chunk to your dataset. Replace <api-key> with the API key you generated, and <tr-dataset> with the dataset ID you copied.

curl --request POST \
  --url https://api.trieve.ai/api/chunk \
  --header 'Content-Type: application/json' \
  --header 'TR-Dataset: <tr-dataset>' \
  --header 'Authorization: <api-key>' \
  --data '{
  "chunk_html": "Hello World",
  "tag_set": [
    "hello",
    "world"
  ],
}'

On search.trieve.ai

You can try searching on the sample data you added by visiting search.trieve.ai and entering a query in the search bar.

Make sure to select the dataset you uploaded the sample data to using the selector dropdown on the top left.

example-search-ui-query

Using Trieve API

See the API reference for the search endpoint to see all of the available options for searching your dataset.

Below is a sample curl command to search your dataset. Replace <api-key> and <tr-dataset> with the API key and dataset ID you copied respectively.

curl --request POST \
  --url https://api.trieve.ai/api/chunk/search \
  --header 'Content-Type: application/json' \
  --header 'TR-Dataset: <tr-dataset>' \
  --header 'Authorization: <api-key>' \
  --data '{
    "query": "Hello World"
    "search_type": "hybrid"
  }'

Try recommendations

On search.trieve.ai

  1. Open a chunk by itself by clicking on the external link icon on the right side of the chunk.

open-chunk-new-tab

  1. Click on the “Get Related Chunks” button below the chunk.

single-chunk-get-related-chunks-button

  1. The recommended chunks will be displayed below the button.

single-chunk-related-chunks-result

Using Trieve API

See the API reference for the recommend endpoint to see all of the available options for getting recommendations for a specific chunk or chunks.

Try RAG

You can turn on HyDE for RAG in the settings for your dataset at dashboard.trieve.ai.

Trieve makes it easy to put RAG into your application. You can try RAG in the following ways:

On chat.trieve.ai

You can try RAG on the sample data you added by visiting chat.trieve.ai and entering a query in the chat box.

Using Trieve API

One-off on specific chunks

Check the API reference for the generate_from_chunks endpoint to see details on how to perform LLM inference with a specific set of chunks in the context window.

trieve-rag-example

RAG with stored conversation history

Memory managed RAG requires calling the following two routes in sequence:

  1. POST /api/topic to create a topic with some owner_id where the conversation history will be stored. Commonly the owner_id is the user’s ID or a fingerprint of the user’s device. Make sure to store the returned id for the next step.
  2. POST /api/message with the topic_id and some new_message_content. This will return a stream with some N chunks and LLM inference content separated by a || delimiter.