autogen_ext.tools.semantic_kernel#
- pydantic model KernelFunctionFromTool[source]#
Bases:
KernelFunctionFromMethod
Show JSON schema
{ "title": "KernelFunctionFromTool", "type": "object", "properties": { "metadata": { "$ref": "#/$defs/KernelFunctionMetadata" }, "invocation_duration_histogram": { "default": null, "title": "Invocation Duration Histogram" }, "streaming_duration_histogram": { "default": null, "title": "Streaming Duration Histogram" }, "method": { "default": null, "title": "Method" }, "stream_method": { "default": null, "title": "Stream Method" } }, "$defs": { "KernelFunctionMetadata": { "description": "The kernel function metadata.", "properties": { "name": { "pattern": "^[0-9A-Za-z_]+$", "title": "Name", "type": "string" }, "plugin_name": { "anyOf": [ { "pattern": "^[0-9A-Za-z_]+$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Plugin Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Description" }, "parameters": { "items": { "$ref": "#/$defs/KernelParameterMetadata" }, "title": "Parameters", "type": "array" }, "is_prompt": { "title": "Is Prompt", "type": "boolean" }, "is_asynchronous": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": true, "title": "Is Asynchronous" }, "return_parameter": { "anyOf": [ { "$ref": "#/$defs/KernelParameterMetadata" }, { "type": "null" } ], "default": null }, "additional_properties": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Additional Properties" } }, "required": [ "name", "is_prompt" ], "title": "KernelFunctionMetadata", "type": "object" }, "KernelParameterMetadata": { "description": "The kernel parameter metadata.", "properties": { "name": { "anyOf": [ { "pattern": "^[0-9A-Za-z_]+$", "type": "string" }, { "type": "null" } ], "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Description" }, "default_value": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default Value" }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "str", "title": "Type" }, "is_required": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Is Required" }, "type_object": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Type Object" }, "schema_data": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Schema Data" }, "include_in_function_choices": { "default": true, "title": "Include In Function Choices", "type": "boolean" } }, "required": [ "name" ], "title": "KernelParameterMetadata", "type": "object" } }, "required": [ "metadata" ] }
- Fields:
- pydantic model KernelFunctionFromToolSchema[source]#
Bases:
KernelFunctionFromPrompt
Show JSON schema
{ "title": "KernelFunctionFromToolSchema", "type": "object", "properties": { "metadata": { "$ref": "#/$defs/KernelFunctionMetadata" }, "invocation_duration_histogram": { "default": null, "title": "Invocation Duration Histogram" }, "streaming_duration_histogram": { "default": null, "title": "Streaming Duration Histogram" }, "prompt_template": { "$ref": "#/$defs/PromptTemplateBase" }, "prompt_execution_settings": { "additionalProperties": { "$ref": "#/$defs/PromptExecutionSettings" }, "title": "Prompt Execution Settings", "type": "object" } }, "$defs": { "FunctionChoiceBehavior": { "description": "Class that controls function choice behavior.\n\n Attributes:\n enable_kernel_functions: Enable kernel functions.\n max_auto_invoke_attempts: The maximum number of auto invoke attempts.\n filters: Filters for the function choice behavior. Available options are: excluded_plugins,\n included_plugins, excluded_functions, or included_functions.\n type_: The type of function choice behavior.\n\n Properties:\n auto_invoke_kernel_functions: Check if the kernel functions should be auto-invoked.\n Determined as max_auto_invoke_attempts > 0.\n\n Methods:\n configure: Configures the settings for the function call behavior,\n the default version in this class, does nothing, use subclasses for different behaviors.\n\n Class methods:\n Auto: Returns FunctionChoiceBehavior class with auto_invoke enabled, and the desired functions\n based on either the specified filters or the full qualified names. The model will decide which function\n to use, if any.\n NoneInvoke: Returns FunctionChoiceBehavior class with auto_invoke disabled, and the desired functions\n based on either the specified filters or the full qualified names. The model does not invoke any functions,\n but can rather describe how it would invoke a function to complete a given task/query.\n Required: Returns FunctionChoiceBehavior class with auto_invoke enabled, and the desired functions\n based on either the specified filters or the full qualified names. The model is required to use one of the\n provided functions to complete a given task/query.\n \n\nNote: This class is experimental and may change in the future.", "properties": { "enable_kernel_functions": { "default": true, "title": "Enable Kernel Functions", "type": "boolean" }, "maximum_auto_invoke_attempts": { "default": 5, "title": "Maximum Auto Invoke Attempts", "type": "integer" }, "filters": { "anyOf": [ { "additionalProperties": { "items": { "type": "string" }, "type": "array" }, "propertyNames": { "enum": [ "excluded_plugins", "included_plugins", "excluded_functions", "included_functions" ] }, "type": "object" }, { "type": "null" } ], "default": null, "title": "Filters" }, "type_": { "anyOf": [ { "$ref": "#/$defs/FunctionChoiceType" }, { "type": "null" } ], "default": null } }, "title": "FunctionChoiceBehavior", "type": "object" }, "FunctionChoiceType": { "description": "The type of function choice behavior.\n\nNote: This class is experimental and may change in the future.", "enum": [ "auto", "none", "required" ], "title": "FunctionChoiceType", "type": "string" }, "InputVariable": { "description": "Input variable for a prompt template.\n\nArgs:\n name: The name of the input variable.\n description: The description of the input variable.\n default: The default value of the input variable.\n is_required: Whether the input variable is required.\n json_schema: The JSON schema for the input variable.\n allow_dangerously_set_content: Allow content without encoding, this controls\n if this variable is encoded before use, default is False.", "properties": { "name": { "title": "Name", "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "", "title": "Description" }, "default": { "anyOf": [ {}, { "type": "null" } ], "default": "", "title": "Default" }, "is_required": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": true, "title": "Is Required" }, "json_schema": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "", "title": "Json Schema" }, "allow_dangerously_set_content": { "default": false, "title": "Allow Dangerously Set Content", "type": "boolean" } }, "required": [ "name" ], "title": "InputVariable", "type": "object" }, "KernelFunctionMetadata": { "description": "The kernel function metadata.", "properties": { "name": { "pattern": "^[0-9A-Za-z_]+$", "title": "Name", "type": "string" }, "plugin_name": { "anyOf": [ { "pattern": "^[0-9A-Za-z_]+$", "type": "string" }, { "type": "null" } ], "default": null, "title": "Plugin Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Description" }, "parameters": { "items": { "$ref": "#/$defs/KernelParameterMetadata" }, "title": "Parameters", "type": "array" }, "is_prompt": { "title": "Is Prompt", "type": "boolean" }, "is_asynchronous": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": true, "title": "Is Asynchronous" }, "return_parameter": { "anyOf": [ { "$ref": "#/$defs/KernelParameterMetadata" }, { "type": "null" } ], "default": null }, "additional_properties": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Additional Properties" } }, "required": [ "name", "is_prompt" ], "title": "KernelFunctionMetadata", "type": "object" }, "KernelParameterMetadata": { "description": "The kernel parameter metadata.", "properties": { "name": { "anyOf": [ { "pattern": "^[0-9A-Za-z_]+$", "type": "string" }, { "type": "null" } ], "title": "Name" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Description" }, "default_value": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Default Value" }, "type": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "str", "title": "Type" }, "is_required": { "anyOf": [ { "type": "boolean" }, { "type": "null" } ], "default": false, "title": "Is Required" }, "type_object": { "anyOf": [ {}, { "type": "null" } ], "default": null, "title": "Type Object" }, "schema_data": { "anyOf": [ { "type": "object" }, { "type": "null" } ], "default": null, "title": "Schema Data" }, "include_in_function_choices": { "default": true, "title": "Include In Function Choices", "type": "boolean" } }, "required": [ "name" ], "title": "KernelParameterMetadata", "type": "object" }, "PromptExecutionSettings": { "description": "Base class for prompt execution settings.\n\nCan be used by itself or as a base class for other prompt execution settings. The methods are used to create\nspecific prompt execution settings objects based on the keys in the extension_data field, this way you can\ncreate a generic PromptExecutionSettings object in your application, which gets mapped into the keys of the\nprompt execution settings that each services returns by using the service.get_prompt_execution_settings() method.\n\nAttributes:\n service_id (str | None): The service ID to use for the request.\n extension_data (Dict[str, Any]): Any additional data to send with the request.\n function_choice_behavior (FunctionChoiceBehavior | None): The function choice behavior settings.\n\nMethods:\n prepare_settings_dict: Prepares the settings as a dictionary for sending to the AI service.\n update_from_prompt_execution_settings: Update the keys from another prompt execution settings object.\n from_prompt_execution_settings: Create a prompt execution settings from another prompt execution settings.", "properties": { "service_id": { "anyOf": [ { "minLength": 1, "type": "string" }, { "type": "null" } ], "default": null, "title": "Service Id" }, "extension_data": { "title": "Extension Data", "type": "object" }, "function_choice_behavior": { "anyOf": [ { "$ref": "#/$defs/FunctionChoiceBehavior" }, { "type": "null" } ], "default": null } }, "title": "PromptExecutionSettings", "type": "object" }, "PromptTemplateBase": { "description": "Base class for prompt templates.", "properties": { "prompt_template_config": { "$ref": "#/$defs/PromptTemplateConfig" }, "allow_dangerously_set_content": { "default": false, "title": "Allow Dangerously Set Content", "type": "boolean" } }, "required": [ "prompt_template_config" ], "title": "PromptTemplateBase", "type": "object" }, "PromptTemplateConfig": { "description": "Configuration for a prompt template.\n\nArgs:\n name: The name of the prompt template.\n description: The description of the prompt template.\n template: The template for the prompt.\n template_format: The format of the template, should be 'semantic-kernel', 'jinja2' or 'handlebars'.\n input_variables: The input variables for the prompt.\n allow_dangerously_set_content (bool = False): Allow content without encoding throughout, this overrides\n the same settings in the prompt template config and input variables.\n This reverts the behavior to unencoded input.\n execution_settings: The execution settings for the prompt.", "properties": { "name": { "default": "", "title": "Name", "type": "string" }, "description": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": "", "title": "Description" }, "template": { "anyOf": [ { "type": "string" }, { "type": "null" } ], "default": null, "title": "Template" }, "template_format": { "default": "semantic-kernel", "enum": [ "semantic-kernel", "handlebars", "jinja2" ], "title": "Template Format", "type": "string" }, "input_variables": { "items": { "$ref": "#/$defs/InputVariable" }, "title": "Input Variables", "type": "array" }, "allow_dangerously_set_content": { "default": false, "title": "Allow Dangerously Set Content", "type": "boolean" }, "execution_settings": { "additionalProperties": { "$ref": "#/$defs/PromptExecutionSettings" }, "title": "Execution Settings", "type": "object" } }, "title": "PromptTemplateConfig", "type": "object" } }, "required": [ "metadata", "prompt_template" ] }
- Fields:
- Validators: