Find answers from the community

Updated 2 years ago

```

At a glance

The community members are discussing an issue where the vector dimension of the Pinecone index (768) does not match the dimension of the embeddings they are trying to use (1536). The issue seems to be that the community member created the Pinecone index with a vector dimension of 768, but is now trying to use OpenAI embeddings (1536 dimension) with that index.

The suggested solutions are:

  • Recreate the Pinecone index with a vector dimension of 1536
  • Create a new Pinecone index with a vector dimension of 1536
  • Determine if the community member is actually using Huggingface sentence transformer embeddings (768 dimension) instead of OpenAI embeddings, and ensure the Pinecone index is set up correctly for those embeddings

There is no explicitly marked answer in the comments.

Plain Text
similarity_top_k=1000
response_mode="no_text"
query_term = "formation"

query_engine = picone_index_llama.as_query_engine(
    retriever_mode="embedding", 
    service_context=service_context,
    verbose=True,
    similarity_top_k=similarity_top_k,
    response_mode=response_mode
)

query_engine.query(query_term)

----------------
ApiException: (400)
Reason: Bad Request
HTTP response headers: HTTPHeaderDict({'content-type': 'application/json', 'Content-Length': '103', 'date': 'Sat, 09 Sep 2023 10:45:46 GMT', 'x-envoy-upstream-service-time': '0', 'server': 'envoy', 'Via': '1.1 google', 'Alt-Svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000'})
HTTP response body: {"code":3,"message":"Vector dimension 1536 does not match the dimension of the index 768","details":[]}


How to set the embedding size into my query engine?
T
i
13 comments
I think the issue might be that you created the Pinecone index with a vector dimension of 768 and now you're trying to use OpenAI embeddings (1536 dimension) with that index. You probably need to rebuild your index or use a different embeddings model
No I pinecone index is created using 768. I think is will be a parameter in query engine who set embedding dimension to 1536 as default.
I don't know where to change
You'll have to recreate the index
Or make a new one
And then just set the dimensions to 1536
I am using Huggingface sentence transformer Embedding with 768 size. Using 1536 embedding size will not broken my embeddings?
Ah so you're not intending to use OpenAI embeddings
Do you have the Huggingface model defined and are you passing that in your service context?
So how to fix this issue?
Could you maybe provide some more context about your code
Add a reply
Sign up and join the conversation on Discord