Python: Manipulate FunctionCallingStepwisePlanner in the interim #6902
-
Hi, Community! I used to use Semantic Kernel 0.5.x and recently upgraded to version 1.1.1. I'm now getting accustomed to the FunctionCallingStepwisePlanner. My use case involves a scholarship application process. I've added an AssistantPlugin with two functions: (1) Retrieve available scholarships based on provided information, and (2) Apply for a scholarship. The issue arises when retrieving a scholarship. The response includes a content format like In other words, when I input I'm unsure how to handle this case. Could filters be helpful here, or does anyone have similar experiences or suggestions for resolving this issue? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @jungwookim, thank you for your question. To better assist you, I have a question for you to help make sure I understand the full picture: In your For example, the following kernel function: class ScholarshipPlugin:
@kernel_function(name="apply_for_scholarship", description="Apply for a scholarship.")
def apply_for_scholarship(
self,
name: Annotated[str, "The name of the applicant."],
age: Annotated[int, "The age of the applicant."],
scholarship: Annotated[str, "The scholarship to apply for."],
):
"""Apply for a scholarship."""
return f"{name} has applied for the {scholarship} scholarship." produces the following JSON schema that is sent to the model: {
"type": "function",
"function":
{
"name": "scholarship-apply_for_scholarship",
"description": "Apply for a scholarship.",
"parameters":
{
"type": "object",
"properties":
{
"name":
{
"type": "string",
"description": "The name of the applicant."
},
"age":
{
"type": "integer",
"description": "The age of the applicant."
},
"scholarship":
{
"type": "string",
"description": "The scholarship to apply for."
}
},
"required":
[
"name",
"age",
"scholarship"
]
}
}
} And using vanilla function calling, I have this interaction with the model:
This works well when it's just function calling; however, while using the FunctionCallingStepwisePlanner, as you know, it creates a plan and then executes it with no further input. Thus, you could use our concept of |
Beta Was this translation helpful? Give feedback.
Hi @jungwookim, thank you for your question. To better assist you, I have a question for you to help make sure I understand the full picture:
In your
Apply Scholarship
function, are you making the function params (ideally with Annotations) required? By making these parameters required, we're able to send that information to the model so it knows before it can invoke a function that it needs certain information.For example, the following kernel function: