File tree Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Expand file tree Collapse file tree 3 files changed +22
-10
lines changed Original file line number Diff line number Diff line change @@ -181,18 +181,22 @@ impl LlmEmbeddingClient for AiStudioClient {
181181 if let Some ( task_type) = request. task_type {
182182 payload[ "taskType" ] = serde_json:: Value :: String ( task_type. into ( ) ) ;
183183 }
184+ if let Some ( output_dimension) = request. output_dimension {
185+ payload[ "outputDimensionality" ] = serde_json:: Value :: Number ( output_dimension. into ( ) ) ;
186+ }
184187 let resp = retryable:: run (
185- || self . client . post ( & url) . json ( & payload) . send ( ) ,
188+ || async {
189+ self . client
190+ . post ( & url)
191+ . json ( & payload)
192+ . send ( )
193+ . await ?
194+ . error_for_status ( )
195+ } ,
186196 & retryable:: HEAVY_LOADED_OPTIONS ,
187197 )
188- . await ?;
189- if !resp. status ( ) . is_success ( ) {
190- bail ! (
191- "Gemini API error: {:?}\n {}\n " ,
192- resp. status( ) ,
193- resp. text( ) . await ?
194- ) ;
195- }
198+ . await
199+ . context ( "Gemini API error" ) ?;
196200 let embedding_resp: EmbedContentResponse = resp. json ( ) . await . context ( "Invalid JSON" ) ?;
197201 Ok ( super :: LlmEmbeddingResponse {
198202 embedding : embedding_resp. embedding . values ,
@@ -202,6 +206,10 @@ impl LlmEmbeddingClient for AiStudioClient {
202206 fn get_default_embedding_dimension ( & self , model : & str ) -> Option < u32 > {
203207 get_embedding_dimension ( model)
204208 }
209+
210+ fn behavior_version ( & self ) -> Option < u32 > {
211+ Some ( 2 )
212+ }
205213}
206214
207215pub struct VertexAiClient {
Original file line number Diff line number Diff line change @@ -99,6 +99,10 @@ pub trait LlmEmbeddingClient: Send + Sync {
9999 ) -> Result < LlmEmbeddingResponse > ;
100100
101101 fn get_default_embedding_dimension ( & self , model : & str ) -> Option < u32 > ;
102+
103+ fn behavior_version ( & self ) -> Option < u32 > {
104+ Some ( 1 )
105+ }
102106}
103107
104108mod anthropic;
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ struct Executor {
2828#[ async_trait]
2929impl SimpleFunctionExecutor for Executor {
3030 fn behavior_version ( & self ) -> Option < u32 > {
31- Some ( 1 )
31+ self . args . client . behavior_version ( )
3232 }
3333
3434 fn enable_cache ( & self ) -> bool {
You can’t perform that action at this time.
0 commit comments