#2813·nhost

Add error response and http response status from auto embeddings to mutation query

Author: felixhagspielCreated Aug 1, 2024Updated Sep 14, 2026
Labelsenhancement

Is your feature request related to a problem? Please describe. OpenAI calls can fail due to various reasons. One case is that the token length is too big (> 8192 tokens). It would be great if the update mutation would receive those errors, so that we can store it and exclude those items from the next update by doing a null check on the query GetOutdatedMovies as described here.

Describe the solution you'd like

mutation UpdateEmbeddingsMovie($id: uuid!, $embeddings: vector, $error: jsonb, $httpStatus: Int) {
  updateMovie(pk_columns: {id: $id}, _set: {embeddings: $embeddings, error: $error}) {
    __typename
  }
}

Alternatively, it could also be a dedicated (optional) mutation that is only called for errors, sth like mutation UpdateEmbeddingsMovieFailed.

Describe alternatives you've considered Alternative for this specific case would be to somehow count the words / tokens of the data and exlucde them via a boolean column.

Additional context

{"time":"2024-08-01T21:48:15.027329248Z","level":"ERROR","msg":"error generating embeddings","component":"autoai.auto_embeddings_process","job":"feed_item_embeddings","id":"55f49e34-4c0b-4dfc-ae70-d6dae0c0e099","data":{"error":"error generating embeddings: error (status 400): {\n \"error\": {\n \"message\": \"This model's maximum context length is 8192 tokens, however you requested 23794 tokens (23794 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.\",\n \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\": null\n }\n}\n"}}