Replies: 4 comments
-
|
This is where I am structuring my YAML from Semantic Kernel YAML Schema |
Beta Was this translation helpful? Give feedback.
-
|
I struggled with scema also until i found this diving-into-function-calling-and-its-json-schema-in-semantic-kernel-net schema should be like this output_variable:
json_schema: |
{
"type": "object",
"required": [ "files_list" ],
"additionalProperties": false,
"properties": {
"files_list": { "type": "array", "items": { "type": "string" }}
}
} |
Beta Was this translation helpful? Give feedback.
-
|
Thanks for opening Python: Defining the response_format of a ChatCompletionAgent in a YAML file. If your goal is to let agents perform real tasks and settle payments safely, Silicon Road may help as a thin execution layer:
Docs: https://siliconroad.ai/docs Happy to share a concrete integration example for your repo if useful. |
Beta Was this translation helpful? Give feedback.
-
|
For this specific case I would separate two things:
For the Python from semantic_kernel.functions import KernelArguments
from semantic_kernel.connectors.ai.open_ai import AzureChatPromptExecutionSettings
from semantic_kernel.kernel_pydantic import KernelBaseModel
class FilesList(KernelBaseModel):
files_list: list[str]
settings = AzureChatPromptExecutionSettings(
temperature=0.0,
top_p=0.0,
)
settings.response_format = FilesList
agent = await AgentRegistry.create_from_file(
"file_discovery_agent.yaml",
kernel=kernel,
service=AzureChatCompletion(...),
arguments=KernelArguments(settings=settings),
)If you prefer a schema dictionary instead of a Pydantic model, use the provider structured-output shape rather than an example object: settings.response_format = {
"type": "json_schema",
"json_schema": {
"name": "files_list_response",
"strict": True,
"schema": {
"type": "object",
"required": ["files_list"],
"additionalProperties": False,
"properties": {
"files_list": {
"type": "array",
"items": {"type": "string"},
}
},
},
},
}Two small gotchas:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have the following class for structuring the response of a ChatCompletionAgent
I want to create the ChatCompletionAgent using the AgentRegistry.create_from_file() method and the agent should pull the AzurePromptExecutionSettings from the YAML file.
My current YAML file
Plugin
If I use get_response, I get the result back in free text and not structured to the FilesList class
The result is the same whether I do
or
or
This is what I'm trying to achieve (agent initialised in code itself):
I want a way the AgentRegistry.create_from_file method either:
Beta Was this translation helpful? Give feedback.
All reactions