trieve_client/models/
semantic_boost.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/// SemanticBoost : Distance phrase is useful for moving the embedding vector of the chunk in the direction of the distance phrase. I.e. you can push a chunk with a chunk_html of \"iphone\" 25% closer to the term \"flagship\" by using the distance phrase \"flagship\" and a distance factor of 0.25. Conceptually it's drawing a line (euclidean/L2 distance) between the vector for the innerText of the chunk_html and distance_phrase then moving the vector of the chunk_html distance_factor*L2Distance closer to or away from the distance_phrase point along the line between the two points.
14#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
15pub struct SemanticBoost {
16    /// Arbitrary float (positive or negative) specifying the multiplicate factor to apply before summing the phrase vector with the chunk_html embedding vector
17    #[serde(rename = "distance_factor")]
18    pub distance_factor: f32,
19    /// Terms to embed in order to create the vector which is weighted summed with the chunk_html embedding vector
20    #[serde(rename = "phrase")]
21    pub phrase: String,
22}
23
24impl SemanticBoost {
25    /// Distance phrase is useful for moving the embedding vector of the chunk in the direction of the distance phrase. I.e. you can push a chunk with a chunk_html of \"iphone\" 25% closer to the term \"flagship\" by using the distance phrase \"flagship\" and a distance factor of 0.25. Conceptually it's drawing a line (euclidean/L2 distance) between the vector for the innerText of the chunk_html and distance_phrase then moving the vector of the chunk_html distance_factor*L2Distance closer to or away from the distance_phrase point along the line between the two points.
26    pub fn new(distance_factor: f32, phrase: String) -> SemanticBoost {
27        SemanticBoost {
28            distance_factor,
29            phrase,
30        }
31    }
32}
33