Skip to content
Snippets Groups Projects
Unverified Commit 92ee848a authored by Robert Shelton's avatar Robert Shelton Committed by GitHub
Browse files

update for redisvl 0.4.0 (#17902)

* update for redisvl 0.4.0

* update toml

* bump version

* simplify creation
parent 99ae9fba
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,16 @@ import logging ...@@ -7,6 +7,16 @@ import logging
from typing import Any, Dict, List, Optional from typing import Any, Dict, List, Optional
import fsspec import fsspec
from redis import Redis
from redis.exceptions import RedisError
from redis.exceptions import TimeoutError as RedisTimeoutError
from redisvl.index import SearchIndex
from redisvl.query import CountQuery, FilterQuery, VectorQuery
from redisvl.query.filter import FilterExpression, Tag
from redisvl.redis.utils import array_to_buffer
from redisvl.schema import IndexSchema
from redisvl.schema.fields import BaseField
from llama_index.core.bridge.pydantic import PrivateAttr from llama_index.core.bridge.pydantic import PrivateAttr
from llama_index.core.schema import ( from llama_index.core.schema import (
BaseNode, BaseNode,
...@@ -17,8 +27,8 @@ from llama_index.core.schema import ( ...@@ -17,8 +27,8 @@ from llama_index.core.schema import (
) )
from llama_index.core.vector_stores.types import ( from llama_index.core.vector_stores.types import (
BasePydanticVectorStore, BasePydanticVectorStore,
MetadataFilters,
MetadataFilter, MetadataFilter,
MetadataFilters,
VectorStoreQuery, VectorStoreQuery,
VectorStoreQueryResult, VectorStoreQueryResult,
) )
...@@ -27,27 +37,15 @@ from llama_index.core.vector_stores.utils import ( ...@@ -27,27 +37,15 @@ from llama_index.core.vector_stores.utils import (
node_to_metadata_dict, node_to_metadata_dict,
) )
from llama_index.vector_stores.redis.schema import ( from llama_index.vector_stores.redis.schema import (
NODE_ID_FIELD_NAME,
NODE_CONTENT_FIELD_NAME,
DOC_ID_FIELD_NAME, DOC_ID_FIELD_NAME,
NODE_CONTENT_FIELD_NAME,
NODE_ID_FIELD_NAME,
TEXT_FIELD_NAME, TEXT_FIELD_NAME,
VECTOR_FIELD_NAME, VECTOR_FIELD_NAME,
RedisVectorStoreSchema, RedisVectorStoreSchema,
) )
from llama_index.vector_stores.redis.utils import REDIS_LLAMA_FIELD_SPEC from llama_index.vector_stores.redis.utils import REDIS_LLAMA_FIELD_SPEC
from redis import Redis
from redis.exceptions import RedisError
from redis.exceptions import TimeoutError as RedisTimeoutError
from redisvl.index import SearchIndex
from redisvl.schema import IndexSchema
from redisvl.query import VectorQuery, FilterQuery, CountQuery
from redisvl.query.filter import Tag, FilterExpression
from redisvl.schema.fields import BaseField
from redisvl.redis.utils import array_to_buffer
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
...@@ -136,19 +134,11 @@ class RedisVectorStore(BasePydanticVectorStore): ...@@ -136,19 +134,11 @@ class RedisVectorStore(BasePydanticVectorStore):
TEXT_FIELD_NAME, TEXT_FIELD_NAME,
NODE_CONTENT_FIELD_NAME, NODE_CONTENT_FIELD_NAME,
] ]
self._index = SearchIndex(schema=schema) self._index = SearchIndex(
schema=schema, redis_client=redis_client, redis_url=redis_url
)
self._overwrite = overwrite self._overwrite = overwrite
# Establish redis connection
if redis_client:
self._index.set_client(redis_client)
elif redis_url:
self._index.connect(redis_url)
else:
raise ValueError(
"Failed to connect to Redis. Must provide a valid redis client or url"
)
# Create index # Create index
self.create_index() self.create_index()
......
...@@ -27,11 +27,11 @@ exclude = ["**/BUILD"] ...@@ -27,11 +27,11 @@ exclude = ["**/BUILD"]
license = "MIT" license = "MIT"
name = "llama-index-vector-stores-redis" name = "llama-index-vector-stores-redis"
readme = "README.md" readme = "README.md"
version = "0.4.0" version = "0.5.0"
[tool.poetry.dependencies] [tool.poetry.dependencies]
python = ">=3.9,<4.0" python = ">=3.9,<4.0"
redisvl = "^0.3.4" redisvl = "^0.4.1"
llama-index-core = "^0.12.0" llama-index-core = "^0.12.0"
[tool.poetry.group.dev.dependencies] [tool.poetry.group.dev.dependencies]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment