add filter functions
This commit is contained in:
parent
5a6ac3df4e
commit
938656b1f8
|
|
@ -29,14 +29,16 @@ public interface IAgentService
|
|||
/// <returns></returns>
|
||||
Task InheritAgent(Agent agent);
|
||||
|
||||
string RenderedInstruction(Agent agent);
|
||||
string RenderInstruction(Agent agent);
|
||||
|
||||
string RenderedTemplate(Agent agent, string templateName);
|
||||
string RenderTemplate(Agent agent, string templateName);
|
||||
|
||||
bool RenderFunction(Agent agent, FunctionDef def);
|
||||
|
||||
FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def);
|
||||
|
||||
IEnumerable<FunctionDef> FilterFunctions(string instruction, Agent agent, StringComparer? comparer = null);
|
||||
|
||||
bool RenderVisibility(string? visibilityExpression, Dictionary<string, object> dict);
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
using BotSharp.Abstraction.Loggers;
|
||||
using BotSharp.Abstraction.Templating;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace BotSharp.Core.Agents.Services;
|
||||
|
||||
public partial class AgentService
|
||||
{
|
||||
public string RenderedInstruction(Agent agent)
|
||||
public string RenderInstruction(Agent agent)
|
||||
{
|
||||
var render = _services.GetRequiredService<ITemplateRender>();
|
||||
var conv = _services.GetRequiredService<IConversationService>();
|
||||
|
|
@ -106,7 +107,23 @@ public partial class AgentService
|
|||
return parameterDef;
|
||||
}
|
||||
|
||||
public string RenderedTemplate(Agent agent, string templateName)
|
||||
public IEnumerable<FunctionDef> FilterFunctions(string instruction, Agent agent, StringComparer? comparer = null)
|
||||
{
|
||||
var functions = agent.Functions.AsEnumerable();
|
||||
|
||||
if (agent.FuncVisMode.IsEqualTo(AgentFuncVisMode.Auto) && !string.IsNullOrWhiteSpace(instruction))
|
||||
{
|
||||
comparer = comparer ?? StringComparer.OrdinalIgnoreCase;
|
||||
var matches = Regex.Matches(instruction, @"\b[A-Za-z0-9_]+\b");
|
||||
var words = new HashSet<string>(matches.Select(m => m.Value), comparer);
|
||||
functions = functions.Where(x => words.Contains(x.Name, comparer));
|
||||
}
|
||||
|
||||
functions = functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
return functions;
|
||||
}
|
||||
|
||||
public string RenderTemplate(Agent agent, string templateName)
|
||||
{
|
||||
var conv = _services.GetRequiredService<IConversationService>();
|
||||
var render = _services.GetRequiredService<ITemplateRender>();
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ public partial class FileInstructService : IFileInstructService
|
|||
return null;
|
||||
}
|
||||
|
||||
var instruction = agentService.RenderedTemplate(agent, templateName);
|
||||
var instruction = agentService.RenderTemplate(agent, templateName);
|
||||
return instruction;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ public class ExecuteTemplateFn : IFunctionCallback
|
|||
try
|
||||
{
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var text = agentService.RenderedTemplate(agent, templateName);
|
||||
var text = agentService.RenderTemplate(agent, templateName);
|
||||
|
||||
var completion = CompletionProvider.GetChatCompletion(_services, provider: agent.LlmConfig?.Provider, model: agent.LlmConfig?.Model);
|
||||
var response = await completion.GetChatCompletions(new Agent()
|
||||
|
|
|
|||
|
|
@ -45,8 +45,8 @@ public partial class InstructService
|
|||
|
||||
// Render prompt
|
||||
var prompt = string.IsNullOrEmpty(templateName) ?
|
||||
agentService.RenderedInstruction(agent) :
|
||||
agentService.RenderedTemplate(agent, templateName);
|
||||
agentService.RenderInstruction(agent) :
|
||||
agentService.RenderTemplate(agent, templateName);
|
||||
|
||||
var completer = CompletionProvider.GetCompletion(_services,
|
||||
agentConfig: agent.LlmConfig);
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var text = agentService.RenderedInstruction(agent);
|
||||
var text = agentService.RenderInstruction(agent);
|
||||
instruction += text;
|
||||
renderedInstructions.Add(text);
|
||||
}
|
||||
|
|
@ -211,7 +211,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
ReferenceHandler = ReferenceHandler.IgnoreCycles,
|
||||
};
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
var functions = agentService.FilterFunctions(instruction, agent);
|
||||
foreach (var fn in functions)
|
||||
{
|
||||
/*var inputschema = new InputSchema()
|
||||
|
|
|
|||
|
|
@ -359,7 +359,14 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
MaxOutputTokenCount = maxTokens
|
||||
};
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(instruction);
|
||||
messages.Add(new SystemChatMessage(instruction));
|
||||
}
|
||||
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
|
@ -372,13 +379,6 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
functionParameters: BinaryData.FromObjectAsJson(property)));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
renderedInstructions.Add(instruction);
|
||||
messages.Add(new SystemChatMessage(instruction));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Knowledges))
|
||||
{
|
||||
messages.Add(new SystemChatMessage(agent.Knowledges));
|
||||
|
|
|
|||
|
|
@ -331,7 +331,14 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
MaxOutputTokenCount = maxTokens
|
||||
};
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var text = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(text);
|
||||
messages.Add(new SystemChatMessage(text));
|
||||
}
|
||||
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
|
@ -344,13 +351,6 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
functionParameters: BinaryData.FromObjectAsJson(property)));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var text = agentService.RenderedInstruction(agent);
|
||||
renderedInstructions.Add(text);
|
||||
messages.Add(new SystemChatMessage(text));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Knowledges))
|
||||
{
|
||||
messages.Add(new SystemChatMessage(agent.Knowledges));
|
||||
|
|
|
|||
|
|
@ -196,13 +196,13 @@ public class GeminiChatCompletionProvider : IChatCompletion
|
|||
var systemPrompts = new List<string>();
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(instruction);
|
||||
systemPrompts.Add(instruction);
|
||||
}
|
||||
|
||||
var funcPrompts = new List<string>();
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
|
|
|||
|
|
@ -102,7 +102,8 @@ public class PalmChatCompletionProvider : IChatCompletion
|
|||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
prompt += agentService.RenderedInstruction(agent);
|
||||
prompt += agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(prompt);
|
||||
}
|
||||
|
||||
var routing = _services.GetRequiredService<IRoutingService>();
|
||||
|
|
@ -111,7 +112,7 @@ public class PalmChatCompletionProvider : IChatCompletion
|
|||
var messages = conversations.Select(c => new PalmChatMessage(c.Content, c.Role == AgentRole.User ? "user" : "AI"))
|
||||
.ToList();
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
var functions = agentService.FilterFunctions(prompt, agent);
|
||||
if (!functions.IsNullOrEmpty())
|
||||
{
|
||||
prompt += "\r\n\r\n[Functions] defined in JSON Schema:\r\n";
|
||||
|
|
|
|||
|
|
@ -492,13 +492,13 @@ public class GoogleRealTimeProvider : IRealTimeCompletion
|
|||
var systemPrompts = new List<string>();
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(instruction);
|
||||
systemPrompts.Add(instruction);
|
||||
}
|
||||
|
||||
var funcPrompts = new List<string>();
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
content += $"\r\n{AgentRole.Assistant}: ";
|
||||
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
var prompt = instruction + "\r\n" + content;
|
||||
|
||||
var api = _services.GetRequiredService<IInferenceApi>();
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
string totalResponse = "";
|
||||
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
var prompt = instruction + "\r\n" + content;
|
||||
|
||||
await foreach(var text in Spinner(executor.InferAsync(prompt, inferenceParams)))
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(instruction);
|
||||
messages.Add(new MessageItem("system", instruction));
|
||||
}
|
||||
|
|
@ -113,7 +113,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
new MessageItem("assistant", message.Content));
|
||||
}
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
var functionTool = ConvertToFunctionTool(function);
|
||||
|
|
|
|||
|
|
@ -1,21 +1,22 @@
|
|||
using BotSharp.Abstraction.Agents;
|
||||
using BotSharp.Abstraction.Agents.Enums;
|
||||
using BotSharp.Abstraction.Agents.Models;
|
||||
using BotSharp.Abstraction.Agents;
|
||||
using BotSharp.Abstraction.Conversations.Models;
|
||||
using BotSharp.Abstraction.Conversations;
|
||||
using BotSharp.Abstraction.Conversations.Models;
|
||||
using BotSharp.Abstraction.Files;
|
||||
using BotSharp.Abstraction.Files.Utilities;
|
||||
using BotSharp.Abstraction.Loggers;
|
||||
using BotSharp.Abstraction.MLTasks;
|
||||
using BotSharp.Abstraction.Utilities;
|
||||
using Microsoft.Extensions.AI;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BotSharp.Plugin.MicrosoftExtensionsAI;
|
||||
|
||||
|
|
@ -66,26 +67,25 @@ public sealed class MicrosoftExtensionsAIChatCompletionProvider : IChatCompletio
|
|||
MaxOutputTokens = int.Parse(state.GetState("max_tokens", "1024"))
|
||||
};
|
||||
|
||||
if (_services.GetService<IAgentService>() is { } agentService)
|
||||
{
|
||||
foreach (var function in agent.Functions)
|
||||
{
|
||||
if (agentService.RenderFunction(agent, function))
|
||||
{
|
||||
var property = agentService.RenderFunctionProperty(agent, function);
|
||||
(options.Tools ??= []).Add(new NopAIFunction(function.Name, function.Description, JsonSerializer.SerializeToElement(property)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Configure messages
|
||||
List<ChatMessage> messages = [];
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
|
||||
if (_services.GetRequiredService<IAgentService>().RenderedInstruction(agent) is string instruction &&
|
||||
instruction.Length > 0)
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
renderedInstructions.Add(instruction);
|
||||
messages.Add(new(ChatRole.System, instruction));
|
||||
var text = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(text);
|
||||
messages.Add(new(ChatRole.System, text));
|
||||
}
|
||||
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (agentService.RenderFunction(agent, function))
|
||||
{
|
||||
var property = agentService.RenderFunctionProperty(agent, function);
|
||||
(options.Tools ??= []).Add(new NopAIFunction(function.Name, function.Description, JsonSerializer.SerializeToElement(property)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Knowledges))
|
||||
|
|
|
|||
|
|
@ -321,7 +321,18 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
var messages = new List<ChatMessage>();
|
||||
var options = InitChatCompletionOption(agent);
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
// Render instructions
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var text = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(text);
|
||||
messages.Add(new SystemChatMessage(text));
|
||||
}
|
||||
|
||||
// Filter functions
|
||||
var functions = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
|
||||
// Render functions
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
|
@ -334,13 +345,6 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
functionParameters: BinaryData.FromObjectAsJson(property)));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var text = agentService.RenderedInstruction(agent);
|
||||
renderedInstructions.Add(text);
|
||||
messages.Add(new SystemChatMessage(text));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Knowledges))
|
||||
{
|
||||
messages.Add(new SystemChatMessage(agent.Knowledges));
|
||||
|
|
|
|||
|
|
@ -555,6 +555,7 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
|
|||
var settings = settingsService.GetSetting(Provider, _model);
|
||||
var allowMultiModal = settings != null && settings.MultiModal;
|
||||
|
||||
var instruction = string.Empty;
|
||||
var messages = new List<ChatMessage>();
|
||||
|
||||
var temperature = float.Parse(state.GetState("temperature", "0.0"));
|
||||
|
|
@ -568,7 +569,13 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
|
|||
MaxOutputTokenCount = maxTokens
|
||||
};
|
||||
|
||||
var functions = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
instruction = agentService.RenderInstruction(agent);
|
||||
messages.Add(new SystemChatMessage(instruction));
|
||||
}
|
||||
|
||||
var functions = agentService.FilterFunctions(instruction, agent);
|
||||
foreach (var function in functions)
|
||||
{
|
||||
if (!agentService.RenderFunction(agent, function)) continue;
|
||||
|
|
@ -581,12 +588,6 @@ public class RealTimeCompletionProvider : IRealTimeCompletion
|
|||
functionParameters: BinaryData.FromObjectAsJson(property)));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var text = agentService.RenderedInstruction(agent);
|
||||
messages.Add(new SystemChatMessage(text));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(agent.Knowledges))
|
||||
{
|
||||
messages.Add(new SystemChatMessage(agent.Knowledges));
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace BotSharp.Plugin.SemanticKernel
|
|||
var completion = this._kernelChatCompletion;
|
||||
|
||||
var agentService = _services.GetRequiredService<IAgentService>();
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
|
||||
ChatHistory chatHistory = new ChatHistory(instruction);
|
||||
|
||||
|
|
@ -70,8 +70,8 @@ namespace BotSharp.Plugin.SemanticKernel
|
|||
}
|
||||
}
|
||||
|
||||
var ChatMessage = await completion.GetChatMessageContentsAsync(chatHistory);
|
||||
var chatMessageContent = ChatMessage?.FirstOrDefault();
|
||||
var contents = await completion.GetChatMessageContentsAsync(chatHistory);
|
||||
var chatMessageContent = contents?.FirstOrDefault();
|
||||
var response = chatMessageContent != null ? chatMessageContent.Content :string.Empty;
|
||||
var msg = new RoleDialogModel(AgentRole.Assistant, response)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
|
||||
if (!string.IsNullOrEmpty(agent.Instruction) || !agent.SecondaryInstructions.IsNullOrEmpty())
|
||||
{
|
||||
var instruction = agentService.RenderedInstruction(agent);
|
||||
var instruction = agentService.RenderInstruction(agent);
|
||||
renderedInstructions.Add(instruction);
|
||||
messages.Add(ChatMessage.FromSystem(instruction));
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ public class ChatCompletionProvider : IChatCompletion
|
|||
ChatMessage.FromAssistant(message.Content));
|
||||
}
|
||||
|
||||
var agentFuncs = agent.Functions.Concat(agent.SecondaryFunctions ?? []);
|
||||
var agentFuncs = agentService.FilterFunctions(renderedInstructions.FirstOrDefault(), agent);
|
||||
foreach (var function in agentFuncs)
|
||||
{
|
||||
functions.Add(ConvertToFunctionDef(function));
|
||||
|
|
|
|||
|
|
@ -41,12 +41,12 @@ namespace BotSharp.Plugin.Google.Core
|
|||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public string RenderedInstruction(Agent agent)
|
||||
public string RenderInstruction(Agent agent)
|
||||
{
|
||||
return "Fake Instruction";
|
||||
}
|
||||
|
||||
public string RenderedTemplate(Agent agent, string templateName)
|
||||
public string RenderTemplate(Agent agent, string templateName)
|
||||
{
|
||||
return $"Rendered template for {templateName}";
|
||||
}
|
||||
|
|
@ -56,6 +56,11 @@ namespace BotSharp.Plugin.Google.Core
|
|||
return true;
|
||||
}
|
||||
|
||||
public IEnumerable<FunctionDef> FilterFunctions(string instruction, Agent agent, StringComparer? comparer = null)
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public FunctionParametersDef? RenderFunctionProperty(Agent agent, FunctionDef def)
|
||||
{
|
||||
return def.Parameters;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace BotSharp.Plugin.SemanticKernel.Tests
|
|||
_servicesMock.Setup(x => x.GetService(typeof(IEnumerable<IContentGeneratingHook>)))
|
||||
.Returns(new List<IContentGeneratingHook>());
|
||||
var agentService = new Mock<IAgentService>();
|
||||
agentService.Setup(x => x.RenderedInstruction(agent)).Returns("How can I help you?");
|
||||
agentService.Setup(x => x.RenderInstruction(agent)).Returns("How can I help you?");
|
||||
_servicesMock.Setup(x => x.GetService(typeof(IAgentService)))
|
||||
.Returns(agentService.Object);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue