Questions tagged [langchain]

LangChain is an open-source framework for developing applications powered by language models. Use [py-langchain] for the python-specific package.

LangChain is an open-source framework for developing applications powered by language models. Use [py-langchain] for the python-specific package.

672 questions
4
votes
1 answer

ValueError: `run` not supported when there is not exactly one output key. Got ['answer', 'sources', 'source_documents']. (langchain/Streamlit)

I got an error says ValueError: `run` not supported when there is not exactly one output key. Got ['answer', 'sources', 'source_documents']. Here's the traceback error File…
naranara
  • 151
  • 1
  • 10
4
votes
1 answer

AzureOpenAI and LangChain Weird, multiple answers

I'm using AzureOpenAI to test LangChain's Self Critique using Constitution. It all works, except I get more than one answer, and the weirdest part, it GENERATES random, unwanted questions, and answer them. Here is my Python code (I replaced…
4
votes
2 answers

ValueError: `run` not supported when there is not exactly one input key, got ['question', 'documents']

Getting the error while trying to run a langchain code. ValueError: `run` not supported when there is not exactly one input key, got ['question', 'documents']. Traceback: File…
Daremitsu
  • 545
  • 2
  • 8
  • 24
4
votes
1 answer

Get all documents from ChromaDb using Python and langchain

I'm using langchain to process a whole bunch of documents which are in an Mongo database. I can load all documents fine into the chromadb vector storage using langchain. Nothing fancy being done here. This is my code: from…
user791793
  • 413
  • 1
  • 6
  • 19
4
votes
2 answers

How to add prompt to Langchain ConversationalRetrievalChain chat over docs with history?

Langchain have added this function ConversationalRetrievalChain which is used to chat over docs with history. According to their documentation here ConversationalRetrievalChain I need to pass prompts which are instructions to the function. How can i…
4
votes
0 answers

LangChain losing context and timing out when using memory with agent

I've got a function that initializes an agent and makes a call to get the generated reply. It uses a tool that creates structured output from the user's input. Using this without any memory context works fine - a response is returned in the expected…
DeonV
  • 192
  • 6
4
votes
1 answer

langchain with context and memory

I'm attempting to modify an existing Colab example to combine langchain memory and also context document loading. In two separate tests, each instance works perfectly. Now I'd like to combine the two (training context loading and conversation…
Chris Vorster
  • 41
  • 1
  • 2
4
votes
5 answers

Langchain's AzureOpenAI error: Resource not found

I’m trying to use LangChain’s AzureOpenAI as below but getting this error. Do you know how can I fix this? openai.error.InvalidRequestError: Resource not found # Import Azure OpenAI from langchain.llms import AzureOpenAI import openai import…
user2467491
  • 73
  • 1
  • 7
4
votes
3 answers

Use of UnstructuredPDFLoader unstructured package not found, please install it with `pip install unstructured

I just have a newly created Environment in Anaconda (conda 22.9.0 and Python 3.10.10). Then I proceed to install langchain (pip install langchain if I try conda install langchain it does not work). According to the quickstart guide I have to install…
Edu
  • 159
  • 1
  • 14
3
votes
1 answer

Why is RecursiveCharacterTextSplitter not giving any chunk overlap?

I am trying to create chunks (max) 350 characters long with 100 chunk overlap. I understand that chunk_size is an upper limit, so I may get chunks shorter than that. But why am I not getting any chunk_overlap? Is it because the overlap also has to…
codeananda
  • 939
  • 1
  • 10
  • 16
3
votes
3 answers

langchain's chroma `vectordb.similarity_search_with_score()` and `vectordb.similarity_search_with_relevancy_scores()` returns the same output

I have been working with langchain's chroma vectordb. It has two methods for running similarity search with scores. vectordb.similarity_search_with_score() vectordb.similarity_search_with_relevance_scores() According to the documentation, the…
botaskay
  • 144
  • 1
  • 1
  • 7
3
votes
0 answers

LangChain with ConversationBufferMemory in Streamlit application does not work

I have a streamlit chatbot that works perfectly fine but does not remember previous chat history. I was trying to add it with langchain ConversationBufferMemory but it does not seem to work. Here is a sample of chatbot I created: import streamlit as…
illuminato
  • 1,057
  • 1
  • 11
  • 33
3
votes
0 answers

How can I turn off console output from GPT4ALL?

So I am using GPT4ALL for a project and its very annoying to have the output of gpt4all loading in a model everytime I do it, also for some reason I am also unable to set verbose to False, although this might be an issue with the way that I am using…
Ethan
  • 51
  • 2
3
votes
2 answers

Deploying (and hosting) a LangChain code on StreamLit throws PydanticUserError

I built a pdf document question-answering using LangChain, OpenAI (embeddings and LLM) and Chroma (for storing the vector embeddings) and UI with StreamLit. I am trying to deploy and host the webapp using StreamLit cloud services. And on installing…
3
votes
0 answers

Dynamically add more embedding of new document in chroma DB - Langchain

I have created a retrieval QA Chain which uses chromadb as vector DB for storing embeddings of "abc.txt" file. What if I want to dynamically add more document embeddings of let's say another file "def.txt"? How to do that? I don't want to reload the…
Jason
  • 676
  • 1
  • 12
  • 34
1 2
3
44 45