Skip to content
New issue

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

Python: is_required property doesn't throw error if set to true and isn't passed in #6188

Open
matthewbolanos opened this issue May 10, 2024 Discussed in #6103 · 1 comment
Assignees
Labels
python Pull requests for the Python Semantic Kernel

Comments

@matthewbolanos
Copy link
Member

Discussed in #6103

Originally posted by MaxiPigna May 2, 2024
I implemented a simple (Auto) Function Calling kernel.

var yamlPrompt = EmbeddedResource.Read("SomePrompt.yml");
var function = kernel.CreateFunctionFromPromptYaml(yamlPrompt, new HandlebarsPromptTemplateFactory());
var args = new KernelArguments(new OpenAIPromptExecutionSettings()
{
    ToolCallBehavior = ToolCallBehavior.AutoInvokeKernelFunctions,
})
{
    { "history", chatHistory }
};


var chatResponse = await kernel.InvokeAsync(function, args, cancellationToken);

with this Yaml prompt

name: SomePrompt
template: |
  Reply to user question.
  Search on {{knowledgeType}} knowledge
  Conversation:
  {{#each history}}
    <message role="{{role}}">{{content}}</message>
  {{/each}}
template_format: handlebars
description: A function that replies to user questions.
input_variables:
  - name: history
    description: conversation history
    is_required: true
  - name: knowledgeType
    description: type of knowledge that could be internal or external
    is_required: true
output_variable:
  description: Answer to question of the user
execution_settings:
  default:
    temperature: 0.1

Considering that knowledgeType is just an example, since is_required is true and I didn't provide the value in the kernel arguments, what is the expected behavior? Because, now it simply ignores it, so I don't understand what is the difference between is_required true and false. Thanks.

@markwallace-microsoft markwallace-microsoft added triage python Pull requests for the Python Semantic Kernel and removed triage labels May 10, 2024
@github-actions github-actions bot changed the title is_required property doesn't throw error if set to true and isn't passed in Python: is_required property doesn't throw error if set to true and isn't passed in May 13, 2024
@moonbox3
Copy link
Contributor

@matthewbolanos when I am running this, I actually fail to render the handlebars prompt due to the missing knowledgeType argument. You're not seeing that error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python Pull requests for the Python Semantic Kernel
Projects
None yet
Development

No branches or pull requests

3 participants