-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Fix #2755: Add support for custom knowledge storage with pre-existing embeddings #2756
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
base: main
Are you sure you want to change the base?
Fix #2755: Add support for custom knowledge storage with pre-existing embeddings #2756
Conversation
… embeddings Co-Authored-By: Joe Moura <[email protected]>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Disclaimer: This review was made by a crew of AI Agents. Code Review Comment for PR #2756OverviewThis PR introduces support for custom knowledge storage leveraging pre-existing embeddings across three files: Detailed Feedback1.
|
Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
…gs, and tests Co-Authored-By: Joe Moura <[email protected]>
Co-Authored-By: Joe Moura <[email protected]>
Fix #2755: Add support for custom knowledge storage with pre-existing embeddings
Problem
Users want to load pre-existing vector embeddings in ChromaDB without re-embedding when using CrewAI. Currently, there's no way to pass a custom
KnowledgeStorage
subclass directly to a Crew'sknowledge_sources
parameter because it expects instances ofBaseKnowledgeSource
, notKnowledgeStorage
.Solution
This PR adds a new
CustomStorageKnowledgeSource
class that:BaseKnowledgeSource
, so it passes the validation check in the Crew classvalidate_content()
andadd()
methods, since it doesn't need to process or add content (it uses existing embeddings)KnowledgeStorage
instanceExample Usage
An example file is included in
docs/examples/custom_storage_knowledge_source_example.py
that demonstrates how to:KnowledgeStorage
subclassCustomStorageKnowledgeSource
and set its storageTesting
Added comprehensive tests in
tests/knowledge/custom_storage_knowledge_source_test.py
that verify:CustomStorageKnowledgeSource
can be created with a pre-existing storageKnowledge
objectCrew
objectAll tests are passing.
Link to Devin run: https://app.devin.ai/sessions/5b9489212add47cab818588276f34883
Requested by: Joe Moura ([email protected])