feat: (ragKnowledge) Enhance RAG knowledge handling #2351
Merged
+661
−106
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
These improvements address performance and usability issues, facilitating better support for large knowledge sets.
Closes #2323
Risks
These are changes to ragKnowledge so should be low.
Testing
In your character card, set:
"ragKnowledge": true,
and configure your knowledge folders. Direct files and strings are still supported, below is a sample:
Then, place these files and directories under eliza/characters/knowledge.
Scenarios to test:
I start my agent like:
pnpm start:debug --character="characters/qwen.character.json" > agent.log 2>&1
This uses the target that shows debug messages from the elizaLogger
Where should a reviewer start?
runtime.ts - initialize() is the main entry point that calls processCharacterRAGKnowledge() and processCharacterRAGDirectory. Both processCharacterRAGDirectory has most of the changes.
ragknowledge.ts - ids are now scoped to private or shared to prevent issues when the same knowledge is moved between shared folder and private folders. double byte characters were stripped on pre-processing so that line was commented out. And embedding of knowledge files was optimized.
The only additions to generation.ts was logging, so no need to focus too much on that.
localembeddingmanager.ts just has embedding logging commented out, as it was too verbose (it was displaying a long vector string in debug mode)
Discord username
hosermage