mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
multiple: structured output tracing standard metadata (#29421)
Co-authored-by: Chester Curme <chester.curme@gmail.com>
This commit is contained in:
@@ -965,8 +965,16 @@ class ChatFireworks(BaseChatModel):
|
||||
"schema must be specified when method is 'function_calling'. "
|
||||
"Received None."
|
||||
)
|
||||
tool_name = convert_to_openai_tool(schema)["function"]["name"]
|
||||
llm = self.bind_tools([schema], tool_choice=tool_name)
|
||||
formatted_tool = convert_to_openai_tool(schema)
|
||||
tool_name = formatted_tool["function"]["name"]
|
||||
llm = self.bind_tools(
|
||||
[schema],
|
||||
tool_choice=tool_name,
|
||||
structured_output_format={
|
||||
"kwargs": {"method": "function_calling"},
|
||||
"schema": formatted_tool,
|
||||
},
|
||||
)
|
||||
if is_pydantic_schema:
|
||||
output_parser: OutputParserLike = PydanticToolsParser(
|
||||
tools=[schema], # type: ignore[list-item]
|
||||
@@ -977,7 +985,13 @@ class ChatFireworks(BaseChatModel):
|
||||
key_name=tool_name, first_tool_only=True
|
||||
)
|
||||
elif method == "json_mode":
|
||||
llm = self.bind(response_format={"type": "json_object"})
|
||||
llm = self.bind(
|
||||
response_format={"type": "json_object"},
|
||||
structured_output_format={
|
||||
"kwargs": {"method": "json_mode"},
|
||||
"schema": schema,
|
||||
},
|
||||
)
|
||||
output_parser = (
|
||||
PydanticOutputParser(pydantic_object=schema) # type: ignore[type-var, arg-type]
|
||||
if is_pydantic_schema
|
||||
|
||||
Reference in New Issue
Block a user