Fix embedding function name in FAISS and update dependencies (#1169)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-12-01 22:19:04 -03:00 • committed by GitHub
commit b15854d77e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 736 additions and 725 deletions

1428
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
[tool.poetry] [tool.poetry]
name = "langflow" name = "langflow"
version = "0.5.8" version = "0.5.9"
description = "A Python package with a built-in web application" description = "A Python package with a built-in web application"
authors = ["Logspace <contact@logspace.ai>"] authors = ["Logspace <contact@logspace.ai>"]
maintainers = [ maintainers = [
@ -54,12 +54,12 @@ wikipedia = "^1.4.0"
qdrant-client = "^1.4.0" qdrant-client = "^1.4.0"
websockets = "^10.3" websockets = "^10.3"
weaviate-client = "^3.23.0" weaviate-client = "^3.23.0"
jina = "3.15.2" jina = "*"
sentence-transformers = { version = "^2.2.2", optional = true } sentence-transformers = { version = "^2.2.2", optional = true }
ctransformers = { version = "^0.2.10", optional = true } ctransformers = { version = "^0.2.10", optional = true }
cohere = "^4.27.0" cohere = "^4.27.0"
python-multipart = "^0.0.6" python-multipart = "^0.0.6"
sqlmodel = "^0.0.8" sqlmodel = "^0.0.12"
faiss-cpu = "^1.7.4" faiss-cpu = "^1.7.4"
anthropic = "^0.3.0" anthropic = "^0.3.0"
orjson = "3.9.3" orjson = "3.9.3"
@ -75,7 +75,7 @@ google-cloud-aiplatform = "^1.26.1"
psycopg = "^3.1.9" psycopg = "^3.1.9"
psycopg-binary = "^3.1.9" psycopg-binary = "^3.1.9"
fastavro = "^1.8.0" fastavro = "^1.8.0"
langchain-experimental = "^0.0.8" langchain-experimental = "*"
celery = { extras = ["redis"], version = "^5.3.1", optional = true } celery = { extras = ["redis"], version = "^5.3.1", optional = true }
redis = { version = "^4.6.0", optional = true } redis = { version = "^4.6.0", optional = true }
flower = { version = "^2.0.0", optional = true } flower = { version = "^2.0.0", optional = true }

View file

@ -1,17 +1,17 @@
from typing import Any, Callable, Dict, Type
from langchain.vectorstores import (
Pinecone,
Qdrant,
Chroma,
FAISS,
Weaviate,
SupabaseVectorStore,
MongoDBAtlasVectorSearch,
)
from langchain.schema import Document
import os import os
from typing import Any, Callable, Dict, Type
import orjson import orjson
from langchain.schema import Document
from langchain.vectorstores import (
FAISS,
Chroma,
MongoDBAtlasVectorSearch,
Pinecone,
Qdrant,
SupabaseVectorStore,
Weaviate,
)
def docs_in_params(params: dict) -> bool: def docs_in_params(params: dict) -> bool:
@ -28,8 +28,8 @@ def initialize_mongodb(class_object: Type[MongoDBAtlasVectorSearch], params: dic
MONGODB_ATLAS_CLUSTER_URI = params.pop("mongodb_atlas_cluster_uri") MONGODB_ATLAS_CLUSTER_URI = params.pop("mongodb_atlas_cluster_uri")
if not MONGODB_ATLAS_CLUSTER_URI: if not MONGODB_ATLAS_CLUSTER_URI:
raise ValueError("Mongodb atlas cluster uri must be provided in the params") raise ValueError("Mongodb atlas cluster uri must be provided in the params")
from pymongo import MongoClient
import certifi import certifi
from pymongo import MongoClient
client: MongoClient = MongoClient( client: MongoClient = MongoClient(
MONGODB_ATLAS_CLUSTER_URI, tlsCAFile=certifi.where() MONGODB_ATLAS_CLUSTER_URI, tlsCAFile=certifi.where()
@ -120,6 +120,7 @@ def initialize_faiss(class_object: Type[FAISS], params: dict):
return class_object.load_local return class_object.load_local
save_local = params.get("save_local") save_local = params.get("save_local")
params["embedding_function"] = params.pop("embedding")
faiss_index = class_object(**params) faiss_index = class_object(**params)
if save_local: if save_local:
faiss_index.save_local(folder_path=save_local) faiss_index.save_local(folder_path=save_local)