-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Description
Describe the bug
HuggingFace Embedding Interface API: Issue related to Deserialization
So I was using BAAI/bge-large-en embedding model from huggingface Interface API .The code execution produces the following error:
The JSON value could not be converted to System.Collections.Generic.List`1[System.ReadOnlyMemory`1[System.Single]]. Path: $[0][0] | LineNumber: 0 | BytePositionInLine: 23.
To Reproduce
Steps to reproduce the behavior:
- Use the BAAI/bge-large-en embedding model.
- Execute the embedding code.
Based on the output, it was clear that this issue was related to Json Deserilaztion .First, I check what the expected datatype.
internal sealed class TextEmbeddingResponse : List<List<List<ReadOnlyMemory<float>>>>;
The the HuggingFace Embedinng Expected ist<List<List<ReadOnlyMemory<float>>>> & then return [0][0].ToList()
Then I check in Postman what is the response coming from the embedding

So it was clear that APi is sending List<ReadOnlyMemory> while services expects a list<list<list<ReadOnlyMemory>> .
I tested for other models and got the same response .
Screenshots
Finally I tested with the following embedding LaBSE .Able to get the expected response .

Platform
- OS: [e.g. Windows, Mac]
- IDE: [e.g. Visual Studio, VS Code]
- Language: [e.g. C#, Python]
- Source: [e.g. NuGet package version Latest ]
- Embedding : HuggingfaceEmbedding
- Vector Database : Qdrant
Metadata
Metadata
Assignees
Labels
Type
Projects
Status


