mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
feat(langchain,openai): add strict flag to ProviderStrategy structured output (#34149)
This commit is contained in:
@@ -1886,9 +1886,10 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
):
|
||||
# compat with langchain.agents.create_agent response_format, which is
|
||||
# an approximation of OpenAI format
|
||||
strict = response_format["json_schema"].get("strict", None)
|
||||
response_format = cast(dict, response_format["json_schema"]["schema"])
|
||||
kwargs["response_format"] = _convert_to_openai_response_format(
|
||||
response_format
|
||||
response_format, strict=strict
|
||||
)
|
||||
return super().bind(tools=formatted_tools, **kwargs)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user