mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-07 05:52:15 +00:00
openai[patch]: fix schema formatting util (#27685)
This commit is contained in:
@@ -2143,9 +2143,13 @@ def _convert_to_openai_response_format(
|
||||
if isinstance(schema, type) and is_basemodel_subclass(schema):
|
||||
return schema
|
||||
|
||||
if "json_schema" in schema and schema.get("type") == "json_schema":
|
||||
if (
|
||||
isinstance(schema, dict)
|
||||
and "json_schema" in schema
|
||||
and schema.get("type") == "json_schema"
|
||||
):
|
||||
response_format = schema
|
||||
elif "name" in schema and "schema" in schema:
|
||||
elif isinstance(schema, dict) and "name" in schema and "schema" in schema:
|
||||
response_format = {"type": "json_schema", "json_schema": schema}
|
||||
else:
|
||||
strict = strict if strict is not None else True
|
||||
|
Reference in New Issue
Block a user