[Feat] Add Background mode for Responses API - OpenAI, AzureOpenAI (#11640)
* feat: add background as supported param responses create * add background param for responses API
This commit is contained in:
parent
ddf51d49e6
commit
f3f7bc1537
@ -36,6 +36,7 @@ class OpenAIResponsesAPIConfig(BaseResponsesAPIConfig):
|
||||
"previous_response_id",
|
||||
"reasoning",
|
||||
"store",
|
||||
"background",
|
||||
"stream",
|
||||
"temperature",
|
||||
"text",
|
||||
|
||||
@ -49,6 +49,7 @@ async def aresponses(
|
||||
previous_response_id: Optional[str] = None,
|
||||
reasoning: Optional[Reasoning] = None,
|
||||
store: Optional[bool] = None,
|
||||
background: Optional[bool] = None,
|
||||
stream: Optional[bool] = None,
|
||||
temperature: Optional[float] = None,
|
||||
text: Optional[ResponseTextConfigParam] = None,
|
||||
@ -93,6 +94,7 @@ async def aresponses(
|
||||
previous_response_id=previous_response_id,
|
||||
reasoning=reasoning,
|
||||
store=store,
|
||||
background=background,
|
||||
stream=stream,
|
||||
temperature=temperature,
|
||||
text=text,
|
||||
@ -148,6 +150,7 @@ def responses(
|
||||
previous_response_id: Optional[str] = None,
|
||||
reasoning: Optional[Reasoning] = None,
|
||||
store: Optional[bool] = None,
|
||||
background: Optional[bool] = None,
|
||||
stream: Optional[bool] = None,
|
||||
temperature: Optional[float] = None,
|
||||
text: Optional[ResponseTextConfigParam] = None,
|
||||
|
||||
@ -830,12 +830,12 @@ class OpenAIChatCompletionChunk(ChatCompletionChunk):
|
||||
|
||||
class Hyperparameters(BaseModel):
|
||||
batch_size: Optional[Union[str, int]] = None # "Number of examples in each batch."
|
||||
learning_rate_multiplier: Optional[
|
||||
Union[str, float]
|
||||
] = None # Scaling factor for the learning rate
|
||||
n_epochs: Optional[
|
||||
Union[str, int]
|
||||
] = None # "The number of epochs to train the model for"
|
||||
learning_rate_multiplier: Optional[Union[str, float]] = (
|
||||
None # Scaling factor for the learning rate
|
||||
)
|
||||
n_epochs: Optional[Union[str, int]] = (
|
||||
None # "The number of epochs to train the model for"
|
||||
)
|
||||
|
||||
|
||||
class FineTuningJobCreate(BaseModel):
|
||||
@ -862,18 +862,18 @@ class FineTuningJobCreate(BaseModel):
|
||||
|
||||
model: str # "The name of the model to fine-tune."
|
||||
training_file: str # "The ID of an uploaded file that contains training data."
|
||||
hyperparameters: Optional[
|
||||
Hyperparameters
|
||||
] = None # "The hyperparameters used for the fine-tuning job."
|
||||
suffix: Optional[
|
||||
str
|
||||
] = None # "A string of up to 18 characters that will be added to your fine-tuned model name."
|
||||
validation_file: Optional[
|
||||
str
|
||||
] = None # "The ID of an uploaded file that contains validation data."
|
||||
integrations: Optional[
|
||||
List[str]
|
||||
] = None # "A list of integrations to enable for your fine-tuning job."
|
||||
hyperparameters: Optional[Hyperparameters] = (
|
||||
None # "The hyperparameters used for the fine-tuning job."
|
||||
)
|
||||
suffix: Optional[str] = (
|
||||
None # "A string of up to 18 characters that will be added to your fine-tuned model name."
|
||||
)
|
||||
validation_file: Optional[str] = (
|
||||
None # "The ID of an uploaded file that contains validation data."
|
||||
)
|
||||
integrations: Optional[List[str]] = (
|
||||
None # "A list of integrations to enable for your fine-tuning job."
|
||||
)
|
||||
seed: Optional[int] = None # "The seed controls the reproducibility of the job."
|
||||
|
||||
|
||||
@ -938,6 +938,7 @@ class ResponsesAPIOptionalRequestParams(TypedDict, total=False):
|
||||
previous_response_id: Optional[str]
|
||||
reasoning: Optional[Reasoning]
|
||||
store: Optional[bool]
|
||||
background: Optional[bool]
|
||||
stream: Optional[bool]
|
||||
temperature: Optional[float]
|
||||
text: Optional[ResponseTextConfigParam]
|
||||
|
||||
@ -63,7 +63,7 @@ class TestOpenAIResponsesAPIConfig:
|
||||
def test_transform_responses_api_request(self):
|
||||
"""Test request transformation"""
|
||||
input_text = "What is the capital of France?"
|
||||
optional_params = {"temperature": 0.7, "stream": True}
|
||||
optional_params = {"temperature": 0.7, "stream": True, "background": True}
|
||||
|
||||
result = self.config.transform_responses_api_request(
|
||||
model=self.model,
|
||||
@ -79,6 +79,7 @@ class TestOpenAIResponsesAPIConfig:
|
||||
"input": input_text,
|
||||
"temperature": 0.7,
|
||||
"stream": True,
|
||||
"background": True,
|
||||
}
|
||||
|
||||
self.validate_responses_api_request_params(result, expected_fields)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user