Class Interaction
java.lang.Object
org.opensearch.ml.common.conversation.Interaction
- All Implemented Interfaces:
org.opensearch.core.common.io.stream.Writeable,org.opensearch.core.xcontent.ToXContent,org.opensearch.core.xcontent.ToXContentObject
public class Interaction
extends Object
implements org.opensearch.core.common.io.stream.Writeable, org.opensearch.core.xcontent.ToXContentObject
Class for dealing with Interactions
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V> -
Field Summary
Fields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionInteraction(String id, Instant createTime, String conversationId, String input, String promptTemplate, String response, String origin, Map<String, String> additionalInfo) Interaction(String id, Instant createTime, String conversationId, String input, String promptTemplate, String response, String origin, Map<String, String> additionalInfo, String parentInteractionId, Integer traceNum) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()booleanstatic InteractionCreates an Interaction object from a map of fields in the OS indexstatic InteractionfromSearchHit(org.opensearch.search.SearchHit hit) Creates an Interaction object from a search hitstatic InteractionfromStream(org.opensearch.core.common.io.stream.StreamInput in) Creates a new Interaction object from a streamgetId()getInput()toString()org.opensearch.core.xcontent.XContentBuildertoXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) voidwriteTo(org.opensearch.core.common.io.stream.StreamOutput out) Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentObject
isFragment
-
Constructor Details
-
Interaction
-
Interaction
-
-
Method Details
-
fromMap
Creates an Interaction object from a map of fields in the OS index- Parameters:
id- the Interaction idfields- the field mapping from the OS document- Returns:
- a new Interaction object representing the OS document
-
fromSearchHit
Creates an Interaction object from a search hit- Parameters:
hit- the search hit from the interactions index- Returns:
- a new Interaction object representing the search hit
-
fromStream
public static Interaction fromStream(org.opensearch.core.common.io.stream.StreamInput in) throws IOException Creates a new Interaction object from a stream- Parameters:
in- stream to read from; assumes Interactions.writeTo was called on it- Returns:
- a new Interaction
- Throws:
IOException- if can't read or the stream isn't pointing to an intraction or something
-
writeTo
- Specified by:
writeToin interfaceorg.opensearch.core.common.io.stream.Writeable- Throws:
IOException
-
toXContent
public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.opensearch.core.xcontent.ToXContent- Throws:
IOException
-
equals
-
toString
-
builder
-
toBuilder
-
getId
-
getCreateTime
-
getConversationId
-
getInput
-
getPromptTemplate
-
getResponse
-
getOrigin
-
getAdditionalInfo
-
getParentInteractionId
-
getTraceNum
-