You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth

Hi,

I am having using OpenAI’s embedding endpoint to generate text embeddings representing the my datasets as illustracted in this blog.

When I tried running the embedding endpoint. It stucked and after several hours it returned this errorr message

{
    "error": {
        "message": "You didn't provide an API key. You need to provide your API key in an Authorization header using Bearer auth (i.e. Authorization: Bearer YOUR_KEY), or as the password field (with blank username) if you're accessing the API from your browser and are prompted for a username and password. You can obtain an API key from https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": null
    }
}

here is the code

run_query("""
CALL apoc.periodic.iterate(
    'MATCH (p:Package) RETURN id(p) as id',
    'MATCH (p:Package)
    WHERE id(p) = id
    MATCH (p)-[r:CONTRIBUTED_TO|MAINTAINS]-(n:Person)
    WITH p, type(r) as type, collect(n.name) as names
    WITH p, type+": "+reduce(s="", n IN names | s + n + ", ") as types
    WITH p, collect(types) as contexts
    WITH p, "Package Name: "+ p.name + " Last Published Date: "+p.latestPublishedDate +" Description: "+ p.description +"\n" +
            reduce(s="", c in contexts | s + substring(c, 0, size(c)-2) +"\n") as context
    CALL apoc.ml.openai.embedding([context], $apiKey) YIELD embedding
    SET p.embedding = embedding',
    {batchSize:1, retries:3, params: {apiKey: $apiKey}})
""", {'apiKey': openai_api_key})['errorMessages'][0]
 

I also notice that this issue was raised months ago on GitHub with no response. new error when need API-Key,I sure enter my api-key corect · Issue #312 · Pythagora-io/gpt-pilot · GitHub