Closed abhishek9998 closed 5 months ago
🤖
Thank you for bringing this to our attention. From the information provided, it seems that the HuggingFaceInferenceAPIEmbeddings
class does not currently support batch processing. The inputs
parameter in the requests.post
method is expected to be a list of texts that need to be embedded, and it appears that all of these texts are being processed in a single request, which could be causing the 413 request code error you're encountering.
As for the embedding_chunk_size
not being parsable from the Pinecone.from_documents()
method, this could be due to the fact that this method does not currently support this parameter.
Unfortunately, without the ability to create pull requests or issues, I'm unable to directly address these problems in the codebase. However, I would recommend considering the following potential solutions:
Batch Processing: You could modify the HuggingFaceInferenceAPIEmbeddings
class to support batch processing. This would involve splitting the list of texts into smaller batches and making separate requests for each batch. This could potentially resolve the 413 request code error.
Embedding Chunk Size: You could also consider modifying the Pinecone.from_documents()
method to support the embedding_chunk_size
parameter. This would allow you to control the size of the chunks that are being embedded, which could help to prevent the 413 request code error.
Please note that these are just potential solutions and may not fully resolve the issues you're encountering. If you decide to implement these changes, please test them thoroughly to ensure they work as expected.
For reference, here is the relevant code in the HuggingFaceInferenceAPIEmbeddings
class:
response = requests.post(
self._api_url,
headers=self._headers,
json={
"inputs": texts,
"options": {"wait_for_model": True, "use_cache": True},
},
)
And here is the relevant code in the Pinecone.from_documents()
method:
vectordb = Pinecone.from_documents(chunks, embeddings, index_name=index_name, namespace=namespace)
I hope this information is helpful. If you have any further questions or need additional clarification, please don't hesitate to ask.
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
Checked other resources
Example Code
this code snippet is getting 314 request code from huggingface.py
we should support batch size here. like local model embedding
Description
I am trying to use pinecone with hugging face inference for the embedding model. My total chunks are 420. and it is trying to process in one request. Also embedding_chunk_size is not parsable from Pinecone.from_documents() method
System Info
Related Components