vapi_client/models/
trieve_knowledge_base_search_plan.rs

1/*
2 * Vapi API
3 *
4 * API for building voice assistants
5 *
6 * The version of the OpenAPI document: 1.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use serde::{Deserialize, Serialize};
12use utoipa::OpenApi;
13
14
15use crate::models;
16
17#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize, OpenApi)]
18pub struct TrieveKnowledgeBaseSearchPlan {
19    /// Specifies the number of top chunks to return. This corresponds to the `page_size` parameter in Trieve.
20    #[serde(rename = "topK", skip_serializing_if = "Option::is_none")]
21    pub top_k: Option<f64>,
22    /// If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed. This will preserve queries that are entirely stop words.
23    #[serde(rename = "removeStopWords", skip_serializing_if = "Option::is_none")]
24    pub remove_stop_words: Option<bool>,
25    /// This is the score threshold to filter out chunks with a score below the threshold for cosine distance metric. For Manhattan Distance, Euclidean Distance, and Dot Product, it will filter out scores above the threshold distance. This threshold applies before weight and bias modifications. If not specified, this defaults to no threshold. A threshold of 0 will default to no threshold.
26    #[serde(rename = "scoreThreshold", skip_serializing_if = "Option::is_none")]
27    pub score_threshold: Option<f64>,
28    /// This is the search method used when searching for relevant chunks from the vector store.
29    #[serde(rename = "searchType")]
30    pub search_type: SearchType,
31}
32
33impl TrieveKnowledgeBaseSearchPlan {
34    pub fn new(search_type: SearchType) -> TrieveKnowledgeBaseSearchPlan {
35        TrieveKnowledgeBaseSearchPlan {
36            top_k: None,
37            remove_stop_words: None,
38            score_threshold: None,
39            search_type,
40        }
41    }
42}
43/// This is the search method used when searching for relevant chunks from the vector store.
44#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, OpenApi)]
45pub enum SearchType {
46    #[serde(rename = "fulltext")]
47    Fulltext,
48    #[serde(rename = "semantic")]
49    Semantic,
50    #[serde(rename = "hybrid")]
51    Hybrid,
52    #[serde(rename = "bm25")]
53    Bm25,
54}
55
56impl Default for SearchType {
57    fn default() -> SearchType {
58        Self::Fulltext
59    }
60}