From b4c12346ccd5778e79f25f0faf0e2c4eb14465f6 Mon Sep 17 00:00:00 2001 From: Bagatur <22008038+baskaryan@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:50:20 -0700 Subject: [PATCH] core[patch]: Release 0.2.29 (#25126) --- .../langchain_core/utils/function_calling.py | 26 +++++++++++++++---- libs/core/pyproject.toml | 2 +- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/libs/core/langchain_core/utils/function_calling.py b/libs/core/langchain_core/utils/function_calling.py index b726aa00192..e4a7acabee9 100644 --- a/libs/core/langchain_core/utils/function_calling.py +++ b/libs/core/langchain_core/utils/function_calling.py @@ -327,15 +327,23 @@ def convert_to_openai_function( ) -> Dict[str, Any]: """Convert a raw function/class to an OpenAI function. + .. versionchanged:: 0.2.29 + + ``strict`` arg added. + 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 assumed to already be a valid OpenAI function or a JSON schema with 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 be included in function definition. + .. versionadded:: 0.2.29 + Returns: A dict version of the passed in function which is compatible with the OpenAI function-calling API. @@ -393,18 +401,26 @@ def convert_to_openai_tool( ) -> Dict[str, Any]: """Convert a raw function/class to an OpenAI tool. + .. versionchanged:: 0.2.29 + + ``strict`` arg added. + 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 OpenAI tool, OpenAI function, or a JSON schema with 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 be included in tool definition. + .. versionadded:: 0.2.29 + Returns: 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: return tool diff --git a/libs/core/pyproject.toml b/libs/core/pyproject.toml index 2e44a1528ff..057c74e0817 100644 --- a/libs/core/pyproject.toml +++ b/libs/core/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" [tool.poetry] name = "langchain-core" -version = "0.2.29rc1" +version = "0.2.29" description = "Building applications with LLMs through composability" authors = [] license = "MIT"