Module org.elasticsearch.server
Package org.elasticsearch.inference
Interface InferenceServiceResults
- All Superinterfaces:
ChunkedToXContent,NamedWriteable,Writeable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
EMPTY -
Method Summary
Modifier and TypeMethodDescriptionasMap()Convert the result to a map to aid with test assertionsdefault StringReturns the name of the writeable objectdefault booleanReturnstrueif these results are streamed as chunks, orfalseif these results contain the entire payload.default Flow.Publisher<? extends InferenceServiceResults.Result> WhenisStreaming()istrue, the InferenceAction.Results will subscribe to this publisher.default Iterator<? extends ToXContent> toXContentChunked(ToXContent.Params params) Create an iterator ofToXContentchunks for a REST response.default List<? extends InferenceResults> Transform the result to match the format required for the TransportCoordinatedInferenceAction.default voidwriteTo(StreamOutput out) Write this into the StreamOutput.Methods inherited from interface org.elasticsearch.common.xcontent.ChunkedToXContent
isFragment, toXContentChunked, toXContentChunkedV8
-
Method Details
-
transformToCoordinationFormat
Transform the result to match the format required for the TransportCoordinatedInferenceAction. TransportCoordinatedInferenceAction expects an ml plugin TextEmbeddingResults or SparseEmbeddingResults.
-
asMap
Convert the result to a map to aid with test assertions -
getWriteableName
Description copied from interface:NamedWriteableReturns the name of the writeable object- Specified by:
getWriteableNamein interfaceNamedWriteable
-
writeTo
Description copied from interface:WriteableWrite this into the StreamOutput.- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
toXContentChunked
Description copied from interface:ChunkedToXContentCreate an iterator ofToXContentchunks for a REST response. Each chunk is serialized with the sameXContentBuilderandToXContent.Params, which is also the same as theToXContent.Paramspassed as theparamsargument. For best results, all chunks should beO(1)size. The last chunk in the iterator must always yield at least one byte of output. See alsoChunkedToXContentHelperfor 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:
toXContentChunkedin interfaceChunkedToXContent- Returns:
- iterator over chunks of
ToXContent
-
isStreaming
default boolean isStreaming()Returnstrueif these results are streamed as chunks, orfalseif these results contain the entire payload. Defaults tofalse. -
publisher
WhenisStreaming()istrue, the InferenceAction.Results will subscribe to this publisher. Implementations should follow theFlow.Publisherspec to stream the chunks.
-