Class MessageSource
java.lang.Object
com.github.copilot.rpc.MessageSource
The origin of a message sent to a Copilot session.
Set on MessageOptions.setSource(MessageSource) to distinguish user
input, system context, and messages from identified agents. This does not
configure the session's system prompt or change the message delivery mode.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MessageSourceApplication-generated system context.static final MessageSourceInput originating from the user. -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageSourceIdentifies a message from an agent.booleanstatic MessageSourceDeserializes a JSON string into the corresponding message source.getValue()Returns the JSON value for this message source.inthashCode()toString()
-
Field Details
-
USER
Input originating from the user. -
SYSTEM
Application-generated system context.
-
-
Method Details
-
agent
Identifies a message from an agent.- Parameters:
id- the opaque agent identifier, preserved exactly afteragent-- Returns:
- the agent message source
- Throws:
NullPointerException- ifidisnull
-
getValue
Returns the JSON value for this message source.- Returns:
- the string value used in JSON serialization
-
fromValue
Deserializes a JSON string into the corresponding message source.- Parameters:
value- the JSON string value- Returns:
- the matching source, or
nullif value isnull - Throws:
IllegalArgumentException- if the value does not match a known message source
-
toString
-
equals
-
hashCode
-