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

Suppress LLamaCpp stats output

How can I suppress LLamaCpp stats output in Langchain ... equivalent code : llm = LlamaCpp(model_path=..., ....) llm('who is Caesar') > who is Caesar ? Julius Caesar was a Roman general and statesman who played a critical role in the events that…
sten
  • 7,028
  • 9
  • 41
  • 63
2
votes
0 answers

ConversationalRetrievalChain vs LLMChain

I developed a script that worked just fine, it was as follows: def get_response_from_query(db, query, k=4): docs = db.similarity_search(query, k=k) docs_page_content = " ".join([d.page_content for d in docs]) chat =…
2
votes
2 answers

unable to pass prompt template to RetrievalQA in langchain

I am new to Langchain and followed this Retrival QA - Langchain. I have a custom prompt but when I try to pass Prompt with chain_type_kwargs its throws error in pydantic StufDocumentsChain. and on removing chain_type_kwargs itt just works. how can…
umair mehmood
  • 529
  • 2
  • 5
  • 17
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

Trying to get my agent_executor for a sql agent in langchain to accept Prompts and Chat History

The langchain, agent_executor, SQLDatabaseToolkit all working but I want to prompt it and keep chat history for follow up questions. For example place a prompt somewhere to push to use table x when asked about storage. It looks like this at the…
2
votes
0 answers

Doesn't read the model

I am writing a program in Python, I want to connect GPT4ALL so that the program works like a GPT chat, only locally in my programming environment. To do this, I already installed the GPT4All-13B-snoozy.ggmlv3.q4_0.bin model (here is the download…
Yulia
  • 51
  • 2
2
votes
1 answer

Make langchain to only generate Bigquery query

I am developing a langchain bot for BigQuery, using SQLDatabaseChain. However, I've noticed that sometimes the langchain generates queries with different syntax that is not supported in BigQuery. This can result in wasted OpenAI API credits. I have…
2
votes
2 answers

add memory to create_pandas_dataframe_agent in Langchain

I am trying to add memory to create_pandas_dataframe_agent to perform post processing on a model that I trained using Langchain. I am using the following code at the moment. from langchain.llms import OpenAI import pandas as pd df =…
Matt
  • 85
  • 6
2
votes
1 answer

WeaviateStartUpError: Weaviate did not start up in x seconds

So, I have this panel app on a .ypnb, that runs fine and comunicates to weaviate on port 8080 here's the working docker compose.yaml of the db: --- version: '3.4' services: weaviate: command: - --host - 0.0.0.0 - --port -…
2
votes
1 answer

How to add conversational memory to pandas toolkit agent?

I want to add a ConversationBufferMemory to pandas_dataframe_agent but so far I was unsuccessful. I have tried adding the memory via construcor: create_pandas_dataframe_agent(llm, df, verbose=True, memory=memory) which didn't break the code but…
Jakub Szlaur
  • 1,852
  • 10
  • 39
2
votes
1 answer

Getting embeddings of length 1 from Langchain OpenAIEmbeddings

I'm trying to use Langchain to create a vectorstore from scraped HTML pages, but I encountered an issue where I'm getting embeddings of length 1 when it should be 1536 per https://platform.openai.com/docs/guides/embeddings. Here's how my code…
Jay
  • 21
  • 2
2
votes
1 answer

How can I load scraped page content to langchain VectorstoreIndexCreator

I have a function which goes to url and crawls its content (+ from subpages). Then I want to load text content to langchain VectorstoreIndexCreator() . How can I do it via loader? I could not find any suitable loader in langchain.document_loaders.…
PetrSevcik
  • 89
  • 1
  • 9
2
votes
1 answer

How do you catch the duplicate id error when using langchain.vectorstores.Chroma.from_documents()

I use the following line to add langchain documents to a chroma database: Chroma.from_documents(docs, embeddings, ids=ids, persist_directory='db') when ids are duplicates, I get this error: chromadb.errors.IDAlreadyExistsError how do I catch the…
Suibhne
  • 21
  • 2
2
votes
1 answer

GGML (llama cpp) models become dumb when used in python

I am struggling with the issue of models not following instructions at all when they are used in Python, however, they work much better when they are used in a shell (like cmd, or powershell). python examples: Question: llm("Can you solve math…
2
votes
1 answer

Vector Stores storage in LangChain

I am working with LangChain for the first time. Due to data security, I want to be sure about the storage of langchain's vector store storage. I am using HNSWLib vector store, which mentions it is an in-memory store. What does it mean? Does…