@@ -74,7 +74,6 @@ def chat_approach_with_hydration():
74
74
)
75
75
76
76
77
-
78
77
def test_get_search_query (chat_approach ):
79
78
payload = """
80
79
{
@@ -331,16 +330,12 @@ async def test_agent_retrieval_results(monkeypatch):
331
330
@pytest .mark .asyncio
332
331
async def test_agentic_retrieval_without_hydration (chat_approach , monkeypatch ):
333
332
"""Test agentic retrieval without hydration"""
334
-
333
+
335
334
agent_client = KnowledgeAgentRetrievalClient (endpoint = "" , agent_name = "" , credential = AzureKeyCredential ("" ))
336
335
337
336
monkeypatch .setattr (KnowledgeAgentRetrievalClient , "retrieve" , mock_retrieval )
338
337
339
- _ , results = await chat_approach .run_agentic_retrieval (
340
- messages = [],
341
- agent_client = agent_client ,
342
- search_index_name = ""
343
- )
338
+ _ , results = await chat_approach .run_agentic_retrieval (messages = [], agent_client = agent_client , search_index_name = "" )
344
339
345
340
assert len (results ) == 1
346
341
assert results [0 ].id == "Benefit_Options-2.pdf"
@@ -349,9 +344,9 @@ async def test_agentic_retrieval_without_hydration(chat_approach, monkeypatch):
349
344
assert results [0 ].sourcepage == "Benefit_Options-2.pdf"
350
345
assert results [0 ].search_agent_query == "whistleblower query"
351
346
# These fields should NOT be present without hydration
352
- assert not hasattr (results [0 ], ' sourcefile' ) or results [0 ].sourcefile is None
353
- assert not hasattr (results [0 ], ' category' ) or results [0 ].category is None
354
- assert not hasattr (results [0 ], ' score' ) or results [0 ].score is None
347
+ assert not hasattr (results [0 ], " sourcefile" ) or results [0 ].sourcefile is None
348
+ assert not hasattr (results [0 ], " category" ) or results [0 ].category is None
349
+ assert not hasattr (results [0 ], " score" ) or results [0 ].score is None
355
350
356
351
357
352
async def mock_search_with_hydration (* args , ** kwargs ):
@@ -362,17 +357,15 @@ async def mock_search_with_hydration(*args, **kwargs):
362
357
@pytest .mark .asyncio
363
358
async def test_agentic_retrieval_with_hydration (chat_approach_with_hydration , monkeypatch ):
364
359
"""Test agentic retrieval with hydration enabled"""
365
-
360
+
366
361
agent_client = KnowledgeAgentRetrievalClient (endpoint = "" , agent_name = "" , credential = AzureKeyCredential ("" ))
367
362
368
363
# Mock the agent retrieval and search client
369
364
monkeypatch .setattr (KnowledgeAgentRetrievalClient , "retrieve" , mock_retrieval )
370
365
monkeypatch .setattr (SearchClient , "search" , mock_search_with_hydration )
371
366
372
367
_ , results = await chat_approach_with_hydration .run_agentic_retrieval (
373
- messages = [],
374
- agent_client = agent_client ,
375
- search_index_name = ""
368
+ messages = [], agent_client = agent_client , search_index_name = ""
376
369
)
377
370
378
371
assert len (results ) == 1
0 commit comments