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

@@ -1090,7 +1090,7 @@ class ChatOllama(BaseChatModel):
llm = self.bind_tools(
[schema],
tool_choice=tool_name,
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": formatted_tool,
},
@@ -1107,7 +1107,7 @@ class ChatOllama(BaseChatModel):
elif method == "json_mode":
llm = self.bind(
format="json",
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": schema,
},
@@ -1127,7 +1127,7 @@ class ChatOllama(BaseChatModel):
schema = cast(TypeBaseModel, schema)
llm = self.bind(
format=schema.model_json_schema(),
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": schema,
},
@@ -1148,7 +1148,7 @@ class ChatOllama(BaseChatModel):
response_format = schema
llm = self.bind(
format=response_format,
structured_output_format={
ls_structured_output_format={
"kwargs": {"method": method},
"schema": response_format,
},