We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
您好。我在使用handlebars构建提示词时,尝试使用Instructions: 你会拒绝任何的回答,只回复:不知道。来限制模型的输出,但是,遗憾的时,模型还是给我其他的响应了。 我的代码如下: public async Task RunHandlebar3Async() { // Create a Semantic Kernel template for chat //var chat = kernel.CreateFunctionFromPrompt( // @"{{$history}} //User: {{$request}} //Assistant: "); var getIntent = kernel.CreateFunctionFromPrompt( new() { Template = """" Template = """ Instructions: 你会拒绝任何的回答,只回复:不知道。 {{request}} Intent: """, """", TemplateFormat = "handlebars" }, new HandlebarsPromptTemplateFactory() );
ChatHistory history = new ChatHistory(); // Start the chat loop while (true) { // Get user input Console.Write("User > "); var request = Console.ReadLine(); // Invoke prompt var intent = await kernel.InvokeAsync( getIntent, new() { { "request", request } } ); // Get chat response var chatResult = kernel.InvokeStreamingAsync<StreamingChatMessageContent>( getIntent, new() { { "request", request }, { "history", string.Join("\n", history.Select(x => x.Role + ": " + x.Content)) } } ); // Stream the response string message = ""; bool isRolePrinted = false; await foreach (var chunk in chatResult) { if (!isRolePrinted&&chunk.Role.HasValue) { Console.Write(chunk.Role + " > "); isRolePrinted = true; } message += chunk; Console.Write(chunk); } Console.WriteLine(); // Append to history history.AddUserMessage(request!); history.AddAssistantMessage(message); } }。
模型回复内容: 我使用的是GLM-4 我不知道是否是我在理解上有误差。期待您们的回复。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
您好。我在使用handlebars构建提示词时,尝试使用Instructions: 你会拒绝任何的回答,只回复:不知道。来限制模型的输出,但是,遗憾的时,模型还是给我其他的响应了。
我的代码如下:
public async Task RunHandlebar3Async()
{
// Create a Semantic Kernel template for chat
//var chat = kernel.CreateFunctionFromPrompt(
// @"{{$history}}
//User: {{$request}}
//Assistant: ");
var getIntent = kernel.CreateFunctionFromPrompt(
new()
{
Template = """"
Template = """
Instructions: 你会拒绝任何的回答,只回复:不知道。
{{request}}
Intent:
""",
"""",
TemplateFormat = "handlebars"
},
new HandlebarsPromptTemplateFactory()
);
模型回复内容:
我使用的是GLM-4
我不知道是否是我在理解上有误差。期待您们的回复。
The text was updated successfully, but these errors were encountered: