langchain-ai / langchain-google

MIT License
104 stars 121 forks source link

not implemented error while using langchain llm.with_structured_output() with gemini-pro model. #214

Closed thenaivekid closed 1 month ago

thenaivekid commented 4 months ago

NotImplementedError Traceback (most recent call last) Cell In[8], line 21 18 # LLM with function call 19 # llm = ChatOpenAI(model="gpt-3.5-turbo-0125", temperature=0) 20 llm = GoogleGenerativeAI(model="gemini-pro", temperature=0.7) ---> 21 structured_llm_grader = llm.with_structured_output(GradeDocuments) 23 # Prompt 24 system = """You are a grader assessing relevance of a retrieved document to a user question. \n 25 If the document contains keyword(s) or semantic meaning related to the question, grade it as relevant. \n 26 Give a binary score 'yes' or 'no' score to indicate whether the document is relevant to the question."""

File c:\Users\Acer\AppData\Local\Programs\Python\Python311\Lib\site-packages\langchain_core\language_models\base.py:208, in BaseLanguageModel.with_structured_output(self, schema, kwargs) 204 def with_structured_output( 205 self, schema: Union[Dict, Type[BaseModel]], kwargs: Any 206 ) -> Runnable[LanguageModelInput, Union[Dict, BaseModel]]: 207 """Implement this if there is a way of steering the model to generate responses that match a given schema.""" # noqa: E501 --> 208 raise NotImplementedError()

NotImplementedError:

lkuligin commented 1 month ago

already added, closing this one.