Class OpenAiEmbeddingDeserializer

java.lang.Object
tools.jackson.databind.ValueDeserializer<float[]>
org.springframework.ai.openai.api.OpenAiEmbeddingDeserializer
All Implemented Interfaces:
tools.jackson.databind.deser.NullValueProvider

public class OpenAiEmbeddingDeserializer extends tools.jackson.databind.ValueDeserializer<float[]>
Used to deserialize the `embedding` field returned by the model.

Supports two input formats:

  1. float[] - returned directly as-is.
  2. 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 tools.jackson.databind.ValueDeserializer

    tools.jackson.databind.ValueDeserializer.None
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    float[]
    deserialize(tools.jackson.core.JsonParser jsonParser, tools.jackson.databind.DeserializationContext deserializationContext)
     

    Methods inherited from class tools.jackson.databind.ValueDeserializer

    createContextual, deserialize, deserializeWithType, deserializeWithType, findBackReference, getAbsentValue, getDelegatee, getEmptyAccessPattern, getEmptyValue, getKnownPropertyNames, getNullAccessPattern, getNullValue, getObjectIdReader, handledType, isCachable, logicalType, replaceDelegatee, resolve, supportsUpdate, unwrappingDeserializer

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpenAiEmbeddingDeserializer

      public OpenAiEmbeddingDeserializer()
  • Method Details

    • deserialize

      public float[] deserialize(tools.jackson.core.JsonParser jsonParser, tools.jackson.databind.DeserializationContext deserializationContext) throws tools.jackson.core.JacksonException
      Specified by:
      deserialize in class tools.jackson.databind.ValueDeserializer<float[]>
      Throws:
      tools.jackson.core.JacksonException