Overview

Trieve Analytics is a powerful tool that allows you to analyze your queries and gain insights from them.

Setting Up Trieve Analytics

Trieve automatically collects all of the searches and RAG chats that are made in your dataset. You don’t have to worry about manually tracking them.

Automatically Tracked Analytics

Search Analytics

We provide extensive analytics on your searches all of which can be found in the search analytics route. These analytics include:

  • Head Queries: Head queries is a collection of the most common queries.
  • Low Confidence Queries: The queries where all your results have scores, which can be useful for improving your search results.
  • No Results Queries: This table shows the queries that returned no results, which can be useful for improving your search results.
  • Popular Filters: This table shows the most popular filters used in searches.
  • Latency / time: This graph shows the average latency of searches over time.
  • Searches / time: This graph shows the number of searches made over time.

You can see all of this data on the dashboard in the analytics section, as well as be able to export them to a CSV so that you can analyze them in your own tools.

RAG Chat Analytics

We provide extensive analytics on your RAG chats all of which can be found in the RAG analytics route. These analytics include:

  • Usage over time: This graph shows the number of RAG chats made over time.
  • All RAG Chats: This table shows all of the RAG chats made in your dataset.

You can see all of this data on the dashboard in the analytics section, as well as be able to export them to a CSV so that you can analyze them in your own tools.

Custom Metrics

1. Getting the Request ID

All searches, recommendations, and chats return a requestID. With this you can track:

  • Clicks
  • user ratings (on any scale you want)
  • Add to Cart’s
  • User Views
  • Purchase’s

forwarding this query_id to any custom

Request ID from Searches

All Searches Return an id, this id is your Request ID

search_response.json
{
    "chunks" : [
        // ... Your search response
    ], 
    "id": "28f37011-179e-4927-9138-771132d0b6c3" // Request ID
}

Request ID from Recommendations

Calls to /api/chunk/recommend return an id

recommend_response.json
{
    "chunks" : [
        // ... Your Chunk Data
    ], 
    "id": "28f37011-179e-4927-9138-771132d0b6c3" // Request ID
    // ... other data
}

Request ID from LLM Messages

Calls to /api/message return a streaming response so the id is not located in the payload, the id is instead placed on the header TR-QueryID.

2. Enriching Events

Track Click Through Rate data

Send Click-Through Rate data to Trieve using the send CTR data route. Referencing your search id from the previous step.

chunk_id in this case is the chunk the user clicked on from the search

You can also send user feedback to the Trieve API using the rate search query route or rate RAG query route.

The rating parameter can be any number of your choosing. Feel free to make your own rating scales

Custom event types

You can send custom events to the Trieve API using the send event route. Referencing your search id from the previous step

Querying Custom Metrics

You can query this custom event data using the get all events route. This will return all of the custom events that you have sent to the Trieve API.

curl
curl --request POST \
  --url https://api.trieve.ai/api/analytics/events \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "filter": {
    "date_range": {
      "gt": "2021-08-10T00:00:00Z",
      "lt": "2021-08-11T00:00:00Z"
    },
    "event_type": "<your_event_type>",
    "is_conversion": true,
    "metadata_filter": "path = \"value\"",
    "user_id": "user1"
  }
}'