PromptExecutionSettings Class

Base class for prompt execution settings.

Can be used by itself or as a base class for other prompt execution settings. The methods are used to create specific prompt execution settings objects based on the keys in the extension_data field, this way you can create a generic PromptExecutionSettings object in your application, which gets mapped into the keys of the prompt execution settings that each services returns by using the service.get_prompt_execution_settings() method.

Initialize the prompt execution settings.

Constructor

PromptExecutionSettings(service_id: str | None = None, *, extension_data: dict[str, Any] = None, function_choice_behavior: FunctionChoiceBehavior | None = None)

Parameters

Name Description
service_id
str

The service ID to use for the request.

Default value: None
kwargs
Required
Any

Additional keyword arguments, these are attempted to parse into the keys of the specific prompt execution settings.

Keyword-Only Parameters

Name Description
extension_data
Required
function_choice_behavior
Required

Methods

from_prompt_execution_settings

Create a prompt execution settings from another prompt execution settings.

pack_extension_data

Update the extension data from the prompt execution settings.

parse_function_choice_behavior

Parse the function choice behavior data.

prepare_settings_dict

Prepares the settings as a dictionary for sending to the AI service.

unpack_extension_data

Update the prompt execution settings from extension data.

Does not overwrite existing values with None.

update_from_prompt_execution_settings

Update the keys from another prompt execution settings object.

from_prompt_execution_settings

Create a prompt execution settings from another prompt execution settings.

from_prompt_execution_settings()

Parameters

Name Description
config
Required

pack_extension_data

Update the extension data from the prompt execution settings.

pack_extension_data() -> None

parse_function_choice_behavior

Parse the function choice behavior data.

parse_function_choice_behavior(data: Any) -> dict[str, Any]

Parameters

Name Description
data
Required

prepare_settings_dict

Prepares the settings as a dictionary for sending to the AI service.

prepare_settings_dict()

unpack_extension_data

Update the prompt execution settings from extension data.

Does not overwrite existing values with None.

unpack_extension_data() -> None

update_from_prompt_execution_settings

Update the keys from another prompt execution settings object.

update_from_prompt_execution_settings()

Parameters

Name Description
config
Required

Attributes

keys

Get the keys of the prompt execution settings.

service_id

The service ID to use for the request.

service_id: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]

extension_data

Any additional data to send with the request.

extension_data: dict[str, Any]

function_choice_behavior

The function choice behavior settings.

function_choice_behavior: Annotated[FunctionChoiceBehavior | None, FieldInfo(annotation=NoneType, required=True, exclude=True)]