Skip to content

Commit

Permalink
fix metadata and insert_vector
Browse files Browse the repository at this point in the history
  • Loading branch information
rizquuula committed Nov 11, 2024
1 parent 77f6050 commit c2af99f
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion examples/chromadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
distance_function=DistanceFunction.L2,
)

new_v = ch.create_vector(v)
new_v = ch.insert_vector(v)
print("CREATE_VECTOR", new_v)

new_v = ch.read_vector(new_v.id)
Expand Down
2 changes: 1 addition & 1 deletion examples/pgvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
distance_function=DistanceFunction.L2,
)

new_v = pgv.create_vector(v)
new_v = pgv.insert_vector(v)
print("CREATE_VECTOR", new_v)

new_v = pgv.read_vector(new_v.id)
Expand Down
2 changes: 1 addition & 1 deletion examples/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
distance_function=DistanceFunction.COSINE,
)

new_v = qv.create_vector(v)
new_v = qv.insert_vector(v)
print("CREATE_VECTOR", new_v)

new_v = qv.read_vector(new_v.id)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pyvectordb"
version = "0.1.3.1"
version = "0.1.4"
description = "Simple Wrapper for vector database in Python with minimal support for CRUD and retrieve."
authors = ["M Razif Rizqullah <razifrizqullah@gmail.com>"]
repository = "https://github.com/rizquuula/pyvectordb"
Expand Down
4 changes: 2 additions & 2 deletions pyvectordb/chromadb/chromadb.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def __init_collection(self) -> None:
metadata={"hnsw:space": distance_func.value}
)

def create_vector(self, vector: Vector) -> Vector:
def insert_vector(self, vector: Vector) -> Vector:
self.collection.add(
ids=[vector.get_id()],
embeddings=[vector.embedding],
metadatas=[{"metadata": vector.metadata}],
metadatas=[vector.metadata],
)
return vector

Expand Down
2 changes: 1 addition & 1 deletion pyvectordb/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
class VectorDB(ABC):

@abstractmethod
def create_vector(self, vector: Vector) -> Vector:
def insert_vector(self, vector: Vector) -> Vector:
...

@abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion pyvectordb/pgvector/pgvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def __init_collection(self) -> None:
self.conn.commit()


def create_vector(self, vector: Vector) -> Vector:
def insert_vector(self, vector: Vector) -> Vector:
conn = self.conn

v = self.__vector_orm(
Expand Down
2 changes: 1 addition & 1 deletion pyvectordb/qdrant/qdrant.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __get_distance_function(self, distance: DistanceFunction) -> Distance:

return distance_func

def create_vector(self, vector: Vector) -> Vector:
def insert_vector(self, vector: Vector) -> Vector:
vector_id = vector.get_id()

self.client.upsert(
Expand Down

0 comments on commit c2af99f

Please sign in to comment.