mirror of
https://github.com/langchain-ai/langserve.git
synced 2026-07-16 09:34:30 -04:00
Langchain v1.17 depreciation issue with Langserve: Importing GuardrailsOutputParser from langchain.output_parsers is deprecated #173
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @saurabhlalsaxena on GitHub (May 2, 2024).
Since I have upgraded to Langchain v1.17, when ever I start the serve with : "langchain serve", I get the below deprecation warning:
/usr/local/lib/python3.10/dist-packages/langchain/_api/module_import.py:87: LangChainDeprecationWarning: Importing GuardrailsOutputParser from langchain.output_parsers is deprecated. Please replace the import with the following:
from langchain_community.output_parsers.rail_parser import GuardrailsOutputParser
warnings.warn(
My requirements file is as below:
chromadb==0.5.0
fastapi==0.110.3
langchain==0.1.17
langchain-cli==0.0.21
langchain-community==0.0.36
langchain-core==0.1.48
langchain-experimental==0.0.57
langchain-openai==0.1.4
langchain-text-splitters==0.0.1
langgraph==0.0.40
langserve==0.1.1
openai==1.25.0
opentelemetry-instrumentation-fastapi==0.45b0
pypdf==4.2.0
python-dotenv==1.0.1
python-multipart==0.0.9
uvicorn==0.23.2
Is there a way to avoid the warning?
@eyurtsev commented on GitHub (May 2, 2024):
Ah downgrade for now to previous langchain version maybe 1.16 -- i need to fix this in langchain
@eyurtsev commented on GitHub (May 3, 2024):
Actually just to double check do you have an import in your own code that looks like this:
from langchain.output_parsers import GuardrailsOutputParserinstead of importing it from community?
(Want to make sure that this is not in user code)
@saurabhlalsaxena commented on GitHub (May 3, 2024):
I have double checked it in my code, I don't believe I am importing GuardrailsOutputParser.
I have imported JsonOutputFunctionsParser from langchain.output_parsers
and I am using the create_csv_agent
from langchain_experimental.agents.agent_toolkits import create_csv_agent
But I haven't imported GuardrailsOutputParser in my code.
Please let me know if this might be an issue at my end.
@saurabhlalsaxena commented on GitHub (May 3, 2024):
When I am search for it in my code. VS code is showing me that it is present in a file called rail_parser.py. Below is the import statement from the __init__.py file of output_parsers.
from langchain.output_parsers.rail_parser import GuardrailsOutputParser
So it is part of the langchain lib files and not being called in my code separately.
Hope this helps
@saurabhlalsaxena commented on GitHub (May 3, 2024):
The problem seems to be in the below __init__.py file for langchain.output_parsers.
There is deprecated lookup for GaurdrailsOutputParser. I am guessing it is for testing as no other module is being checked.
Not sure.
@eyurtsev commented on GitHub (May 3, 2024):
Thanks! I'll fix in a bit!
@eyurtsev commented on GitHub (May 3, 2024):
Fix merged.