When the OpenAIEmbeddingFunction() is executed, the api_key provided as an argument overwrites the openai.api_key that is referenced globally throughout the application. This behavior prevents the application from being able to differentiate between the API key used for embeddings and the API key used for regular chat operations.
2024-10-21 17:34:25 [2024-10-21 08:34:25,464] INFO in internal_chatbot_documents_controller: openai.api_key: pTV4
2024-10-21 17:34:25 [2024-10-21 08:34:25,464] INFO in internal_chatbot_documents_controller: ANOHTER_OPENAI_API_KEY: -EsA
2024-10-21 17:34:25 [2024-10-21 08:34:25,483] INFO in internal_chatbot_documents_controller: openai.api_key: -EsA
What happened?
When the
OpenAIEmbeddingFunction()
is executed, the api_key provided as an argument overwrites the openai.api_key that is referenced globally throughout the application. This behavior prevents the application from being able to differentiate between the API key used for embeddings and the API key used for regular chat operations.Here's a snippet of the affected code:
Versions
chroma v0.5.5 flask v2.3.2 python 3.11.6
Relevant log output