Skip to content

Commit 55ceaae

Browse files
committed
fix backend config
1 parent 1bf797c commit 55ceaae

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

veadk/knowledgebase/knowledgebase.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class KnowledgeBase(BaseModel):
7171
Default is `local`."""
7272

7373
backend_config: dict = Field(default_factory=dict)
74-
"""Deprecated. Configuration for the backend"""
74+
"""Configuration for the backend"""
7575

7676
top_k: int = 10
7777
"""Number of top similar documents to retrieve during search"""
@@ -89,6 +89,11 @@ def model_post_init(self, __context: Any) -> None:
8989
)
9090
return
9191

92+
# Once user define backend config, use it directly
93+
if self.backend_config:
94+
self._backend = _get_backend_cls(self.backend)(**self.backend_config)
95+
return
96+
9297
self.index = self.index or self.app_name
9398
if not self.index:
9499
raise ValueError("Either `index` or `app_name` must be provided.")

veadk/memory/long_term_memory.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class LongTermMemory(BaseMemoryService, BaseModel):
8080
"""Long term memory backend type"""
8181

8282
backend_config: dict = Field(default_factory=dict)
83-
"""Deprecated. Long term memory backend configuration"""
83+
"""Long term memory backend configuration"""
8484

8585
top_k: int = 5
8686
"""Number of top similar documents to retrieve during search."""
@@ -101,6 +101,11 @@ def model_post_init(self, __context: Any) -> None:
101101
)
102102
return
103103

104+
# Once user define backend config, use it directly
105+
if self.backend_config:
106+
self._backend = _get_backend_cls(self.backend)(**self.backend_config)
107+
return
108+
104109
# Check index
105110
self.index = self.index or self.app_name
106111
if not self.index:

0 commit comments

Comments
 (0)