mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-16 06:53:47 +00:00
migrate memory banks to Resource and new registration
This commit is contained in:
parent
b4416b72fd
commit
c82f13bf9e
16 changed files with 178 additions and 104 deletions
|
@ -75,14 +75,16 @@ class MemoryClient(Memory):
|
|||
async def run_main(host: str, port: int, stream: bool):
|
||||
banks_client = MemoryBanksClient(f"http://{host}:{port}")
|
||||
|
||||
bank = VectorMemoryBankDef(
|
||||
bank = VectorMemoryBank(
|
||||
identifier="test_bank",
|
||||
provider_id="",
|
||||
embedding_model="all-MiniLM-L6-v2",
|
||||
chunk_size_in_tokens=512,
|
||||
overlap_size_in_tokens=64,
|
||||
)
|
||||
await banks_client.register_memory_bank(bank)
|
||||
await banks_client.register_memory_bank(
|
||||
bank.identifier, bank.memory_bank_type, provider_resource_id=bank.identifier
|
||||
)
|
||||
|
||||
retrieved_bank = await banks_client.get_memory_bank(bank.identifier)
|
||||
assert retrieved_bank is not None
|
||||
|
|
|
@ -39,7 +39,7 @@ class QueryDocumentsResponse(BaseModel):
|
|||
|
||||
|
||||
class MemoryBankStore(Protocol):
|
||||
def get_memory_bank(self, bank_id: str) -> Optional[MemoryBankDef]: ...
|
||||
def get_memory_bank(self, bank_id: str) -> Optional[MemoryBank]: ...
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue