Class OpenAiEmbeddingDeserializer
java.lang.Object
com.fasterxml.jackson.databind.JsonDeserializer<float[]>
org.springframework.ai.openai.api.OpenAiEmbeddingDeserializer
- All Implemented Interfaces:
com.fasterxml.jackson.databind.deser.NullValueProvider
public class OpenAiEmbeddingDeserializer
extends com.fasterxml.jackson.databind.JsonDeserializer<float[]>
Used to deserialize the `embedding` field returned by the model.
Supports two input formats:
float[]
- returned directly as-is.- A Base64-encoded string representing a float array stored in little-endian format.
The string is first decoded into a byte array, then converted into a
float[]
.
- Author:
- Sun Yuhan
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.JsonDeserializer
com.fasterxml.jackson.databind.JsonDeserializer.None
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfloat[]
deserialize
(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext deserializationContext) Methods inherited from class com.fasterxml.jackson.databind.JsonDeserializer
deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, supportsUpdate, unwrappingDeserializer
-
Constructor Details
-
OpenAiEmbeddingDeserializer
public OpenAiEmbeddingDeserializer()
-
-
Method Details
-
deserialize
public float[] deserialize(com.fasterxml.jackson.core.JsonParser jsonParser, com.fasterxml.jackson.databind.DeserializationContext deserializationContext) throws IOException, com.fasterxml.jackson.core.JacksonException - Specified by:
deserialize
in classcom.fasterxml.jackson.databind.JsonDeserializer<float[]>
- Throws:
IOException
com.fasterxml.jackson.core.JacksonException
-