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
0
votes
1 answer

How to include the inputs of the first chain to the second chain in LangChain's SequentialChain?

I receive a list of inputs ['a', 'b'] for the first chain in a SequentialChain, and then I have a second chain that receives as input ['a', 'c'], where c is the output of the first one. I see that SequentialChain passes only the outputs of the first…
cserpell
  • 716
  • 1
  • 7
  • 17
0
votes
0 answers

Unable to define "output_key" param of the LLM chain class for a csv agent while binding to SequentialChain class

Currently, I'm using SequentialChain class to combine two steps in my workflow. Step1: I'm using the LLM through prompt to identify the intent of the question posed by the user. Step2: I'm using the csv based agent to answer the question posed by…
0
votes
0 answers

prefix "Use " being added to agent action causing InvalidTool to be invoked again and again

I have added the tools named A_tool, default_tool to a ZeroShotAgent. The output from one of the execution looks like: Thought: We need to use the A_tool. Action: Use A_tool Observation: Use A_tool is not a valid tool, try another one. Thought:We…
Varun
  • 35
  • 4
0
votes
0 answers

In LangChain, how to restrict agent-generated code before execution in PythonREPLTool?

I am building an agent that can write and execute code with the PythonREPLTool to provide answers to questions. But I found that the agent often writes Python code that has "input()" to request input from the user. I do not want the agent to execute…
0
votes
1 answer

ModuleNotFoundError: No module named 'langchain.chains.question_answering' on Linode server using python 3.7.3 and langchain 0.0.27

I have made a Flask app, tested it on a local server and it works fine. Rented a server from Linode and wanted to deploy it there but ran into problems. Created a virtual environment just like I did on my computer, but the python version is 3.7.3…
0
votes
1 answer

Is it possible to give AzureChatOpenAI 'rules' to follow?

I am working on a 'chat bot' for a work project that will let me 'talk' with documents. Part of the project is being able to have the AI know when not to answer certain questions. Essentially, I want to protect PII due to HIPPA laws, so if a user…
0
votes
0 answers

Langchain vectorstore for chat history

I am trying to make a simple QA chatbot which is able to remember the past conversation and answer question about previous messages. I use Chromadb as a vectorstore to store the chat history and search relevant pieces of information when…
prime
  • 25
  • 4
0
votes
0 answers

Streaming summarization using Langchain

I have used following python code for summarization using Langchain with custom map-reduce method. I have list of chunks of large document. I need to stream final summarization output. But Its streaming summarization of every chunk in map operation…
CPD
  • 5
  • 2
0
votes
1 answer

VectorstoreIndexCreator no response (Python3)

Does anyone encounter the case that Vectorstoreindexcreator not responding? It doesnt going to the next line to execute and also not enter to the exception. Actually it runs well on my local window 11 Pro. The case occur when I run on window server…
dahlia
  • 11
  • 1
0
votes
0 answers

Modify LangChain's conversational agent to reply with emoticons

I'm creating a friendly chat with conversational agent in LangChain, but I want that AI answer me the greetings with emojis or use emojis while chatting. For example: -Me: Hello, how are you? -AI: I'm very well :) I have the following in my python…
0
votes
0 answers

Chatbot for question/answer with load_qa_chain fucntion, chat history exceed token limit

I just followed the example in the langchain documentation to create a basic QA chatbot. It works fine, but after a enough questions, chat history seem to become too big for the prompt and I get this error : This model's maximum context length is…
prime
  • 25
  • 4
0
votes
0 answers

Using embedded vectors components in a LLMChain along with regular prompt components

LangChain makes it straightforward to send output from one LLMChain object to the next using the SimpleSequentialChain function. This is a very simplified example: chain = [] pt = PromptTemplate(input_variables=["_prior"], template="{_prior}") #…
Buzz Moschetti
  • 7,057
  • 3
  • 23
  • 33
0
votes
0 answers

Chatting with PDFs using Lang chain

''' bot.gpt_turbo = Model_LLM(OPENAI_DEPLOYMENT_NAME, openai.api_version).model embeddings = OpenAIEmbeddings(model=OPENAI_EMBEDDING_MODEL_NAME) fileLoaded = FileLoader("Data/filename.pdf", TokenTextSplitter(chunk_size=1000,…
0
votes
0 answers

Langchain agent does not always use the tool correctly

Sometimes the Langchain Agent entering the custom tool with the input: "Invalid or incomplete response" Even if the LLM seems to use the tool correctly. Any idea why and how to fix that ? I would point out that sometimes everything works as…
0
votes
0 answers

Get data from multiple collection of PGVector using langchain

I have multiple collection in PGVector DB COLLECTION_NAME1 = "mydata1" COLLECTION_NAME2 = "mydata2" Now I am using PGVector method to load data from it based on the collection embeddings = OpenAIEmbeddings() store1 = PGVector( …