401 questions
1
vote
1
answer
40
views
agent.invoke() with Gemini gives inconsistent output types
I am using the LangChain 1.0 new agent = create_agent() method to create an agent but I am getting inconsistent output response types.
Case 1: str as output
When the user query is simple such as "...
1
vote
1
answer
256
views
ModuleNotFoundError when importing ConversationBufferMemory and ConversationalRetrievalChain from LangChain
I'm trying to import ConversationBufferMemory and ConversationalRetrievalChain in my Python notebook as follows:
from langchain.memory import ConversationBufferMemory
from langchain.chains import ...
-4
votes
1
answer
98
views
Troubles with the creation of tools and agents in langchain [closed]
I’m trying to create an agent in LangChain using Google Gemini, but I’m running into some issues because of the latest LangChain updates. As a result, I haven’t been able to create a chain with the ...
0
votes
1
answer
44
views
passing input_variables to Prompt template in langchain
I have code below in ReAct prompt template. I have input_variables like tools, tool_names, etc. But when we are calling, not all input_variables are passed. Then, to my understanding, it should throw ...
0
votes
0
answers
48
views
Langchain: How to let an AgentExecutor Propagate RunnableConfig["configurable"] to @tool?
I'm encountering a critical issue using LangChain's AgentExecutor where a dynamic, per-call variable passed via the config dictionary is not being propagated to a custom @tool called by the agent. ...
1
vote
0
answers
51
views
Why does my LangChain RAG chatbot sometimes miss relevant chunks in semantic search?
I built a RAG chatbot using LangChain + ChromaDB + OpenAI embeddings. The pipeline works, but sometimes the chatbot doesn’t return the most relevant PDF content, even though it exists in the vector DB....
1
vote
0
answers
65
views
How to let Gitlab/Langchain continue finding file?
I want to use Langchain to automatically update a helm chart via Gitlab-Python API. I realise it might work without langchain/llm with a more deterministic approach. However, i use it for testing ...
2
votes
2
answers
548
views
ValueError: variable agent_scratchpad should be a list of base messages, got of type <class 'str'>
This is a very basic example how I am trying to use langchain to invoke a llm and find the tool to use:
import asyncio
import json
from langchain.agents import AgentExecutor, ...
0
votes
1
answer
61
views
LangChain FAISS similarity_search returns empty list despite populated index
I’m trying to use LangChain with FAISS to build a simple document retriever. I’ve indexed several documents, but when I call similarity_search, I always get an empty list.
from langchain.embeddings....
1
vote
0
answers
161
views
Using a Global variable in a Prompt node in Langflow UI
I have defined a Global variable in Langflow, which is basically the API key of an API I want to call.
The API requires me to send the API key as a query param. So I am trying to use a prompt node to ...
1
vote
1
answer
80
views
How to find package version that is compatible with other package [closed]
How can I find the package version that can work with other package requirement. For my case, I have hard requirement for numpy==1.24.4 and I am looking to install langchain-core which the latest ...
0
votes
0
answers
51
views
LangChain - SQLDatabaseToolkit not join tables as expected
I have an agent with LangChain.
I have a database with these tables:
CREATE TABLE teams (
team_id INT PRIMARY KEY,
team_name VARCHAR(50) UNIQUE NOT NULL,
coach VARCHAR(50) NOT NULL
);
...
1
vote
1
answer
246
views
Running Ollama as a k8s STS with external script as entrypoint to load models
I manage to run Ollama as a k8s STS. I am using it for Python Langchain LLM/RAG application. However the following Dockerfile ENTRYPOINT script which tries to pull a list of images exported as MODELS ...
0
votes
0
answers
347
views
Google VertexAI InvalidArgument: 400 Request contains an invalid argument
I am using Google VertexAI gemini-2.0-flash with LangChain. I keep getting InvalidArgument: 400 Request contains an invalid argument error when making ainvoke, astream and with_structured_output to ...
0
votes
0
answers
26
views
Trying to deploy my first modal app with a chrona database but the data is not being used. Need help debugging retrieveInfoForQuery function?
I am having trouble figuring out why I can't see the print statements in the terminal for my retrieveInfoForQuery function and trying to figure out what is wrong. I have verified the chroma db is on ...
0
votes
1
answer
604
views
Facing ModuleNotFoundError: No module named 'ragas.metrics.critique'
I am getting below error when running the code snippet in AWS sagemaker JupyterLab notebook:
ModuleNotFoundError: No module named 'ragas.metrics.critique'
import warnings
warnings.filterwarnings('...
1
vote
1
answer
273
views
RegexTextSplitter does not exist in langchain_text_splitters?
Trying to import RegexTextSplitter using
from langchain.text_splitter import RegexTextSplitter ,RecursiveCharacterTextSplitter
And I get the error
from langchain.text_splitter import RegexTextSplitter ...
0
votes
1
answer
338
views
Python LangChain with Google google_vertexai or google_genai using API KEY?
How to use google_vertexai or google_genai with LangChain in Python? I get the following error:
USER_AGENT environment variable not set, consider setting it to identify your requests.
Traceback (most ...
1
vote
1
answer
305
views
Assistant: Error: fake_search is not a valid tool, try one of [tool]
I can't figure out how to use a custom function as a tool with langgraph + ChatOpenAI and Ollama. The "TavilySearchResults" and "DuckDuckGoSearchResults" community tools work fine,...
0
votes
1
answer
2k
views
BM25Retriever + ChromaDB Hybrid Search Optimization using LangChain
For those who have integrated the ChromaDB client with the Langchain framework, I am proposing the following approach to implement the Hybrid search (Vector Search + BM25Retriever):
from ...
0
votes
1
answer
350
views
Unable to log mlflow model when using databricks_langchain package
I am currently trying to work on the following code to log my Langchain - chain using mlflow. But it throws me following error while doing mlflow.langchain.log_model and I am not sure what exactly is ...
1
vote
1
answer
761
views
AgentState not properly initialized in LangGraph graph/node
I’m working on a LangGraph-based agent and running into an issue with state management when using LangGraph Studio. Specifically, I’m getting a KeyError: 'RAG_attempts' when my agent hits a downstream ...
0
votes
1
answer
270
views
How to check total no. of tokens while using Langchain's 'create_pandas_dataframe_agent'?
I am using langchain's create_pandas_dataframe_agent agent to analyse a dataframe. The code looks like below:
from langchain_experimental.agents import create_pandas_dataframe_agent
import pandas as ...
3
votes
1
answer
748
views
FlashrankRerank from LangChain initialization error
I am getting this error while trying intiliaze FlashrankRerank
PydanticUserError: FlashrankRerank is not fully defined; you should define Ranker, then call FlashrankRerank.model_rebuild()
This is my ...
0
votes
0
answers
130
views
Merge multiple FAISS chunks in a single chunk
I have loaded data in FAISS using the chunks as my data was very large. So, after the process 110 chunks have been made with respective .faiss & .pkl files. I have written this code
import faiss
...
5
votes
1
answer
3k
views
How does `llm.bind_tools` work in langchain?
I need to understand how exactly does langchain convert information from code to LLM prompt, because end of the day, the LLM will need only text to be passed to it.
If I am incorrect somewhere in my ...
0
votes
0
answers
76
views
aapply call failing in LLMChain - OpenAIObject
I had a working code to translate documents (pdf, docx and text). Suddenly since past few days, I am getting following error. There has been no change in the code.
Error in doc_translate_openai of ...
0
votes
1
answer
152
views
Issue with LangChain Agent: Email Sending Tool Not Following Established Rules
Problem Description:
I’m developing an agent using LangChain, langchain_openai, and a custom tool to send emails. The tool, named mail_tool, is designed to follow a strict set of rules and a specific ...
2
votes
1
answer
2k
views
Langchain tool calling not returning any content
I am trying to get Langchain working with tool calling. I've been following the tutorial on their website and am getting some unexpected behaviour.
This is the tutorial: https://python.langchain.com/...
0
votes
1
answer
995
views
How to Check if a Document Exists in a Chroma Vectorstore Using LangChain?
I am using a vectorstore of some documents in Chroma and implemented everything using the LangChain package. Here’s the package I am using:
from langchain_chroma import Chroma
I need to check if a ...
0
votes
0
answers
202
views
LangChain tools invoke - Template error: unknown filter: filter string is unknown
I am following the tutorial given here, trying to create a very simple tool-calling function. I have followed the code exactly, only changing the tool itself.
from langchain_huggingface import ...
0
votes
2
answers
1k
views
Using Langgraph - instruct Anthropic to disable parallel tool use
Using the Anthropic messsages API directly and providing multiple tools to the model, it's possible to instruct the model to only invoke one tool at a time by setting disable_parallel_tool_use=true in ...
0
votes
0
answers
365
views
Memory Management for FastAPI Langchain App
I have a Fast API Python app that streams output from a bot using Langchain and Langgraph, deployed on a Render Web Service (Currently free tier). Currently it uses threads to distinguish between ...
0
votes
0
answers
234
views
RAG with LangChain Chroma and Streamlit - st.session_state has no attribute "retriever"
I have the code to perform RAG on the Chroma DB collection with LangChain and Streamlit but I get an error as shown below:
An error occurred: st.session_state has no attribute "retriever". ...
1
vote
0
answers
354
views
How to stream openai response with metadata
I have implemented streaming response in our rag(Retrieval-Augmented-Generation) chatbot. However, I am unable to figure out a proper way to send the metadata information with the streaming response....
0
votes
0
answers
31
views
Workspace as a Task Webhook - pretty common
im looking for solution for My Asana-Langchain app.
Im trying to place a hook for all task in whole workspace, there is anyway to go over it?
Whats the best solution for it ? Im considering how im ...
0
votes
0
answers
61
views
Combing runnable sequence pipeline with constitutional chain
After updating my code to replace LLMChain (deprecated) with the new pipeline approach, I am getting an error because Constitutional Chain does expect the old LLMChain format. Can anyone suggest a ...
1
vote
1
answer
155
views
Receiving attribute error that the type object 'Pinecone' has no attribute 'from_existing_index'
I'm following a git repo and learning how to make a chatbot using pinecone and llama-2, but I'm getting an attribute error while using the Pinecone module, even though I've copied the same code as ...
0
votes
2
answers
375
views
How the recursive text splitter in langchain works?
While learning text splitter, i got a doubt, here is the code below
from langchain.text_splitter import RecursiveCharacterTextSplitter
rsplitter = RecursiveCharacterTextSplitter(chunk_size=10,...
0
votes
1
answer
221
views
langchain: 'NoneType' object is not iterable
async def get_response(self, messages, model):
try:
memory = self.memory
llm = ChatOllama(model=model)
config = {"configurable": {"thread_id&...
3
votes
1
answer
6k
views
`ConversationSummaryBufferMemory` is not fully defined; you should define `BaseCache`, then call `ConversationSummaryBufferMemory.model_rebuild()`
I am attempting to use LangChain's ConversationSummaryBufferMemory and running into this error:
pydantic.errors.PydanticUserError: `ConversationSummaryBufferMemory` is not fully defined; you should ...
2
votes
0
answers
498
views
Langchain : troubles to pass a custom runtime arguments to tools, via an AgentExecutor
First of all, let's see how I set up my tool, model, agent, callback handler and AgentExecutor :
Tool :
from datetime import datetime
from typing import Literal, Annotated
from langchain_core.tools ...
0
votes
2
answers
3k
views
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (tiktoken)
I am trying to install langchain_openai in my local machine with the python version 3.9
using pip
i passed below command:
pip install langchain_openai
I am getting below error
ERROR: ERROR: Failed to ...
0
votes
2
answers
454
views
Getting Document Similarity Scores with SelfQueryRetriever - Langchain
I want to be able to get the similarity scores of the retrieved documents when using the SelfQueryRetriever as seen below.
I have made a selfquery retriever as follows:
retriever = SelfQueryRetriever....
-1
votes
1
answer
643
views
Dependencies problem, github Asana Could not import sentence_transformers python package. Please install it with `pip install sentence-transformers`
just started to learn LangChain and move my project onto langchain.
To keep moving forward i got this github project:
https://github.com/Cbase-ai/asana-task-agent
I do install everything. What ...
1
vote
2
answers
257
views
How do I store the output of a lang chain pandas dataframe agent to a variable?
I am currently using two data frames and I wish to compare two columns across them, and then create an output variable. However, I want to store the output in the form of a pandas dataframe, or ...
0
votes
0
answers
230
views
ModuleNotFoundError: No module named 'langchain.embeddings'
I am using python 3.7.16 in a virtual environment (venv). Upon running the code below I get into an error regarding the langchain.embeddings module. I cannot upgrade langchain higher than 0.0.27, ...
0
votes
0
answers
115
views
Issues with PDF extraction using pdfminer in a Telegram bot with Langchain
I'm developing a Telegram bot that allows users to send PDF files. The bot should extract text from the PDFs using pdfminer and respond to user queries. However, I'm facing dependency issues, ...
2
votes
0
answers
841
views
Trying to build Text to SQL using ollama mistral and create_sql_agent
I am trying to build one text to sql app where I have used ollama and mistral.
Now without agent it is sql queries but sometime it is generating table names which is not present in the db and ...
0
votes
0
answers
108
views
How to resolve KeyError when chaining llmss
I'm trying to create a process where I can break down a user query into multiple searchable queries using LLMs and then fetch the results online. I've set up two chains for extracting information and ...