mirror of
https://github.com/langgenius/dify.git
synced 2024-11-16 03:32:23 +08:00
dep: bump pgvecto-rs client from 0.1.x to 0.2.x (#6891)
This commit is contained in:
parent
7ab04e17e7
commit
6aa02f8c63
|
@ -4,7 +4,7 @@ from typing import Any
|
||||||
from uuid import UUID, uuid4
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
from numpy import ndarray
|
from numpy import ndarray
|
||||||
from pgvecto_rs.sqlalchemy import Vector
|
from pgvecto_rs.sqlalchemy import VECTOR
|
||||||
from pydantic import BaseModel, model_validator
|
from pydantic import BaseModel, model_validator
|
||||||
from sqlalchemy import Float, String, create_engine, insert, select, text
|
from sqlalchemy import Float, String, create_engine, insert, select, text
|
||||||
from sqlalchemy import text as sql_text
|
from sqlalchemy import text as sql_text
|
||||||
|
@ -67,7 +67,7 @@ class PGVectoRS(BaseVector):
|
||||||
)
|
)
|
||||||
text: Mapped[str] = mapped_column(String)
|
text: Mapped[str] = mapped_column(String)
|
||||||
meta: Mapped[dict] = mapped_column(postgresql.JSONB)
|
meta: Mapped[dict] = mapped_column(postgresql.JSONB)
|
||||||
vector: Mapped[ndarray] = mapped_column(Vector(dim))
|
vector: Mapped[ndarray] = mapped_column(VECTOR(dim))
|
||||||
|
|
||||||
self._table = _Table
|
self._table = _Table
|
||||||
self._distance_op = "<=>"
|
self._distance_op = "<=>"
|
||||||
|
|
|
@ -105,7 +105,7 @@ class RelytVector(BaseVector):
|
||||||
redis_client.set(collection_exist_cache_key, 1, ex=3600)
|
redis_client.set(collection_exist_cache_key, 1, ex=3600)
|
||||||
|
|
||||||
def add_texts(self, documents: list[Document], embeddings: list[list[float]], **kwargs):
|
def add_texts(self, documents: list[Document], embeddings: list[list[float]], **kwargs):
|
||||||
from pgvecto_rs.sqlalchemy import Vector
|
from pgvecto_rs.sqlalchemy import VECTOR
|
||||||
|
|
||||||
ids = [str(uuid.uuid1()) for _ in documents]
|
ids = [str(uuid.uuid1()) for _ in documents]
|
||||||
metadatas = [d.metadata for d in documents]
|
metadatas = [d.metadata for d in documents]
|
||||||
|
@ -118,7 +118,7 @@ class RelytVector(BaseVector):
|
||||||
self._collection_name,
|
self._collection_name,
|
||||||
Base.metadata,
|
Base.metadata,
|
||||||
Column("id", TEXT, primary_key=True),
|
Column("id", TEXT, primary_key=True),
|
||||||
Column("embedding", Vector(len(embeddings[0]))),
|
Column("embedding", VECTOR(len(embeddings[0]))),
|
||||||
Column("document", String, nullable=True),
|
Column("document", String, nullable=True),
|
||||||
Column("metadata", JSON, nullable=True),
|
Column("metadata", JSON, nullable=True),
|
||||||
extend_existing=True,
|
extend_existing=True,
|
||||||
|
@ -169,7 +169,7 @@ class RelytVector(BaseVector):
|
||||||
Args:
|
Args:
|
||||||
ids: List of ids to delete.
|
ids: List of ids to delete.
|
||||||
"""
|
"""
|
||||||
from pgvecto_rs.sqlalchemy import Vector
|
from pgvecto_rs.sqlalchemy import VECTOR
|
||||||
|
|
||||||
if ids is None:
|
if ids is None:
|
||||||
raise ValueError("No ids provided to delete.")
|
raise ValueError("No ids provided to delete.")
|
||||||
|
@ -179,7 +179,7 @@ class RelytVector(BaseVector):
|
||||||
self._collection_name,
|
self._collection_name,
|
||||||
Base.metadata,
|
Base.metadata,
|
||||||
Column("id", TEXT, primary_key=True),
|
Column("id", TEXT, primary_key=True),
|
||||||
Column("embedding", Vector(self.embedding_dimension)),
|
Column("embedding", VECTOR(self.embedding_dimension)),
|
||||||
Column("document", String, nullable=True),
|
Column("document", String, nullable=True),
|
||||||
Column("metadata", JSON, nullable=True),
|
Column("metadata", JSON, nullable=True),
|
||||||
extend_existing=True,
|
extend_existing=True,
|
||||||
|
|
21
api/poetry.lock
generated
21
api/poetry.lock
generated
|
@ -5619,23 +5619,25 @@ files = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pgvecto-rs"
|
name = "pgvecto-rs"
|
||||||
version = "0.1.4"
|
version = "0.2.1"
|
||||||
description = "Python binding for pgvecto.rs"
|
description = "Python binding for pgvecto.rs"
|
||||||
optional = false
|
optional = false
|
||||||
python-versions = ">=3.8"
|
python-versions = "<3.13,>=3.8"
|
||||||
files = [
|
files = [
|
||||||
{file = "pgvecto_rs-0.1.4-py3-none-any.whl", hash = "sha256:9b08a9e612f0cd65d1cc6e17a35b9bb5956187e0e3981bf6e997ff9e615c6116"},
|
{file = "pgvecto_rs-0.2.1-py3-none-any.whl", hash = "sha256:b3ee2c465219469ad537b3efea2916477c6c576b3d6fd4298980d0733d12bb27"},
|
||||||
{file = "pgvecto_rs-0.1.4.tar.gz", hash = "sha256:078b96cff1f3d417169ad46cacef7fc4d644978bbd6725a5c24c0675de5030ab"},
|
{file = "pgvecto_rs-0.2.1.tar.gz", hash = "sha256:07046eaad2c4f75745f76de9ba483541909f1c595aced8d3434224a4f933daca"},
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
numpy = ">=1.23"
|
numpy = ">=1.23"
|
||||||
|
SQLAlchemy = {version = ">=2.0.23", optional = true, markers = "extra == \"sqlalchemy\""}
|
||||||
toml = ">=0.10"
|
toml = ">=0.10"
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
|
django = ["Django (>=4.2)"]
|
||||||
psycopg3 = ["psycopg[binary] (>=3.1.12)"]
|
psycopg3 = ["psycopg[binary] (>=3.1.12)"]
|
||||||
sdk = ["openai (>=1.2.2)", "pgvecto_rs[sqlalchemy]"]
|
sdk = ["openai (>=1.2.2)", "pgvecto_rs[sqlalchemy]"]
|
||||||
sqlalchemy = ["SQLAlchemy (>=2.0.23)", "pgvecto_rs[psycopg3]"]
|
sqlalchemy = ["SQLAlchemy (>=2.0.23)"]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pgvector"
|
name = "pgvector"
|
||||||
|
@ -6131,10 +6133,7 @@ files = [
|
||||||
[package.dependencies]
|
[package.dependencies]
|
||||||
annotated-types = ">=0.4.0"
|
annotated-types = ">=0.4.0"
|
||||||
pydantic-core = "2.20.1"
|
pydantic-core = "2.20.1"
|
||||||
typing-extensions = [
|
typing-extensions = {version = ">=4.6.1", markers = "python_version < \"3.13\""}
|
||||||
{version = ">=4.6.1", markers = "python_version < \"3.13\""},
|
|
||||||
{version = ">=4.12.2", markers = "python_version >= \"3.13\""},
|
|
||||||
]
|
|
||||||
|
|
||||||
[package.extras]
|
[package.extras]
|
||||||
email = ["email-validator (>=2.0.0)"]
|
email = ["email-validator (>=2.0.0)"]
|
||||||
|
@ -9501,5 +9500,5 @@ cffi = ["cffi (>=1.11)"]
|
||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
lock-version = "2.0"
|
lock-version = "2.0"
|
||||||
python-versions = "^3.10"
|
python-versions = ">=3.10,<3.13"
|
||||||
content-hash = "ca55e4a4bb354fe969cc73c823557525c7598b0375e8791fcd77febc59e03b96"
|
content-hash = "50acbb78f2a273dfa8683d9d292596e89d13a420c6ecb1afad331f2c38dd1423"
|
||||||
|
|
|
@ -154,7 +154,7 @@ pydantic_extra_types = "~2.9.0"
|
||||||
pydub = "~0.25.1"
|
pydub = "~0.25.1"
|
||||||
pyjwt = "~2.8.0"
|
pyjwt = "~2.8.0"
|
||||||
pypdfium2 = "~4.17.0"
|
pypdfium2 = "~4.17.0"
|
||||||
python = "^3.10"
|
python = ">=3.10,<3.13"
|
||||||
python-docx = "~1.1.0"
|
python-docx = "~1.1.0"
|
||||||
python-dotenv = "1.0.0"
|
python-dotenv = "1.0.0"
|
||||||
pyyaml = "~6.0.1"
|
pyyaml = "~6.0.1"
|
||||||
|
@ -204,7 +204,7 @@ cloudscraper = "1.2.71"
|
||||||
[tool.poetry.group.vdb.dependencies]
|
[tool.poetry.group.vdb.dependencies]
|
||||||
chromadb = "0.5.1"
|
chromadb = "0.5.1"
|
||||||
oracledb = "~2.2.1"
|
oracledb = "~2.2.1"
|
||||||
pgvecto-rs = "0.1.4"
|
pgvecto-rs = { version = "~0.2.1", extras = ['sqlalchemy'] }
|
||||||
pgvector = "0.2.5"
|
pgvector = "0.2.5"
|
||||||
pymilvus = "~2.4.4"
|
pymilvus = "~2.4.4"
|
||||||
pymysql = "1.1.1"
|
pymysql = "1.1.1"
|
||||||
|
|
|
@ -418,7 +418,7 @@ services:
|
||||||
|
|
||||||
# pgvecto-rs vector store
|
# pgvecto-rs vector store
|
||||||
pgvecto-rs:
|
pgvecto-rs:
|
||||||
image: tensorchord/pgvecto-rs:pg16-v0.2.0
|
image: tensorchord/pgvecto-rs:pg16-v0.3.0
|
||||||
profiles:
|
profiles:
|
||||||
- pgvecto-rs
|
- pgvecto-rs
|
||||||
restart: always
|
restart: always
|
||||||
|
|
Loading…
Reference in New Issue
Block a user