Model wrapper that returns outputs formatted to match the given schema for Preplexity. Currently, Perplexity only supports "json_schema" method for structured output as per their official documentation.
with_structured_output(
self,
schema: _DictOrPydanticClass | None = None,
*,
method: Literal['json_schema'] = 'json_schema',
include_raw: bool = False,
strict: bool | None = None,
**kwargs: Any = {}
) -> Runnable[LanguageModelInput, _DictOrPydantic]| Name | Type | Description |
|---|---|---|
schema | _DictOrPydanticClass | None | Default: NoneThe output schema. Can be passed in as:
|
method | Literal['json_schema'] | Default: 'json_schema'The method for steering model generation, currently only support:
|
include_raw | bool | Default: FalseIf If an error occurs during model output parsing it will be raised. If If an error occurs during output parsing it will be caught and returned as well. The final output is always a |
strict | bool | None | Default: NoneUnsupported: whether to enable strict schema adherence when generating the output. This parameter is included for compatibility with other chat models, but is currently ignored. |
kwargs | Any | Default: {}Additional keyword args aren't supported. |