Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds langchain_experimental and fixes SQLDatabaseChain #710

Closed
wants to merge 7 commits into from
74 changes: 45 additions & 29 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "langflow"
version = "0.4.0"
version = "0.3.4"
description = "A Python package with a built-in web application"
authors = ["Logspace <[email protected]>"]
maintainers = [
Expand Down Expand Up @@ -76,6 +76,7 @@ google-cloud-aiplatform = "^1.26.1"
psycopg = "^3.1.9"
psycopg-binary = "^3.1.9"
fastavro = "^1.8.0"
langchain-experimental = "^0.0.8"

[tool.poetry.group.dev.dependencies]
black = "^23.1.0"
Expand Down
4 changes: 4 additions & 0 deletions src/backend/langflow/interface/chains/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from langflow.utils.logger import logger
from langflow.utils.util import build_template_from_class, build_template_from_method
from langchain import chains
from langchain_experimental.sql import SQLDatabaseChain

# Assuming necessary imports for Field, Template, and FrontendNode classes

Expand Down Expand Up @@ -35,6 +36,9 @@ def type_to_loader_dict(self) -> Dict:
}
from langflow.interface.chains.custom import CUSTOM_CHAINS

# Now add from langchain_experimental.sql import SQLDatabaseChain
self.type_dict["SQLDatabaseChain"] = SQLDatabaseChain

self.type_dict.update(CUSTOM_CHAINS)
# Filter according to settings.chains
self.type_dict = {
Expand Down
7 changes: 4 additions & 3 deletions src/backend/langflow/interface/initialize/vector_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def initialize_pinecone(class_object: Type[Pinecone], params: dict):

import pinecone # type: ignore

pinecone_api_key = params.get("pinecone_api_key")
pinecone_env = params.get("pinecone_env")
pinecone_api_key = params.pop("pinecone_api_key", None)
pinecone_env = params.pop("pinecone_env", None)

if pinecone_api_key is None or pinecone_env is None:
if os.getenv("PINECONE_API_KEY") is not None:
Expand All @@ -141,7 +141,8 @@ def initialize_pinecone(class_object: Type[Pinecone], params: dict):

if pinecone_api_key is None or pinecone_env is None:
raise ValueError(
"Pinecone API key and environment must be provided in the params"
"Pinecone API key and environment must be provided through the component params"
" or through environment variables"
)

# initialize pinecone
Expand Down
Loading