Skip to content

Commit

Permalink
Update the size parameter to be dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
erichare committed Oct 30, 2023
1 parent b5f7747 commit aabd563
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ api_endpoint = f"https://{database_id}-{database_region}.{database_base_url}"
astra_db = AstraDB(token=token, api_endpoint=api_endpoint)

# Possible Operations
astra_db.create_collection(collection_name="collection_test_delete", size=5)
astra_db.create_collection(collection_name="collection_test_delete", dimension=5)
astra_db.delete_collection(collection_name="collection_test_delete")
astra_db.create_collection(collection_name="collection_test", size=5)
astra_db.create_collection(collection_name="collection_test", dimension=5)

# Collections
astra_db_collection = AstraDBCollection(
Expand Down
8 changes: 5 additions & 3 deletions astrapy/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,9 +347,11 @@ def get_collections(self):

return response

def create_collection(self, size=None, options={}, function="", collection_name=""):
if size and not options:
options = {"vector": {"size": size}}
def create_collection(
self, dimension=None, options={}, function="", collection_name=""
):
if dimension and not options:
options = {"vector": {"dimension": dimension}}
if function:
options["vector"]["function"] = function
if options:
Expand Down
4 changes: 2 additions & 2 deletions scripts/astrapy_latest_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
astra_db = AstraDB(token=token, api_endpoint=api_endpoint)

# Possible Operations
astra_db.create_collection(collection_name="collection_test_delete", size=5)
astra_db.create_collection(collection_name="collection_test_delete", dimension=5)
astra_db.delete_collection(collection_name="collection_test_delete")
astra_db.create_collection(collection_name="collection_test", size=5)
astra_db.create_collection(collection_name="collection_test", dimension=5)

# Collections
astra_db_collection = AstraDBCollection(
Expand Down

0 comments on commit aabd563

Please sign in to comment.