Skip to content

Commit 17d73e0

Browse files
Update SearchClient to use webPageUrl instead of static fileName for webpages (fixes #491) (#521)
## Motivation and Context (Why the change? What's the scenario?) When providing webpages as facts, the "filename" currently is a static "content.url" - this provides no value when asking the LLM to include sources directly in the response (e.g. to have per paragraph sources). Update SearchClient to use webPageUrl instead of static fileName for webpages. ## High level description (Approach, Design) When creating the facts, instead of "content.url" the webpage url is added Co-authored-by: Michael Keller <[email protected]>
1 parent 9732e74 commit 17d73e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

service/Core/Search/SearchClient.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ public async Task<MemoryAnswer> AskAsync(
238238

239239
string fileName = memory.GetFileName(this._log);
240240

241+
string webPageUrl = memory.GetWebPageUrl(index);
242+
241243
var partitionText = memory.GetPartitionText(this._log).Trim();
242244
if (string.IsNullOrEmpty(partitionText))
243245
{
@@ -248,7 +250,7 @@ public async Task<MemoryAnswer> AskAsync(
248250
factsAvailableCount++;
249251

250252
// TODO: add file age in days, to push relevance of newer documents
251-
var fact = $"==== [File:{fileName};Relevance:{relevance:P1}]:\n{partitionText}\n";
253+
var fact = $"==== [File:{(fileName == "content.url" ? webPageUrl : fileName)};Relevance:{relevance:P1}]:\n{partitionText}\n";
252254

253255
// Use the partition/chunk only if there's room for it
254256
var size = this._textGenerator.CountTokens(fact);

0 commit comments

Comments
 (0)