feat: add service_tier support to OpenAIResponsesLLMService
This commit is contained in:
@@ -84,6 +84,7 @@ class OpenAIResponsesLLMService(LLMService):
|
|||||||
organization=None,
|
organization=None,
|
||||||
project=None,
|
project=None,
|
||||||
default_headers: Optional[Mapping[str, str]] = None,
|
default_headers: Optional[Mapping[str, str]] = None,
|
||||||
|
service_tier: Optional[str] = None,
|
||||||
settings: Optional[Settings] = None,
|
settings: Optional[Settings] = None,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
@@ -96,6 +97,7 @@ class OpenAIResponsesLLMService(LLMService):
|
|||||||
organization: OpenAI organization ID.
|
organization: OpenAI organization ID.
|
||||||
project: OpenAI project ID.
|
project: OpenAI project ID.
|
||||||
default_headers: Additional HTTP headers to include in requests.
|
default_headers: Additional HTTP headers to include in requests.
|
||||||
|
service_tier: Service tier to use (e.g., "auto", "flex", "priority").
|
||||||
settings: Runtime-updatable settings. When provided alongside
|
settings: Runtime-updatable settings. When provided alongside
|
||||||
other parameters, ``settings`` values take precedence.
|
other parameters, ``settings`` values take precedence.
|
||||||
**kwargs: Additional arguments passed to the parent LLMService.
|
**kwargs: Additional arguments passed to the parent LLMService.
|
||||||
@@ -127,6 +129,7 @@ class OpenAIResponsesLLMService(LLMService):
|
|||||||
**kwargs,
|
**kwargs,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
self._service_tier = service_tier
|
||||||
self._client = self._create_client(
|
self._client = self._create_client(
|
||||||
api_key=api_key,
|
api_key=api_key,
|
||||||
base_url=base_url,
|
base_url=base_url,
|
||||||
@@ -342,6 +345,9 @@ class OpenAIResponsesLLMService(LLMService):
|
|||||||
if isinstance(self._settings.max_completion_tokens, int):
|
if isinstance(self._settings.max_completion_tokens, int):
|
||||||
params["max_output_tokens"] = self._settings.max_completion_tokens
|
params["max_output_tokens"] = self._settings.max_completion_tokens
|
||||||
|
|
||||||
|
if self._service_tier is not None:
|
||||||
|
params["service_tier"] = self._service_tier
|
||||||
|
|
||||||
# Tools
|
# Tools
|
||||||
tools = invocation_params.get("tools")
|
tools = invocation_params.get("tools")
|
||||||
if tools is not None and not isinstance(tools, type(NOT_GIVEN)):
|
if tools is not None and not isinstance(tools, type(NOT_GIVEN)):
|
||||||
|
|||||||
Reference in New Issue
Block a user