Overview

We provide functionality to do conversational search over your data using the Retrieve and Generate (RAG) model. This model allows you to chat with your data in a conversational manner, asking questions and getting responses in a natural language format. This is mainly done through our RAG on specified chunks route and RAG route.

RAG on specified chunks

This strategy allows you to specify the chunks that you want to chat with. This is useful when you want to control which exact chunks are used in the conversation. API Reference

Important Parameters

  • prompt: This is the user’s question or response to the LLM
  • chunk_ids: This is the list of chunk IDs that you want to chat with
  • prev_messages: This is the list of previous messages in the conversation. This is useful when you want to continue a conversation from a previous point.

The prev_messages field’s format is a list of dictionaries, where each dictionary has the following fields:

  • content: The message that was sent
  • role: The sender of the message. This can be either user or assistant

RAG over all chunks

This strategy allows you to chat with all the chunks in your dataset. This is useful when you want to chat with all the chunks in your dataset, and have the model do the searching for you.

  1. To use the RAG route, you need to instantiate a topic with Trieve to store all of the messages in the conversation. This is done through the create topic route.

    Important Parameters

    • first_user_message: This is the first message that the user sends to the model. This is used to generate a name for the topic. If not provided, the model will use the name from the name field.
    • name: This is the name of the topic.
    • owner_id: This is the ID of the user that owns the topic. This is typically a browser fingerprint or your user’s id. It is used to group topics together for a user.
  2. You can then use the topic_id that is returned from the create-topic route to use the create message route.

    Important Parameters

    • topic_id: This is the ID of the topic that you want to chat with
    • new_message_content: This is the new message that the user sends to the model
    • filters: This is the filters that you want to apply to the chunks that are searched. This is useful when you want to constrain the search to a specific subset of your data.

    View the explanation on how to filter in the searching with Trieve guide.