@@ -132,7 +132,7 @@ class AzureAISearchRM(dspy.Retrieve):
132132 ) -> List | Any:
133133 Returns embeddings for the given query.
134134
135- check_sementic_configuration (
135+ check_semantic_configuration (
136136 self,
137137 semantic_configuration_name,
138138 query_type
@@ -166,7 +166,7 @@ def __init__(
166166 query_type : Optional [QueryType ] = QueryType .FULL ,
167167 semantic_configuration_name : str = None ,
168168 is_vector_search : Optional [bool ] = False ,
169- is_hybride_search : Optional [bool ] = False ,
169+ is_hybrid_search : Optional [bool ] = False ,
170170 is_fulltext_search : Optional [bool ] = True ,
171171 vector_filter_mode : Optional [VectorFilterMode .PRE_FILTER ] = None ,
172172 ):
@@ -192,7 +192,7 @@ def __init__(
192192 self .query_type = query_type
193193 self .semantic_configuration_name = semantic_configuration_name
194194 self .is_vector_search = is_vector_search
195- self .is_hybride_search = is_hybride_search
195+ self .is_hybrid_search = is_hybrid_search
196196 self .is_fulltext_search = is_fulltext_search
197197 self .vector_filter_mode = vector_filter_mode
198198
@@ -224,7 +224,7 @@ def azure_search_request(
224224 if is_vector_search :
225225 vector_query = self .get_embeddings (query , top , field_vector )
226226 if semantic_ranker :
227- self .check_sementic_configuration (semantic_configuration_name , query_type )
227+ self .check_semantic_configuration (semantic_configuration_name , query_type )
228228 results = client .search (
229229 search_text = None ,
230230 filter = filter ,
@@ -233,6 +233,7 @@ def azure_search_request(
233233 vector_filter_mode = vector_filter_mode ,
234234 semantic_configuration_name = semantic_configuration_name ,
235235 top = top ,
236+ query_caption = ("extractive|highlight-false" if use_semantic_captions else None ),
236237 )
237238 else :
238239 results = client .search (
@@ -245,7 +246,7 @@ def azure_search_request(
245246 if is_hybrid_search :
246247 vector_query = self .get_embeddings (query , top , field_vector )
247248 if semantic_ranker :
248- self .check_sementic_configuration (semantic_configuration_name , query_type )
249+ self .check_semantic_configuration (semantic_configuration_name , query_type )
249250 results = client .search (
250251 search_text = query ,
251252 filter = filter ,
@@ -270,7 +271,7 @@ def azure_search_request(
270271 )
271272 if is_fulltext_search :
272273 if semantic_ranker :
273- self .check_sementic_configuration (semantic_configuration_name , query_type )
274+ self .check_semantic_configuration (semantic_configuration_name , query_type )
274275 results = client .search (
275276 search_text = query ,
276277 filter = filter ,
@@ -337,7 +338,7 @@ def forward(self, query_or_queries: Union[str, List[str]], k: Optional[int]) ->
337338 self .query_type ,
338339 self .semantic_configuration_name ,
339340 self .is_vector_search ,
340- self .is_hybride_search ,
341+ self .is_hybrid_search ,
341342 self .is_fulltext_search ,
342343 self .field_vector ,
343344 self .vector_filter_mode ,
@@ -366,9 +367,10 @@ def get_embeddings(self, query: str, k_nearest_neighbors: int, field_vector: str
366367 assert (
367368 self .azure_openai_client or self .embedding_func
368369 ), "Either azure_openai_client or embedding_func must be provided."
369- assert field_vector , "field_vector must be provided."
370-
370+
371371 if self .azure_openai_client is not None :
372+ assert field_vector , "field_vector must be provided."
373+
372374 embedding = (
373375 self .azure_openai_client .embeddings .create (input = query , model = self .openai_embed_model ).data [0 ].embedding
374376 )
@@ -379,7 +381,7 @@ def get_embeddings(self, query: str, k_nearest_neighbors: int, field_vector: str
379381 else :
380382 return self .embedding_func (query )
381383
382- def check_sementic_configuration (self , semantic_configuration_name , query_type ):
384+ def check_semantic_configuration (self , semantic_configuration_name , query_type ):
383385 """
384386 Checks semantic configuration.
385387
0 commit comments