The key 'predictions' corresponds to the value type which is list object.
So I guess the response which has changed from google vertex api.
After the code fixed like this:
if "predictions" in response:
for prediction in response['predictions']:
embeddings.append(prediction["embeddings"]["values"])
It runs well.
Versions
Chromadb 0.4.24
Python 3.10.13
MacOS 14.1
Relevant log output
File "/Users/liyuxiang/.pyenv/versions/butterbeer/lib/python3.10/site-packages/chromadb/utils/embedding_functions.py", line 668, in __call__
embeddings.append(response["predictions"]["embeddings"]["values"])
TypeError: list indices must be integers or slices, not str
What happened?
When I call GoogleVertexEmbeddingFunction to get embeddings, it can't parse response appropriately. code before fixed:
when I print my response, it is like:
The key 'predictions' corresponds to the value type which is list object. So I guess the response which has changed from google vertex api.
After the code fixed like this:
It runs well.
Versions
Chromadb 0.4.24 Python 3.10.13 MacOS 14.1
Relevant log output