Skip to content

Commit 2f0e45e

Browse files
TaylorTaylor
authored andcommitted
Add tests for hydration support for agentic retrieval
- 🎉 Introduce ENABLE_AGENTIC_REF_HYDRATION environment variable for configuration - 🧪 Implement mock search results for hydration testing in agentic retrieval - 🔍 Create tests for agentic retrieval with and without hydration enabled - 📜 Ensure hydrated results include additional fields from search results
1 parent 226b478 commit 2f0e45e

File tree

4 files changed

+740
-0
lines changed

4 files changed

+740
-0
lines changed

tests/conftest.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -379,6 +379,7 @@ def mock_blob_container_client(monkeypatch):
379379
"AZURE_OPENAI_SEARCHAGENT_MODEL": "gpt-4.1-mini",
380380
"AZURE_OPENAI_SEARCHAGENT_DEPLOYMENT": "gpt-4.1-mini",
381381
"USE_AGENTIC_RETRIEVAL": "true",
382+
"ENABLE_AGENTIC_REF_HYDRATION": "true"
382383
}
383384
]
384385

@@ -392,6 +393,7 @@ def mock_blob_container_client(monkeypatch):
392393
"AZURE_OPENAI_SEARCHAGENT_MODEL": "gpt-4.1-mini",
393394
"AZURE_OPENAI_SEARCHAGENT_DEPLOYMENT": "gpt-4.1-mini",
394395
"USE_AGENTIC_RETRIEVAL": "true",
396+
"ENABLE_AGENTIC_REF_HYDRATION": "true",
395397
"AZURE_USE_AUTHENTICATION": "true",
396398
"AZURE_SERVER_APP_ID": "SERVER_APP",
397399
"AZURE_SERVER_APP_SECRET": "SECRET",

tests/mocks.py

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,72 @@ def __init__(self, search_text, vector_queries: Optional[list[VectorQuery]]):
126126
}
127127
]
128128
]
129+
elif search_text == "hydrated":
130+
# Mock search results for hydration testing with complete data
131+
self.data = [
132+
[
133+
{
134+
"sourcepage": "Benefit_Options-2.pdf",
135+
"sourcefile": "Benefit_Options.pdf",
136+
"content": "There is a whistleblower policy.",
137+
"embedding": [],
138+
"category": "benefits",
139+
"id": "Benefit_Options-2.pdf",
140+
"@search.score": 0.03279569745063782,
141+
"@search.reranker_score": 3.4577205181121826,
142+
"@search.highlights": None,
143+
"@search.captions": [MockCaption("Caption: A whistleblower policy.")],
144+
},
145+
]
146+
]
147+
elif search_text == "hydrated_multi":
148+
# Mock search results for multiple document hydration
149+
self.data = [
150+
[
151+
{
152+
"id": "doc1",
153+
"content": "Hydrated content 1",
154+
"sourcepage": "page1.pdf",
155+
"sourcefile": "file1.pdf",
156+
"category": "category1",
157+
"@search.score": 0.9,
158+
"@search.reranker_score": 3.5,
159+
"@search.highlights": None,
160+
"@search.captions": [],
161+
},
162+
{
163+
"id": "doc2",
164+
"content": "Hydrated content 2",
165+
"sourcepage": "page2.pdf",
166+
"sourcefile": "file2.pdf",
167+
"category": "category2",
168+
"@search.score": 0.8,
169+
"@search.reranker_score": 3.2,
170+
"@search.highlights": None,
171+
"@search.captions": [],
172+
},
173+
]
174+
]
175+
elif search_text == "hydrated_single":
176+
# Mock search results for single document hydration
177+
self.data = [
178+
[
179+
{
180+
"id": "doc1",
181+
"content": "Hydrated content 1",
182+
"sourcepage": "page1.pdf",
183+
"sourcefile": "file1.pdf",
184+
"category": "category1",
185+
"@search.score": 0.9,
186+
"@search.reranker_score": 3.5,
187+
"@search.highlights": None,
188+
"@search.captions": [],
189+
},
190+
]
191+
]
192+
elif search_text == "hydrated_empty":
193+
# Mock search results for empty hydration
194+
self.data = [[]]
129195
else:
130196
self.data = [
131197
[

0 commit comments

Comments
 (0)