Questions tagged [py-langchain]

LangChain is an open-source framework for developing applications powered by language models. Use this tag for the python-specific package.

LangChain is an open-source framework for developing applications powered by language models. Use this tag for the python-specific package.

Official Python LangChain documentation: https://python.langchain.com/en/latest/

153 questions
1
vote
1 answer

LangChain: ValueError: 'not' is not a valid parameter name

I am using 3.11.3 and langchain 0.0.166 on Windows. When I try and run from langchain.document_loaders import UnstructuredPDFLoader I get an error of ValueError "'not' is not a valid parameter name" It seems like FastAPI had this issue but it's…
A_Arnold
  • 3,195
  • 25
  • 39
1
vote
2 answers

Loading Google Flan models through Langchain HuggingFacePipeline throws error of unrecognized configuration class for AutoModelForCausalLM

Trying to load any Google Flan model through Langchain HuggingFacePipeline as shown below from langchain import HuggingFacePipeline llm = HuggingFacePipeline.from_model_id(model_id="google/flan-t5-xl", task="text-generation",…
Sanjay
  • 363
  • 1
  • 3
  • 14
0
votes
1 answer

Error "'tuple' object has no attribute 'page_content'" when using Weaviate.add_documents

I have the following piece of code: if file.filename.lower().endswith('.pdf'): pdf = ep.PDFLoad(file_path) # this is the loader from langchain doc = pdf.load() archivo =…
Gonzapepe
  • 1
  • 1
0
votes
0 answers

open ai llm model not responding using faiss db for few iteration in the start of a conversation

I am trying to build a pdf search and chatbot engine. In the beginning of my conversation if i ask my model to provide me pdf published in year 2020 it is not responding, but asking the same question 3 4 times it start responding. What could be the…
0
votes
0 answers

Optimize a "map reduce_documents chain" in LangChain by storing intermediate results

I have a long document and want to apply different map reduce document chains from LangChain to it. The 'map template' is always identical and can be generated in advance and cached. The various 'reduce prompts' can then be applied to the result of…
0
votes
0 answers

how to remove items from langchain memory

inside the langchain memory object there are different methods e.g. ConversationBufferMemory or ConversationBufferWindowMemory Regardless, if the conversation get long at somepoint I get the following error openai.error.InvalidRequestError: This…
Areza
  • 5,623
  • 7
  • 48
  • 79
0
votes
0 answers

How to Connect Langchain Database Agent with SqlServer

I need to connect my langchain database agent with my sqlserver database so that my agent can access the data, yet in the documention it does not explain how to do so, it only shows how to connect to sqlite like the following code: from…
0
votes
1 answer

Is there a way to save the state of an entire conversation with Langchain, including prompts?

hope you're having a great day. I would really appreciate if anyone here has the time to help me understand memory in LangChain. At a high level, what I want to be able to do is save the state of an entire conversation to a JSON file on my own…
0
votes
2 answers

Force LangChain agent to use a tool

Is there a way to force a LangChain agent to always use a tool? (my specific use case: I need the agent to look for information in my database as opposed to generally accessible information and my tool searches through my database)
gosia
  • 29
  • 3
0
votes
0 answers

How can I add an extra tool to CSVAgent or PandasDataFrameAgent from langchain library

I have a very simple code using the langchain library to query a pandas dataframe. model = AzureOpenAI( deployment_name="text-davinci-003", openai_api_version="2023-05-15", openai_api_key=MY_KEY, …
perly
  • 3
  • 3
0
votes
1 answer

How does PromptTemplate interact with RetrievalQA?

new to LangChain and I'm trying to create a simple QA bot (over documents). Following the documentation and guide on their website, I've created a simple working bot, but I'm struggling to understand certain parts of the code. template = """Use the…
whatsggon
  • 1
  • 3
0
votes
0 answers

Trouble with Inputs in MultiPromptChain Routing - Missing Input Keys Issue

I'm using multiple RetrievalQA chains, each with different formatting instructions and prompt templates. To handle this, I'm utilizing the MultiPromptChain from langchain to determine which chain to route the inputs to. However, when I attempt to…
0
votes
0 answers

Langchain JSONLoader Error: OSError: [Errno 63] File name too long:

Help me to solve this error, i need the json data to be stored in chromadb, it's not loading into loader here i'm using Langchain JSON import yfinance as yf import json from langchain import OpenAI from langchain.embeddings.sentence_transformer…
0
votes
1 answer

What is the difference between 'SQLDatabaseChain' and 'create_sql_agent' in langchain?

I'm creating a feature that uses 'LangChain' to turn user input questions into SQL. I know that 'create_sql_agent' has logic to fix any errors in the query answered by 'openai'. Is 'SQLDatabaseChain' not error correcting? If so, can using…
ykoo
  • 209
  • 2
  • 9
0
votes
0 answers

Langchain ChatPromptTemplate inside ConversationalRetrievalChain

i'm new to langchain and im trying to achieve PromptTemplate inside the ConversationalRetrievalChain. i figured that i should use combine_docs_chain_kwargs for this but i'm still getting an error.this is probably because of the input style. Please…
Niyas
  • 1
  • 1