mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-01 09:04:03 +00:00
Merge fc3c6902c3
into 0e287763cd
This commit is contained in:
commit
c8a34fa407
@ -1885,11 +1885,24 @@ class BaseChatOpenAI(BaseChatModel):
|
||||
"schema must be specified when method is not 'json_mode'. "
|
||||
"Received None."
|
||||
)
|
||||
|
||||
tool_name = convert_to_openai_tool(schema)["function"]["name"]
|
||||
base_url = (
|
||||
getattr(self, "openai_api_base", "")
|
||||
or getattr(self, "api_base", "")
|
||||
or ""
|
||||
).lower()
|
||||
# The Azure-Hosted Models routes to this function
|
||||
# so we need to set the tool_choice to required
|
||||
if "azure.com" in base_url:
|
||||
tool_choice_default = "required"
|
||||
else:
|
||||
tool_choice_default = tool_name
|
||||
|
||||
bind_kwargs = self._filter_disabled_params(
|
||||
**{
|
||||
**dict(
|
||||
tool_choice=tool_name,
|
||||
tool_choice=tool_choice_default,
|
||||
parallel_tool_calls=False,
|
||||
strict=strict,
|
||||
ls_structured_output_format={
|
||||
|
Loading…
Reference in New Issue
Block a user