@@ -37,7 +37,7 @@ def __init__(api_key: Secret = Secret.from_env_var("TOGETHER_API_KEY"),
3737 api_base_url : Optional[str ] = " https://api.together.xyz/v1" ,
3838 streaming_callback : Optional[StreamingCallbackT] = None ,
3939 system_prompt : Optional[str ] = None ,
40- generation_kwargs : Optional[Dict [str , Any]] = None ,
40+ generation_kwargs : Optional[dict [str , Any]] = None ,
4141 timeout : Optional[float ] = None ,
4242 max_retries : Optional[int ] = None )
4343```
@@ -82,7 +82,7 @@ inferred from the `OPENAI_MAX_RETRIES` environment variable or set to 5.
8282#### TogetherAIGenerator.to\_ dict
8383
8484``` python
85- def to_dict () -> Dict [str , Any]
85+ def to_dict () -> dict [str , Any]
8686```
8787
8888Serialize this component to a dictionary.
@@ -230,11 +230,11 @@ def __init__(*,
230230 model : str = " meta-llama/Llama-3.3-70B-Instruct-Turbo" ,
231231 streaming_callback : Optional[StreamingCallbackT] = None ,
232232 api_base_url : Optional[str ] = " https://api.together.xyz/v1" ,
233- generation_kwargs : Optional[Dict [str , Any]] = None ,
233+ generation_kwargs : Optional[dict [str , Any]] = None ,
234234 tools : Optional[ToolsType] = None ,
235235 timeout : Optional[float ] = None ,
236236 max_retries : Optional[int ] = None ,
237- http_client_kwargs : Optional[Dict [str , Any]] = None )
237+ http_client_kwargs : Optional[dict [str , Any]] = None )
238238```
239239
240240Creates an instance of TogetherAIChatGenerator. Unless specified otherwise,
@@ -263,6 +263,13 @@ Some of the supported parameters:
263263 events as they become available, with the stream terminated by a data: [ DONE] message.
264264- ` safe_prompt ` : Whether to inject a safety prompt before all conversations.
265265- ` random_seed ` : The seed to use for random sampling.
266+ - ` response_format ` : A JSON schema or a Pydantic model that enforces the structure of the model's response.
267+ If provided, the output will always be validated against this
268+ format (unless the model returns a tool call).
269+ For details, see the [ OpenAI Structured Outputs documentation] ( https://platform.openai.com/docs/guides/structured-outputs ) .
270+ Notes:
271+ - For structured outputs with streaming,
272+ the ` response_format ` must be a JSON schema and not a Pydantic model.
266273- ` tools ` : A list of Tool and/or Toolset objects, or a single Toolset for which the model can prepare calls.
267274Each tool should have a unique name.
268275- ` timeout ` : The timeout for the Together AI API call.
@@ -276,7 +283,7 @@ For more information, see the [HTTPX documentation](https://www.python-httpx.org
276283#### TogetherAIChatGenerator.to\_ dict
277284
278285``` python
279- def to_dict () -> Dict [str , Any]
286+ def to_dict () -> dict [str , Any]
280287```
281288
282289Serialize this component to a dictionary.
0 commit comments