Skip to content

[Feature Request]: Better error messages #3688

Open
@aarunjith

Description

@aarunjith

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions