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.
- Inheritance
-
PromptExecutionSettings
Constructor
PromptExecutionSettings(service_id: str | None = None, *, extension_data: dict[str, Any] = None, function_choice_behavior: FunctionChoiceBehavior | None = None)
Parameters
Name | Description |
---|---|
service_id
|
The service ID to use for the request. Default value: None
|
kwargs
Required
|
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: dict[str, 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.
model_computed_fields
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}
model_config
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'populate_by_name': True, 'validate_assignment': True}
model_fields
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.
This replaces Model.fields from Pydantic V1.
model_fields: ClassVar[Dict[str, FieldInfo]] = {'extension_data': FieldInfo(annotation=dict[str, Any], required=False, default_factory=dict), 'function_choice_behavior': FieldInfo(annotation=Union[FunctionChoiceBehavior, NoneType], required=False, default=None, exclude=True), 'service_id': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, metadata=[MinLen(min_length=1)])}
service_id
The service ID to use for the request.
service_id: str | None
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: FunctionChoiceBehavior | None