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

[Feature]: Request to cache and load text embeddings for RAG (if not already provided). #400

Open
s0yabean opened this issue Aug 11, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@s0yabean
Copy link

Hi, I'm looking for a way to cache either the KnowledgeBank Object, or the Text Embeddings Produced when we load some data into embedding format to be ready for RAG.

Describe the solution you'd like
I've tried to find the embeddings but not sure where they are being produced at, hence unable to save them.
Also, it seems like the default example only loads from some files, instead of the produced embeddings themselves.
I've tried pickle and dill the entire knowledge base, but some private attributes are not copied over.

This is very helpful for quick code iterations when building the LLM agents, when the data is the same throughout.

Thanks for such a useful library!

@s0yabean s0yabean added the enhancement New feature or request label Aug 11, 2024
@DavdGao
Copy link
Collaborator

DavdGao commented Aug 12, 2024

@ZiTao-Li @rayrayraykk @xieyxclack Please check this issue.

BTW, AgentScope supports to cache text embeddings in https://github.com/modelscope/agentscope/blob/main/src/agentscope/manager/_file.py#L286 , do we need to integrate this feature into RAG module?

@ZiTao-Li
Copy link
Collaborator

Hi, I'm looking for a way to cache either the KnowledgeBank Object, or the Text Embeddings Produced when we load some data into embedding format to be ready for RAG.

Describe the solution you'd like I've tried to find the embeddings but not sure where they are being produced at, hence unable to save them. Also, it seems like the default example only loads from some files, instead of the produced embeddings themselves. I've tried pickle and dill the entire knowledge base, but some private attributes are not copied over.

This is very helpful for quick code iterations when building the LLM agents, when the data is the same throughout.

Thanks for such a useful library!

Since the RAG module in AgentScope is built with Llama-index, so the embedding storage follows the format of the Llama-index by calling the persist methods. The default path of the embedding is ./runs/{knowledge_id}/default__vector_store.json.

BTW, KnowledgeBank is more like a dispatcher and Knowledge(e.g., LlamaIndexKnowledge) is the one for embedding generation/retrieval.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants