Share via


OpenAIChatPromptExecutionSettings Class

Specific settings for the Chat Completion endpoint.

Initialize the prompt execution settings.

Constructor

OpenAIChatPromptExecutionSettings(service_id: str | None = None, *, extension_data: dict[str, Any] = None, function_choice_behavior: FunctionChoiceBehavior | None = None, ai_model_id: str | None = None, frequency_penalty: Annotated[float | None, Ge(ge=-2.0), Le(le=2.0)] = None, logit_bias: dict[str | int, float] | None = None, max_tokens: Annotated[int | None, Gt(gt=0)] = None, number_of_responses: Annotated[int | None, Ge(ge=1), Le(le=128)] = None, presence_penalty: Annotated[float | None, Ge(ge=-2.0), Le(le=2.0)] = None, seed: int | None = None, stop: str | list[str] | None = None, stream: bool = False, temperature: Annotated[float | None, Ge(ge=0.0), Le(le=2.0)] = None, top_p: Annotated[float | None, Ge(ge=0.0), Le(le=1.0)] = None, user: str | None = None, store: bool | None = None, metadata: dict[str, str] | None = None, response_format: dict[Literal['type'], Literal['text', 'json_object']] | dict[str, Any] | type[BaseModel] | type | None = None, function_call: str | None = None, functions: list[dict[str, Any]] | None = None, messages: list[dict[str, Any]] | None = None, parallel_tool_calls: bool | None = None, tools: list[dict[str, Any]] | None = None, tool_choice: str | None = None, structured_json_response: bool = False, stream_options: dict[str, Any] | None = None, max_completion_tokens: Annotated[int | None, Gt(gt=0)] = None, reasoning_effort: Literal['low', 'medium', 'high'] | 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
ai_model_id
Required
frequency_penalty
Required
logit_bias
Required
max_tokens
Required
number_of_responses
Required
presence_penalty
Required
seed
Required
stop
Required
stream
Required
temperature
Required
top_p
Required
user
Required
store
Required
metadata
Required
response_format
Required
function_call
Required
functions
Required
messages
Required
parallel_tool_calls
Required
tools
Required
tool_choice
Required
structured_json_response
Required
stream_options
Required
max_completion_tokens
Required
reasoning_effort
Required

Methods

validate_function_call

Validate the function_call and functions parameters.

validate_response_format_and_set_flag

Validate the response_format and set structured_json_response accordingly.

validate_function_call

Validate the function_call and functions parameters.

validate_function_call(v: str | list[dict[str, Any]] | None = None)

Parameters

Name Description
v
Default value: None

validate_response_format_and_set_flag

Validate the response_format and set structured_json_response accordingly.

validate_response_format_and_set_flag(values: Any) -> Any

Parameters

Name Description
values
Required

Attributes

function_call

function_call: str | None

functions

functions: list[dict[str, Any]] | None

max_completion_tokens

max_completion_tokens: Annotated[int | None, FieldInfo(annotation=NoneType, required=True, description='A maximum limit on total tokens for completion, including both output and reasoning tokens.', metadata=[Gt(gt=0)])]

messages

messages: Annotated[list[dict[str, Any]] | None, FieldInfo(annotation=NoneType, required=True, description='Do not set this manually. It is set by the service.')]

parallel_tool_calls

parallel_tool_calls: bool | None

reasoning_effort

reasoning_effort: Annotated[Literal['low', 'medium', 'high'] | None, FieldInfo(annotation=NoneType, required=True, description='Adjusts reasoning effort (low/medium/high). Lower values reduce response time and token usage.')]

response_format

response_format: dict[Literal['type'], Literal['text', 'json_object']] | dict[str, Any] | type[BaseModel] | type | None

stream_options

stream_options: Annotated[dict[str, Any] | None, FieldInfo(annotation=NoneType, required=True, description='Additional options to pass when streaming is used. Do not set this manually.')]

structured_json_response

structured_json_response: Annotated[bool, FieldInfo(annotation=NoneType, required=True, description='Do not set this manually. It is set by the service.')]

tool_choice

tool_choice: Annotated[str | None, FieldInfo(annotation=NoneType, required=True, description='Do not set this manually. It is set by the service based on the function choice configuration.')]

tools

tools: Annotated[list[dict[str, Any]] | None, FieldInfo(annotation=NoneType, required=True, description='Do not set this manually. It is set by the service based on the function choice configuration.')]