Interface InferenceServiceResults

All Superinterfaces:
ChunkedToXContent, NamedWriteable, Writeable

public interface InferenceServiceResults extends NamedWriteable, ChunkedToXContent
  • Method Details

    • transformToCoordinationFormat

      default List<? extends InferenceResults> transformToCoordinationFormat()

      Transform the result to match the format required for the TransportCoordinatedInferenceAction. For the inference plugin TextEmbeddingResults, the transformToLegacyFormat() transforms the results into an intermediate format only used by the plugin's return value. It doesn't align with what the TransportCoordinatedInferenceAction expects. TransportCoordinatedInferenceAction expects an ml plugin TextEmbeddingResults.

      For other results like SparseEmbeddingResults, this method can be a pass through to the transformToLegacyFormat.

    • transformToLegacyFormat

      default List<? extends InferenceResults> transformToLegacyFormat()
      Transform the result to match the format required for versions prior to TransportVersions.V_8_12_0
    • asMap

      default Map<String,Object> asMap()
      Convert the result to a map to aid with test assertions
    • getWriteableName

      default String getWriteableName()
      Description copied from interface: NamedWriteable
      Returns the name of the writeable object
      Specified by:
      getWriteableName in interface NamedWriteable
    • writeTo

      default void writeTo(StreamOutput out) throws IOException
      Description copied from interface: Writeable
      Write this into the StreamOutput.
      Specified by:
      writeTo in interface Writeable
      Throws:
      IOException
    • toXContentChunked

      default Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params)
      Description copied from interface: ChunkedToXContent
      Create an iterator of ToXContent chunks for a REST response. Each chunk is serialized with the same XContentBuilder and ToXContent.Params, which is also the same as the ToXContent.Params passed as the params argument. For best results, all chunks should be O(1) size. The last chunk in the iterator must always yield at least one byte of output. See also ChunkedToXContentHelper for some handy utilities.

      Note that chunked response bodies cannot send deprecation warning headers once transmission has started, so implementations must check for deprecated feature use before returning.

      Specified by:
      toXContentChunked in interface ChunkedToXContent
      Returns:
      iterator over chunks of ToXContent
    • isStreaming

      default boolean isStreaming()
      Returns true if these results are streamed as chunks, or false if these results contain the entire payload. Defaults to false.
    • publisher

      default Flow.Publisher<? extends InferenceServiceResults.Result> publisher()
      When isStreaming() is true, the InferenceAction.Results will subscribe to this publisher. Implementations should follow the Flow.Publisher spec to stream the chunks.