Код: Выделить всё
IChatClient client = new OpenAIClient("")
.GetResponsesClient(openAiResponseApiModel)
.AsIChatClient();
var loggerFactory = LoggerFactory.Create(builder => builder.AddConsole().SetMinimumLevel(LogLevel.Trace));
client =
new ChatClientBuilder(client)
.UseFunctionInvocation()
.UseLogging(loggerFactory)
.Build();
var chatOptions = new ChatOptions
{
Tools = new[]
{
AIFunctionFactory.Create(
(Func)Plugin.get_capital_for_a_country,
"get_capital_for_a_country",
"Gets the capital for a country"),
AIFunctionFactory.Create(
(Func)Plugin.get_capital_information,
"get_capital_information",
"Gets information about a capital")
},
RawRepresentationFactory = _ => new CreateResponseOptions()
{
ReasoningOptions = new ResponseReasoningOptions
{
ReasoningEffortLevel = reasoningEffortLevel,
ReasoningSummaryVerbosity = ResponseReasoningSummaryVerbosity.Detailed,
},
StoredOutputEnabled = false,
},
};
List messages = new List();
messages.Add(new Microsoft.Extensions.AI.ChatMessage(ChatRole.System, systemMessage));
messages.Add(new Microsoft.Extensions.AI.ChatMessage(ChatRole.User, userMessage));
ChatResponse response = await client.GetResponseAsync(messages, chatOptions);
Как мне это сделать с помощью Microsoft.Extensions.AI?
В настоящее время я получаю эту ошибку, когда StoredOutputEnabled = false:
Код: Выделить всё
Item with id 'rs_0809f18330aa8e9901697b31d6107c819e9be05a9544441d6b' not found. Items are not persisted when `store` is set to false. Try again with `store` set to true, or remove this item from your input.
С уважением,
Андреас
Подробнее здесь: https://stackoverflow.com/questions/798 ... ient-respo
Мобильная версия