Skip to content

Send a phone call from AI agent, in an API call. Or, directly call the bot from the configured phone number!

Python

quality: Enhance AI Search retrieval

Clémence Lesnédda779ba4f31
diff --git a/persistence/ai_search.py b/persistence/ai_search.py
index 12f791f..d774523 100644
--- a/persistence/ai_search.py
+++ b/persistence/ai_search.py
@@ -6,6 +6,8 @@ from azure.core.exceptions import (
)
from azure.search.documents.aio import SearchClient
from azure.search.documents.models import (
+ HybridCountAndFacetMode,
+ HybridSearch,
QueryLanguage,
QueryType,
ScoringStatistics,
@@ -102,6 +104,11 @@ class AiSearchSearch(ISearch):
text=text,
)
],
+ # Hybrid search (full text + vector search)
+ hybrid_search=HybridSearch(
+ count_and_facet_mode=HybridCountAndFacetMode.COUNT_RETRIEVABLE_RESULTS,
+ max_text_recall_size=1000,
+ ),
# Relability
semantic_max_wait_in_milliseconds=750, # Timeout in ms
# Return fields
diff --git a/requirements.txt b/requirements.txt
index bb21397..062a98c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -9,7 +9,7 @@ azure-eventgrid==4.19.0
azure-functions==1.19.0
azure-identity==1.16.0 # Required for all Azure SDKs
azure-monitor-opentelemetry==1.4.2
-azure-search-documents==11.6.0b3
+azure-search-documents==11.6.0b4
azure-storage-queue==12.10.0
django-htmlmin==0.11.0
jinja2==3.1.4