Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def model_post_init(self, __context: Any) -> None:
# 2. environment variable
# 3. default value
if not self.memory_type:
env_memory_type = os.getenv("DATABASE_VIKING_MEMORY_TYPE")
env_memory_type = os.getenv("DATABASE_VIKINGMEM_MEMORY_TYPE")
if env_memory_type:
# "event_1, event_2" -> ["event_1", "event_2"]
self.memory_type = [x.strip() for x in env_memory_type.split(",")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add default value
else:
self.memory_type = ["sys_event_v1", "event_v1"]

Expand All @@ -84,17 +84,23 @@ def _collection_exist(self) -> bool:
try:
client = self._get_client()
client.get_collection(collection_name=self.index)
logger.info(f"Collection {self.index} exist.")
return True
except Exception:
logger.info(f"Collection {self.index} not exist.")
return False

def _create_collection(self) -> None:
logger.info(
f"Create collection with collection_name={self.index}, builtin_event_types={self.memory_type}"
)
client = self._get_client()
response = client.create_collection(
collection_name=self.index,
description="Created by Volcengine Agent Development Kit VeADK",
builtin_event_types=["sys_event_v1"],
builtin_event_types=self.memory_type,
)
logger.debug(f"Create collection with response {response}")
return response

def _get_client(self) -> VikingDBMemoryClient:
Expand Down