trieve_client/models/sort_options.rs
1/*
2 * Trieve API
3 *
4 * Trieve OpenAPI Specification. This document describes all of the operations available through the Trieve API.
5 *
6 * The version of the OpenAPI document: 0.11.7
7 * Contact: developers@trieve.ai
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12
13/// SortOptions : Sort Options lets you specify different methods to rerank the chunks in the result set. If not specified, this defaults to the score of the chunks.
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SortOptions {
16 #[serde(rename = "location_bias", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
17 pub location_bias: Option<Option<Box<models::GeoInfoWithBias>>>,
18 #[serde(rename = "sort_by", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
19 pub sort_by: Option<Option<Box<models::QdrantSortBy>>>,
20 /// Tag weights is a JSON object which can be used to boost the ranking of chunks with certain tags. This is useful for when you want to be able to bias towards chunks with a certain tag on the fly. The keys are the tag names and the values are the weights.
21 #[serde(rename = "tag_weights", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
22 pub tag_weights: Option<Option<std::collections::HashMap<String, f32>>>,
23 /// Set use_weights to true to use the weights of the chunks in the result set in order to sort them. If not specified, this defaults to true.
24 #[serde(rename = "use_weights", default, with = "::serde_with::rust::double_option", skip_serializing_if = "Option::is_none")]
25 pub use_weights: Option<Option<bool>>,
26}
27
28impl SortOptions {
29 /// Sort Options lets you specify different methods to rerank the chunks in the result set. If not specified, this defaults to the score of the chunks.
30 pub fn new() -> SortOptions {
31 SortOptions {
32 location_bias: None,
33 sort_by: None,
34 tag_weights: None,
35 use_weights: None,
36 }
37 }
38}
39