Relative Content

Tag Archive for langchain

Using trim_messages and RunnableWithMessageHistory in LangChain together

from operator import itemgetter from langchain_core.runnables import RunnablePassthrough chain = ( RunnablePassthrough.assign(messages=itemgetter(“messages”) | trimmer) | prompt | model ) response = chain.invoke( { “messages”: messages + [HumanMessage(content=”what’s my name?”)], “language”: “English”, } ) The above code is from the LangChain documentation for creating a chatbot with memory. They use trim_messages to reduce the messages to […]

Querying a single column from the Excel file using LangChain

I have a regular .xlsx file that has just a few columns:
| Class | Name | Comments |
| — | — | —|
| 1 | Jack |Lorem ipsum dolor sit amet|
| 2 | Mary |Lorem ipsum dolor sit amet|
| 2 | Tony |Lorem ipsum dolor sit amet|
| … | …|Lorem ipsum dolor sit amet|

Loading Docs using langchain

When I run the following code block to load the docs using langchain, I get SSL verification error. I am not an expert using langchain. Please share tips on how to fix this issue.