mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-06 05:08:20 +00:00
core[patch]: Release 0.2.29 (#25126)
This commit is contained in:
parent
dff83cce66
commit
b4c12346cc
@ -327,15 +327,23 @@ def convert_to_openai_function(
|
|||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""Convert a raw function/class to an OpenAI function.
|
"""Convert a raw function/class to an OpenAI function.
|
||||||
|
|
||||||
|
.. versionchanged:: 0.2.29
|
||||||
|
|
||||||
|
``strict`` arg added.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
function: A dictionary, Pydantic BaseModel class, TypedDict class, a LangChain
|
function:
|
||||||
|
A dictionary, Pydantic BaseModel class, TypedDict class, a LangChain
|
||||||
Tool object, or a Python function. If a dictionary is passed in, it is
|
Tool object, or a Python function. If a dictionary is passed in, it is
|
||||||
assumed to already be a valid OpenAI function or a JSON schema with
|
assumed to already be a valid OpenAI function or a JSON schema with
|
||||||
top-level 'title' and 'description' keys specified.
|
top-level 'title' and 'description' keys specified.
|
||||||
strict: If True, model output is guaranteed to exactly match the JSON Schema
|
strict:
|
||||||
|
If True, model output is guaranteed to exactly match the JSON Schema
|
||||||
provided in the function definition. If None, ``strict`` argument will not
|
provided in the function definition. If None, ``strict`` argument will not
|
||||||
be included in function definition.
|
be included in function definition.
|
||||||
|
|
||||||
|
.. versionadded:: 0.2.29
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A dict version of the passed in function which is compatible with the OpenAI
|
A dict version of the passed in function which is compatible with the OpenAI
|
||||||
function-calling API.
|
function-calling API.
|
||||||
@ -393,18 +401,26 @@ def convert_to_openai_tool(
|
|||||||
) -> Dict[str, Any]:
|
) -> Dict[str, Any]:
|
||||||
"""Convert a raw function/class to an OpenAI tool.
|
"""Convert a raw function/class to an OpenAI tool.
|
||||||
|
|
||||||
|
.. versionchanged:: 0.2.29
|
||||||
|
|
||||||
|
``strict`` arg added.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
tool: Either a dictionary, a pydantic.BaseModel class, Python function, or
|
tool:
|
||||||
|
Either a dictionary, a pydantic.BaseModel class, Python function, or
|
||||||
BaseTool. If a dictionary is passed in, it is assumed to already be a valid
|
BaseTool. If a dictionary is passed in, it is assumed to already be a valid
|
||||||
OpenAI tool, OpenAI function, or a JSON schema with top-level 'title' and
|
OpenAI tool, OpenAI function, or a JSON schema with top-level 'title' and
|
||||||
'description' keys specified.
|
'description' keys specified.
|
||||||
strict: If True, model output is guaranteed to exactly match the JSON Schema
|
strict:
|
||||||
|
If True, model output is guaranteed to exactly match the JSON Schema
|
||||||
provided in the function definition. If None, ``strict`` argument will not
|
provided in the function definition. If None, ``strict`` argument will not
|
||||||
be included in tool definition.
|
be included in tool definition.
|
||||||
|
|
||||||
|
.. versionadded:: 0.2.29
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
A dict version of the passed in tool which is compatible with the
|
A dict version of the passed in tool which is compatible with the
|
||||||
OpenAI tool-calling API.
|
OpenAI tool-calling API.
|
||||||
"""
|
"""
|
||||||
if isinstance(tool, dict) and tool.get("type") == "function" and "function" in tool:
|
if isinstance(tool, dict) and tool.get("type") == "function" and "function" in tool:
|
||||||
return tool
|
return tool
|
||||||
|
@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|||||||
|
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "langchain-core"
|
name = "langchain-core"
|
||||||
version = "0.2.29rc1"
|
version = "0.2.29"
|
||||||
description = "Building applications with LLMs through composability"
|
description = "Building applications with LLMs through composability"
|
||||||
authors = []
|
authors = []
|
||||||
license = "MIT"
|
license = "MIT"
|
||||||
|
Loading…
Reference in New Issue
Block a user