Skip to content

Commit

Permalink
T10H-85 - VectorBase change for namespace allocation (#449)
Browse files Browse the repository at this point in the history
* T10H-85 - VectorBase change for namespace allocation

Signed-off-by: Jack McKnight <[email protected]>

* adding namespace kwargs

Signed-off-by: Jack McKnight <[email protected]>

---------

Signed-off-by: Jack McKnight <[email protected]>
  • Loading branch information
jacktempo7 authored Jun 27, 2023
1 parent 1106f08 commit c663379
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions gptcache/manager/vector_data/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def get(name, **kwargs):
port = kwargs.get("port", "6379")
user = kwargs.get("user")
password = kwargs.get("password")
namespace = kwargs.get("namespace")
dimension = kwargs.get("dimension", DIMENSION)
collection_name = kwargs.get("collection_name", COLLECTION_NAME)

Expand All @@ -211,6 +212,7 @@ def get(name, **kwargs):
port=port,
username=user,
password=password,
namespace=namespace,
dimension=dimension,
collection_name=collection_name,
top_k=top_k,
Expand Down
4 changes: 3 additions & 1 deletion gptcache/manager/vector_data/redis_vectorstore.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,16 @@ def __init__(
dimension: int = 0,
collection_name: str = "gptcache",
top_k: int = 1,
namespace: str = "",
):
self._client = Redis(
host=host, port=int(port), username=username, password=password
)
self.top_k = top_k
self.dimension = dimension
self.collection_name = collection_name
self.doc_prefix = "doc:"
self.namespace = namespace
self.doc_prefix = f"{self.namespace}doc:" # Prefix with the specified namespace
self._create_collection(collection_name)

def _check_index_exists(self, index_name: str) -> bool:
Expand Down

0 comments on commit c663379

Please sign in to comment.