Skip to content

Commit 6629e9d

Browse files
committed
update
1 parent 3f793ca commit 6629e9d

File tree

3 files changed

+21
-21
lines changed

3 files changed

+21
-21
lines changed

app/backend/approaches/approach.py

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from dataclasses import dataclass
55
from typing import Any, Callable, Optional, TypedDict, Union, cast
66
from urllib.parse import urljoin
7+
import json
78

89
import aiohttp
910
from azure.search.documents.agent.aio import KnowledgeAgentRetrievalClient
@@ -297,19 +298,26 @@ async def run_agentic_retrieval(
297298
)
298299

299300
results = []
300-
if response and response.references:
301-
for reference in response.references:
302-
if isinstance(reference, KnowledgeAgentAzureSearchDocReference) and reference.source_data:
303-
results.append(
304-
Document(
305-
id=reference.doc_key,
306-
content=reference.source_data["content"],
307-
sourcepage=reference.source_data["sourcepage"],
308-
search_agent_query=activity_mapping[reference.activity_source],
309-
)
310-
)
311-
if top and len(results) == top:
312-
break
301+
grounding_text = response.response[0].content[0].text
302+
if response and grounding_text:
303+
grounding_response = json.loads(grounding_text)
304+
for grounding_reference in grounding_response:
305+
ref_id = grounding_reference.get("ref_id")
306+
if ref_id is not None:
307+
ref_id = str(ref_id)
308+
for reference in response.references:
309+
if isinstance(reference, KnowledgeAgentAzureSearchDocReference) and reference.id == ref_id and reference.source_data:
310+
results.append(
311+
Document(
312+
id=reference.doc_key,
313+
content=reference.source_data["content"],
314+
sourcepage=reference.source_data["sourcepage"],
315+
search_agent_query=activity_mapping[reference.activity_source],
316+
)
317+
)
318+
break
319+
if top and len(results) == top:
320+
break
313321

314322
return response, results
315323

app/frontend/src/pages/ask/Ask.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,6 @@ export function Component(): JSX.Element {
102102
setShowSpeechOutputAzure(config.showSpeechOutputAzure);
103103
setShowAgenticRetrievalOption(config.showAgenticRetrievalOption);
104104
setUseAgenticRetrieval(config.showAgenticRetrievalOption);
105-
if (config.showAgenticRetrievalOption) {
106-
setRetrieveCount(10);
107-
setMinimumRerankerScore(2.1);
108-
}
109105
});
110106
};
111107

app/frontend/src/pages/chat/Chat.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ const Chat = () => {
135135
setShowChatHistoryCosmos(config.showChatHistoryCosmos);
136136
setShowAgenticRetrievalOption(config.showAgenticRetrievalOption);
137137
setUseAgenticRetrieval(config.showAgenticRetrievalOption);
138-
if (config.showAgenticRetrievalOption) {
139-
setRetrieveCount(10);
140-
setMinimumRerankerScore(2.1);
141-
}
142138
});
143139
};
144140

0 commit comments

Comments
 (0)