@@ -71,35 +71,63 @@ pub struct EmbedderDistribution {
7171pub struct Embedder {
7272 /// The third-party tool that will generate embeddings from documents
7373 pub source : EmbedderSource ,
74+
7475 /// The URL Meilisearch contacts when querying the embedder
76+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
7577 pub url : Option < String > ,
78+
7679 /// Authentication token Meilisearch should send with each request to the embedder.
7780 /// If not present, Meilisearch will attempt to read it from environment variables
81+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
7882 pub api_key : Option < String > ,
83+
7984 /// The model your embedder uses when generating vectors
85+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
8086 pub model : Option < String > ,
87+
8188 /// Model revision hash
89+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
8290 pub revision : Option < String > ,
91+
8392 /// Pooling method for Hugging Face embedders
93+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
8494 pub pooling : Option < String > ,
95+
8596 /// Template defining the data Meilisearch sends to the embedder
97+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
8698 pub document_template : Option < String > ,
99+
87100 /// Maximum allowed size of rendered document template
101+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
88102 pub document_template_max_bytes : Option < usize > ,
103+
89104 /// Number of dimensions in the chosen model.
105+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
90106 /// If not supplied, Meilisearch tries to infer this value
91107 pub dimensions : Option < usize > ,
108+
92109 /// Describes the natural distribution of search results.
110+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
93111 pub distribution : Option < EmbedderDistribution > ,
112+
94113 /// A JSON value representing the request Meilisearch makes to the remote embedder
114+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
95115 pub request : Option < serde_json:: Value > ,
116+
96117 /// A JSON value representing the response Meilisearch expects from the remote embedder
118+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
97119 pub response : Option < serde_json:: Value > ,
120+
98121 /// Once set to true, irreversibly converts all vector dimensions to 1-bit values
122+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
99123 pub binary_quantized : Option < bool > ,
124+
100125 /// Configures embedder to vectorize documents during indexing (composite embedders only)
126+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
101127 pub indexing_embedder : Option < Box < Embedder > > ,
128+
102129 /// Configures embedder to vectorize search queries (composite embedders only)
130+ #[ serde( skip_serializing_if = "Option::is_none" ) ]
103131 pub search_embedder : Option < Box < Embedder > > ,
104132}
105133
@@ -941,7 +969,7 @@ impl<Http: HttpClient> Index<Http> {
941969 /// ```
942970 /// # use std::collections::HashMap;
943971 /// # use std::string::String;
944- /// # use meilisearch_sdk::{indexes::*,settings::Embedder,settings::UserProvidedEmbedderSettings ,settings::Settings,client::*};
972+ /// # use meilisearch_sdk::{indexes::*,settings::Embedder,settings::EmbedderSource ,settings::Settings,client::*};
945973 /// #
946974 /// # let MEILISEARCH_URL = option_env!("MEILISEARCH_URL").unwrap_or("http://localhost:7700");
947975 /// # let MEILISEARCH_API_KEY = option_env!("MEILISEARCH_API_KEY").unwrap_or("masterKey");
@@ -952,7 +980,14 @@ impl<Http: HttpClient> Index<Http> {
952980 /// let index = client.index("get_embedders");
953981 /// #
954982 /// # let t = index.set_settings(&Settings{
955- /// # embedders:Some(HashMap::from([(String::from("default"),Embedder::UserProvided(UserProvidedEmbedderSettings{dimensions:1}))])),
983+ /// # embedders: Some(HashMap::from([(
984+ /// # String::from("default"),
985+ /// # Embedder {
986+ /// # source: EmbedderSource::UserProvided,
987+ /// # dimensions: Some(1),
988+ /// # ..Embedder::default()
989+ /// # }
990+ /// # )])),
956991 /// # ..Settings::default()
957992 /// # }).await.unwrap();
958993 /// # t.wait_for_completion(&client, None, None).await.unwrap();
@@ -2820,12 +2855,11 @@ mod tests {
28202855
28212856 #[ meilisearch_test]
28222857 async fn test_set_embedding_settings ( client : Client , index : Index ) {
2823- let custom_embedder =
2824- Embedder {
2825- source : EmbedderSource :: UserProvided ,
2826- dimensions : Some ( 2 ) ,
2827- ..Default :: default ( )
2828- } ;
2858+ let custom_embedder = Embedder {
2859+ source : EmbedderSource :: UserProvided ,
2860+ dimensions : Some ( 2 ) ,
2861+ ..Default :: default ( )
2862+ } ;
28292863 let embeddings = HashMap :: from ( [ ( "default" . into ( ) , custom_embedder) ] ) ;
28302864 let settings = Settings :: new ( ) . with_embedders ( embeddings. clone ( ) ) ;
28312865
0 commit comments