From 080741d336cc1e190db7ed3fceb3887dee7af7ec Mon Sep 17 00:00:00 2001 From: James Espichan Vilca <84110446+jamesev15@users.noreply.github.com> Date: Fri, 23 Aug 2024 16:06:39 -0500 Subject: [PATCH] core[patch]: Fix type for inner input in base prompts (#25713) Thank you for contributing to LangChain! - [ ] **PR title**: "langchain-core: Fix type" - The file to modify is located in /libs/core/langchain_core/prompts/base.py - [ ] **PR message**: - **Description:** The change is a type for the inner input variable, the type go from dict to Any. This change is required since the method _validate input expects a type that is not only a dictionary. - **Dependencies:** There are no dependencies for this change - [ ] **Add tests and docs**: 1. A test is not needed. This error occurs because I overrode a portion of the _validate_input method, which is causing a 'beartype' to raise an error. --- libs/core/langchain_core/prompts/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/core/langchain_core/prompts/base.py b/libs/core/langchain_core/prompts/base.py index 8ba8e5607116c..66c65b9b5a004 100644 --- a/libs/core/langchain_core/prompts/base.py +++ b/libs/core/langchain_core/prompts/base.py @@ -129,7 +129,7 @@ def get_input_schema( "PromptInput", **{**required_input_variables, **optional_input_variables} ) - def _validate_input(self, inner_input: Dict) -> Dict: + def _validate_input(self, inner_input: Any) -> Dict: if not isinstance(inner_input, dict): if len(self.input_variables) == 1: var_name = self.input_variables[0]