Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear Bank Does Not Work for AgentStore Example #104

Open
1 of 2 tasks
dawenxi-007 opened this issue Oct 31, 2024 · 4 comments
Open
1 of 2 tasks

Clear Bank Does Not Work for AgentStore Example #104

dawenxi-007 opened this issue Oct 31, 2024 · 4 comments
Labels
good first issue Good for newcomers

Comments

@dawenxi-007
Copy link

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

  • The official example scripts
  • My own modified scripts

🐛 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 yanxi0830 added the good first issue Good for newcomers label Oct 31, 2024
@yanxi0830
Copy link
Contributor

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:

    async def clear_live_bank(self) -> None:
    # FIXME: This is a hack, ideally we should
    # clear an existing bank instead of creating a new one
    self.live_bank = self.create_live_bank()
    self.agents[AgentChoice.Memory] = await self.get_agent(
    agent_type=AgentChoice.Memory,
    agent_params={"bank_ids": self.bank_ids + [self.live_bank]},
    )
    self.create_session(AgentChoice.Memory)

@dawenxi-007
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

image

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants