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.
Description of changes
After the recent changes in the Web AI structure, the embedder function became invalid because of different imports and because the browser version of the library is only ESM, as mentioned here.
To fix the issue, I updated the import paths and changed the
require
statements toimport
for the browser version of the function.Important note:
When using the embedded in the browser, you should import
chromadb/dist/module
because the browser version of Web AI is ESM-only.For Node.js, you can use regular
chromadb
import because Node.js version of the library is CJS.Additionally, because Web AI since recently supports multimodal embeddings, I added building multimodal embeddings using CLIP-base.
Test plan
I tested the changes locally for both browser and Node.js. The built
chromadb
package if someone wants to test it in their projects, is available here.Documentation Changes
There likely will be needed changes regarding the multimodal functionality.