Skip to content

Commit

Permalink
Merge branch 'issue-63' of https://github.com/stacklok/codegate into …
Browse files Browse the repository at this point in the history
…issue-63
  • Loading branch information
yrobla committed Nov 29, 2024
2 parents 4d1f612 + e023df8 commit 2cf72cd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/codegate/storage/storage_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,26 @@ def __init__(self, data_path='./weaviate_data'):
if weaviate_client is not None:
try:
weaviate_client.connect()
#self.setup_schema(weaviate_client)
self.setup_schema(weaviate_client)
except Exception as e:
self.__logger.error(f"Failed to connect or setup schema: {str(e)}")
finally:
print("i close")
weaviate_client.close()
else:
self.__logger.error("Could not find client, skipping schema setup.")

def setup_schema(self, client):
print("in setup schema")
for class_config in self.schema_config:
print("i get config")
if not client.collections.exists(class_config['name']):
print("i create")
client.collections.create(class_config['name'],
properties=class_config['properties'])
self.__logger.info(
f"Weaviate schema for class {class_config['name']} setup complete.")
print("finish schema")

async def search(self, query: str, limit=5, distance=0.3) -> list[object]:
"""
Expand Down

0 comments on commit 2cf72cd

Please sign in to comment.