MCPcopy Create free account
hub / github.com/cosdata/cosdata / create_db

Function create_db

tests/test-usv.py:48–61  ·  view source on GitHub ↗

Create collection using cosdata client

(name, description=None)

Source from the content-addressed store, hash-verified

46
47
48def create_db(name, description=None):
49 """Create collection using cosdata client"""
50 client._ensure_session()
51 url = f"{client.base_url}/collections"
52 data = {
53 "name": name,
54 "description": description,
55 "usv_options": {"enabled": True},
56 "config": {"max_vectors": None, "replication_factor": None},
57 "store_raw_text": False,
58 }
59 response = requests.post(url, headers=client._get_headers(), data=json.dumps(data), verify=client.verify_ssl)
60 if response.status_code not in [200, 201]:
61 raise Exception(f"Failed to create collection: {response.text}")
62
63
64def create_explicit_index(name):

Callers 1

mainFunction · 0.70

Calls 1

_get_headersMethod · 0.45

Tested by

no test coverage detected