curl --request POST \
--url https://api.trieve.ai/api/chunk/suggestions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TR-Dataset: <tr-dataset>' \
--data '{
"context": "<string>",
"filters": {
"must": [
{
"field": "tag_set",
"match_all": [
"A",
"B"
]
},
{
"field": "num_value",
"range": {
"gte": 10,
"lte": 25
}
}
]
},
"is_ecommerce": true,
"is_followup": true,
"query": "<string>",
"search_type": "fulltext",
"suggestion_type": "question",
"suggestions_to_create": 1
}'{
"queries": [
"<string>"
]
}This endpoint will generate 3 suggested queries based off a hybrid search using RAG with the query provided in the request body and return them as a JSON object.
curl --request POST \
--url https://api.trieve.ai/api/chunk/suggestions \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'TR-Dataset: <tr-dataset>' \
--data '{
"context": "<string>",
"filters": {
"must": [
{
"field": "tag_set",
"match_all": [
"A",
"B"
]
},
{
"field": "num_value",
"range": {
"gte": 10,
"lte": 25
}
}
]
},
"is_ecommerce": true,
"is_followup": true,
"query": "<string>",
"search_type": "fulltext",
"suggestion_type": "question",
"suggestions_to_create": 1
}'{
"queries": [
"<string>"
]
}The dataset id or tracking_id to use for the request. We assume you intend to use an id if the value is a valid uuid.
JSON request payload to get alternative suggested queries
Context is the context of the query. This can be any string under 15 words and 200 characters. The context will be used to generate the suggested queries. Defaults to None.
ChunkFilter is a JSON object which can be used to filter chunks. This is useful for when you want to filter chunks by arbitrary metadata. Unlike with tag filtering, there is a performance hit for filtering on metadata.
Show child attributes
All of these field conditions have to match for the chunk to be included in the result set.
Filters can be constructed using either fields on the chunk objects, ids or tracking ids of chunks, and finally ids or tracking ids of groups.
Show child attributes
Field is the name of the field to filter on. Commonly used fields are timestamp, link, tag_set, location, num_value, group_ids, and group_tracking_ids. The field value will be used to check for an exact substring match on the metadata values for each existing chunk. This is useful for when you want to filter chunks by arbitrary metadata. To access fields inside of the metadata that you provide with the card, prefix the field name with metadata..
Boolean is a true false value for a field. This only works for boolean fields. You can specify this if you want values to be true or false.
DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
{
"gt": "2021-01-01 00:00:00.000",
"gte": "2021-01-01 00:00:00.000",
"lt": "2021-01-01 00:00:00.000",
"lte": "2021-01-01 00:00:00.000"
}Show child attributes
Show child attributes
Match all lets you pass in an array of values that will return results if all of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
Match any lets you pass in an array of values that will return results if any of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
{
"field": "metadata.key1",
"match": ["value1", "value2"],
"range": { "gt": 0, "gte": 0, "lt": 1, "lte": 1 }
}None of these field conditions can match for the chunk to be included in the result set.
Filters can be constructed using either fields on the chunk objects, ids or tracking ids of chunks, and finally ids or tracking ids of groups.
Show child attributes
Field is the name of the field to filter on. Commonly used fields are timestamp, link, tag_set, location, num_value, group_ids, and group_tracking_ids. The field value will be used to check for an exact substring match on the metadata values for each existing chunk. This is useful for when you want to filter chunks by arbitrary metadata. To access fields inside of the metadata that you provide with the card, prefix the field name with metadata..
Boolean is a true false value for a field. This only works for boolean fields. You can specify this if you want values to be true or false.
DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
{
"gt": "2021-01-01 00:00:00.000",
"gte": "2021-01-01 00:00:00.000",
"lt": "2021-01-01 00:00:00.000",
"lte": "2021-01-01 00:00:00.000"
}Show child attributes
Show child attributes
Show child attributes
Match all lets you pass in an array of values that will return results if all of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
Match any lets you pass in an array of values that will return results if any of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
{
"field": "metadata.key1",
"match": ["value1", "value2"],
"range": { "gt": 0, "gte": 0, "lt": 1, "lte": 1 }
}Only one of these field conditions has to match for the chunk to be included in the result set.
Filters can be constructed using either fields on the chunk objects, ids or tracking ids of chunks, and finally ids or tracking ids of groups.
Show child attributes
Field is the name of the field to filter on. Commonly used fields are timestamp, link, tag_set, location, num_value, group_ids, and group_tracking_ids. The field value will be used to check for an exact substring match on the metadata values for each existing chunk. This is useful for when you want to filter chunks by arbitrary metadata. To access fields inside of the metadata that you provide with the card, prefix the field name with metadata..
Boolean is a true false value for a field. This only works for boolean fields. You can specify this if you want values to be true or false.
DateRange is a JSON object which can be used to filter chunks by a range of dates. This leverages the time_stamp field on chunks in your dataset. You can specify this if you want values in a certain range. You must provide ISO 8601 combined date and time without timezone.
{
"gt": "2021-01-01 00:00:00.000",
"gte": "2021-01-01 00:00:00.000",
"lt": "2021-01-01 00:00:00.000",
"lte": "2021-01-01 00:00:00.000"
}Show child attributes
Show child attributes
Match all lets you pass in an array of values that will return results if all of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
Match any lets you pass in an array of values that will return results if any of the items match. The match value will be used to check for an exact substring match on the metadata values for each existing chunk. If both match_all and match_any are provided, the match_any condition will be used.
{
"field": "metadata.key1",
"match": ["value1", "value2"],
"range": { "gt": 0, "gte": 0, "lt": 1, "lte": 1 }
}{
"must": [
{
"field": "tag_set",
"match_all": ["A", "B"]
},
{
"field": "num_value",
"range": { "gte": 10, "lte": 25 }
}
]
}Whether of not the suggested queries are being generated for ecommerce.
Whether or not the suggested queries are being generated for a followup question. If true, the suggested queries will be generated for a followup question. If false, the suggested queries will be generated for a new question.
The query to base the generated suggested queries off of using RAG. A hybrid search for 10 chunks from your dataset using this query will be performed and the context of the chunks will be used to generate the suggested queries.
fulltext, semantic, hybrid, bm25 question, keyword, semantic The number of suggested queries to create, defaults to 10
x >= 0A JSON object containing a list of alternative suggested queries
Was this page helpful?