Skip to content
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

[Feature Request]: Better error messages #3688

Open
aarunjith opened this issue Feb 5, 2025 · 0 comments
Open

[Feature Request]: Better error messages #3688

aarunjith opened this issue Feb 5, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@aarunjith
Copy link

aarunjith commented Feb 5, 2025

Describe the problem

Hey,

I was trying out chroma db with the following code:

import chromadb
from chromadb.utils import embedding_functions
import os
from google.colab import userdata


CHROMA_PATH = "chroma_db"

client = chromadb.PersistentClient(path=CHROMA_PATH)
openai_ef = embedding_functions.OpenAIEmbeddingFunction(
    api_key=userdata.get('OPENAI_API_KEY'),
    model_name="text-embedding-3-small",
)

COLLECTION = client.get_or_create_collection(
    name="documents", embedding_function=openai_ef
)

sample_texts = ['hello world', 'this is a test']
metadata = [{"key1": "value1", "key2": "value2"}, {"key1": "value3", "key2": "value4"}]
ids = [f'doc_{ix}' for ix in range(len(sample_texts))]

COLLECTION.add(documents=sample_texts, metadatas=metadata, ids=ids)

This is still vanilla. But the OPENAI key that i set was incorrect. Unfortunately the error i got was the following

TypeError: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

This was confusing to figure out the exact issue was the wrong key

Describe the proposed solution

Maybe we can relay the error directly from the embedding function?

Alternatives considered

No response

Importance

nice to have

Additional Information

Non breaking, but might be easier to handle the issues

@aarunjith aarunjith added the enhancement New feature or request label Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant