meta-llama / llama-stack-apps

Agentic components of the Llama Stack APIs
MIT License
3.84k stars 552 forks source link

Clear Bank Does Not Work for AgentStore Example #104

Open dawenxi-007 opened 1 week ago

dawenxi-007 commented 1 week ago

System Info

Python version: 3.10.12 Pytorch version: llama_models version: 0.0.45 llama_stack version: 0.0.45 llama_stack_client version: 0.0.47 Hardware: 1xH100 (80GB VRAM/GPU)

Information

🐛 Describe the bug

Running the following commands to create the memory bank and launch the app:

PYTHONPATH=. python examples/agent_store/build_index.py [::] 5000 examples/agent_store/local_knowledge
# Successfully created bank: memory_bank
PYTHONPATH=. python examples/agent_store/app.py [::] 5000 --bank-ids memory_bank

llama-stack-client memory_banks list shows the available banks are memory_bank and live_bank, but live_bank can not be cleared with the Clear Bank button.

Error logs

memory_bank

The memory banks stay the same after clicking Clear Bank button. Basically, the llama-stack-client memory_banks list shows the same memory banks even after clicking Clear Bank button.

Expected behavior

Expect that the Clear Bank button will remove/un-register the live_bank (dynamic bank) and keep memory_bank (static bank). Hope this can be fixed, or at least, could you share any command line to manually clear/remove/un-register the memory bank?

yanxi0830 commented 1 week ago

Thanks! This is a missing functionality in our llama-stack server to implement "delete" for memory_banks. To fix:

  1. We will need to implement unregister function for memory_banks: https://github.com/meta-llama/llama-stack/blob/f04b566c5cfc0d23b59e79103f680fe05ade533d/llama_stack/apis/memory_banks/memory_banks.py#L66

  2. Update AgentStore example to use the unregister api: https://github.com/meta-llama/llama-stack-apps/blob/13f4e83e134855f723b0a1998cb24df5c496fa3a/examples/agent_store/api.py#L265-L273

dawenxi-007 commented 6 days ago

Thanks. How can I enable the RAG for both memory_bank and live_bank?

When I launched the command PYTHONPATH=. python examples/agent_store/app.py [::] 5000 --bank-ids memory_bank live_bank, I will get the following error with any prompt:

  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/tao/demo_1024/llamastk_metaflow/llama-stack-apps/examples/agent_store/api.py", line 243, in chat
    event_type = event.payload.event_type
AttributeError: 'NoneType' object has no attribute 'payload' 
yanxi0830 commented 3 days ago

Thanks. How can I enable the RAG for both memory_bank and live_bank?

When I launched the command PYTHONPATH=. python examples/agent_store/app.py [::] 5000 --bank-ids memory_bank live_bank, I will get the following error with any prompt:

  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/tao/demo_1024/llamastk_metaflow/llama-stack-apps/examples/agent_store/api.py", line 243, in chat
    event_type = event.payload.event_type
AttributeError: 'NoneType' object has no attribute 'payload' 

Unfortunately, the error outputs on client is very general (cc @dineshyv who is making improvements on error handling).

Could you share the error message from the server side?

dawenxi-007 commented 3 days ago

image

It shows that the live_bank is not registered. How can I enable the app to support multiple banks?