chroma-core / chroma

the AI-native open-source embedding database
https://www.trychroma.com/
Apache License 2.0
15.35k stars 1.29k forks source link

[Bug]: Better module error reporting #2072

Open billreynolds007 opened 6 months ago

billreynolds007 commented 6 months ago

What happened?

This message "Please install openai as a dependency with, e.g. yarn add openai" can be extremely misleading. Kindly change chromadb.cjs line 3070'ish to include the full stack dump to be much more useful. It is a fatal error so the more information provided the better. console.log(e); throw new Error( "Please install openai as a dependency with, e.g. yarn add openai" );

Versions

Chroma 0.5.0

Relevant log output

NA
tazarov commented 6 months ago

@billreynolds007, Do you have a suggestion for the error that will make it more user-friendly?

To clarify, this error is thrown by Chroma whenever you try to use the OpenAI embedding function but do not have the dependency required. It is a rethrow from an import error to let the user know they need additional dependency and how to install it.

billreynolds007 commented 6 months ago

I encountered that error and did the one thing it said and still ran into the same static message. At a minimum please include the original exception's message because the cause may vary depending on the runtime environment. I dumped the entire stack to get a clue on what steps other than 'yarn add openai' to attempt to take. It does not need to be the whole stack. A little bit more feedback would be useful.