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

LangChain, terminating a chain on specific tool output

Im using a conversational agent, with some tools, one of them is a calculator tool (for the sake of example). Agent initializated as follows: conversational_agent = initialize_agent( agent='chat-conversational-react-description', …
Aviran
  • 5,160
  • 7
  • 44
  • 76
3
votes
1 answer

Losing data of vector store Chromadb using Langchain

I am writing a question-answering bot using langchain. For storing my data in a database, I have chosen Chromadb. I have written the code below and it works fine persist_directory = "./db" embeddings = OpenAIEmbeddings() vectordb =…
kheirq
  • 31
  • 2
3
votes
1 answer

Giving SystemMessage/Context to ConversationalRetrievalChain and ConversationBufferMemory in Lang Chain

I'm trying to build a chatbot that can chat about pdfs, and I got it working with memory using ConversationBufferMemory and ConversationalRetrievalChain like in this example.…
Hudson Etkin
  • 127
  • 2
  • 8
3
votes
1 answer

Using Custom JSON data for context in Langchain and ConversationChain() in ChatGPT OpenAI

I have a custom JSON file which is created from an excel sheet which contains certain data on which I want my questions to be based on and off which I require answers from OpenAI. Now for this I have a piece of code as follows - s3 =…
2
votes
1 answer

Langchain: different knowledge depending on language

I'm trying to train a chatbot with domain-specific knowledge (in particular real estate in Switzerland). I created a chatbot, which I feed some information based on a PDF and then I'm running a chatbot with memory function. It works pretty well, in…
nicoe
  • 23
  • 4
2
votes
2 answers

Initialise qdrant for langchain

I want to experiment with adding my existing qdrant vector database to langchain for a chatGPT project. However, I cannot seem to find a way to initialise the Qdrant object without providing docs and embeddings, which seems weird to me, as I should…
MDan
  • 295
  • 2
  • 13
2
votes
1 answer

LangChain ConversationalRetrieval with JSONloader

I modified the data loader of this source code https://github.com/techleadhd/chatgpt-retrieval for ConversationalRetrievalChain to accept data as JSON. I created a dummy JSON file and according to the LangChain documentation, it fits JSON structure…
Utku Can
  • 683
  • 3
  • 12
2
votes
1 answer

UnstructuredURLLoader not able to see libmagic

I tried to use UnstructuredURLLoader as below from langchain.document_loaders import UnstructuredURLLoader loaders = UnstructuredURLLoader(urls=urls) data = loaders.load() but some pages report that libmagic is unavailable but assists in filetype…
mCs
  • 2,591
  • 6
  • 39
  • 66
2
votes
0 answers

Langchain prints Context before question and answer

import os import nltk from langchain import PromptTemplate, LLMChain from langchain.llms import GPT4All from langchain.callbacks.base import CallbackManager from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler from…
Abhishek Rai
  • 2,159
  • 3
  • 18
  • 38
2
votes
0 answers

Cant use streamlit fileuploader with langchian tranform loaders

i want to use st.file_uploader to upload a file based on the extension, use the necessary loader ex: The normal working is from langchain.document_loaders import PyPDFLoader loader = PyPDFLoader("example_data/layout-parser-paper.pdf") pages =…
Arshad
  • 35
  • 6
2
votes
1 answer

Combine vectore store into Langchain toolkit

Trying to have the agent use 2 vector stores as tools during its run. The files are in different folders out of necessity and they are different formats one is text and one is pdf. Thus why I need to somehow combine or tell the agent to use both. I…
2
votes
1 answer

Loading data using `UnstructuredURLLoader` of LangChain halts with `TP_NUM_C_BUFS too small: 50`

I am attempting to replicate the code provided in the documentation of LangChain (URL - LangChain 0.0.167) to enable loading HTML files from a list of URLs into a document format, which can then be processed by a sophisticated natural language…
2
votes
1 answer

Langchain - rely ONLY on the context

My goal is to make a ChatBot able to: have memory take as input some documents rely ONLY on the documents given and say "I don't know" when the information is not in the input documents. I found this tutorial, super useful:…
Carlo
  • 31
  • 3
1
vote
1 answer

Unable to pass session_attributes['session_context'] to the history of langchain using Amazon Lex and Langchain

`I tried saving the conversation history in session_attributes['sessionContext'] it worked but when logs are generated i can see conversation history in session_attributes['sessionContext'] but not in {history} i.e here only the current message…
1
vote
0 answers

Langchain Document loader is missing hyperlinks in the pdf file I have tried few loaders all have same problem

from langchain.document_loaders import UnstructuredPDFLoader files = os.listdir(pdf_folder_path) loaders = [UnstructuredPDFLoader(os.path.join(pdf_folder_path, fn)) for fn in files] docs = loader.load() The Docs here miss hyperlinks, I can get…
nithin
  • 753
  • 3
  • 7
  • 21
1
2
3
10 11