mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-10-17 07:38:00 +00:00
Added a retrieval context validation agent (#289)
This commit is contained in:
1 parent
96e6372fcd
commit
bfc9f2ea1d
26 files changed
+829
-135
No files matched your search
@@ -6,14 +6,6 @@ namespace AIStudio.Agents;
|
||||
|
||||
public sealed class AgentTextContentCleaner(ILogger<AgentBase> logger, SettingsManager settingsManager, DataSourceService dataSourceService, ThreadSafeRandom rng) : AgentBase(logger, settingsManager, dataSourceService, rng)
|
||||
{
|
||||
private static readonly ContentBlock EMPTY_BLOCK = new()
|
||||
{
|
||||
Content = null,
|
||||
ContentType = ContentType.NONE,
|
||||
Role = ChatRole.AGENT,
|
||||
Time = DateTimeOffset.UtcNow,
|
||||
};
|
||||
|
||||
private readonly List<ContentBlock> context = new();
|
||||
private readonly List<ContentBlock> answers = new();
|
||||
|
||||
@@ -73,8 +65,8 @@ public sealed class AgentTextContentCleaner(ILogger<AgentBase> logger, SettingsM
|
||||
return EMPTY_BLOCK;
|
||||
|
||||
var thread = this.CreateChatThread(this.SystemPrompt(sourceURL));
|
||||
var time = this.AddUserRequest(thread, text.Text);
|
||||
await this.AddAIResponseAsync(thread, time);
|
||||
var userRequest = this.AddUserRequest(thread, text.Text);
|
||||
await this.AddAIResponseAsync(thread, userRequest.UserPrompt, userRequest.Time);
|
||||
|
||||
var answer = thread.Blocks[^1];
|
||||
this.answers.Add(answer);
|
||||
|
||||
Reference in new issue
Block a user