core[patch]: update structured output tracing (#30123)

- Trace JSON schema in `options`
- Rename to `ls_structured_output_format`
This commit is contained in:
ccurme
2025-03-07 13:05:25 -05:00
committed by GitHub
parent d0f5bcda29
commit 806211475a
13 changed files with 184 additions and 714 deletions

View File

@@ -1431,7 +1431,7 @@ class BaseChatOpenAI(BaseChatModel):
tool_choice=tool_name,
parallel_tool_calls=False,
strict=strict,
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": schema,
},
@@ -1450,7 +1450,7 @@ class BaseChatOpenAI(BaseChatModel):
elif method == "json_mode":
llm = self.bind(
response_format={"type": "json_object"},
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": schema,
},
@@ -1469,7 +1469,7 @@ class BaseChatOpenAI(BaseChatModel):
response_format = _convert_to_openai_response_format(schema, strict=strict)
llm = self.bind(
response_format=response_format,
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": convert_to_openai_tool(schema),
},