-
Couldn't load subscription status.
- Fork 169
158 support resource links #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
0e50346
610b9d6
3d182bc
f6c8843
cf7976d
2e7c450
8f00711
c3746a4
f2b04d3
ae1ead0
0bc0304
c210a3a
72cd564
56d8681
cebb28d
c821241
7a2ae41
5136548
98247fb
a0ac8a2
8858a6c
cfad8a5
9a40df1
c62db93
0b6311e
a67f55d
61fcb99
3ac2d96
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -975,19 +975,45 @@ public data class GetPromptRequest( | |
| } | ||
|
|
||
| /** | ||
| * Represents the content of a prompt message. | ||
| * The server's response content indicating the type of content. | ||
| */ | ||
| @Serializable(with = PromptMessageContentPolymorphicSerializer::class) | ||
| public sealed interface PromptMessageContent { | ||
| public sealed interface ContentWithType { | ||
| public val type: String | ||
| } | ||
|
|
||
| /** | ||
| * Represents prompt message content that is either text, image or audio. | ||
| * Represents the content of a prompt message. Deprecated. | ||
| */ | ||
| @Serializable(with = PromptMessageContentMultimodalPolymorphicSerializer::class) | ||
| @Deprecated("For backwards compatibility; use ContentBlock instead", ReplaceWith("ContentBlock")) | ||
| public sealed interface PromptMessageContent : ContentWithType | ||
|
|
||
| /** | ||
| * Represents multimodal content of a prompt message. Deprecated. | ||
| */ | ||
| @Deprecated( | ||
| "For backwards compatibility; use CreateMessageResultContent or SamplingMessageContent instead", | ||
| ReplaceWith("CreateMessageResultContent"), | ||
| ) | ||
| public sealed interface PromptMessageContentMultimodal : PromptMessageContent | ||
|
|
||
| /** | ||
| * Represents the types of a ContentBlock | ||
| */ | ||
| @Serializable(with = ContentBlockPolymorphicSerializer::class) | ||
| public sealed interface ContentBlock : PromptMessageContent | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You’re introducing a new There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason was to keep it backwards compatible. To avoid it immediately breaking ppl's builds when they are upgrading There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In the future, according to the deprecation cycle, we’ll eventually have to remove the old interfaces, which will lead to incompatibility issues.
|
||
|
|
||
| /** | ||
| * Represents content for the CreateMessageResult | ||
| */ | ||
| @Serializable(with = CreateMessageResultContentMultimodalPolymorphicSerializer::class) | ||
| public sealed interface CreateMessageResultContent : ContentWithType | ||
|
|
||
| /** | ||
| * Represents content for the SamplingMessage | ||
| */ | ||
| @Serializable(with = SamplingMessageContentMultimodalPolymorphicSerializer::class) | ||
| public sealed interface SamplingMessageContent : ContentWithType | ||
dstibbe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Text provided to or from an LLM. | ||
| */ | ||
|
|
@@ -1002,7 +1028,9 @@ public data class TextContent( | |
| * Optional annotations for the client. | ||
| */ | ||
| val annotations: Annotations? = null, | ||
| ) : PromptMessageContentMultimodal { | ||
| ) : ContentBlock, | ||
dstibbe marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CreateMessageResultContent, | ||
| SamplingMessageContent { | ||
| override val type: String = TYPE | ||
|
|
||
| public companion object { | ||
|
|
@@ -1029,7 +1057,9 @@ public data class ImageContent( | |
| * Optional annotations for the client. | ||
| */ | ||
| val annotations: Annotations? = null, | ||
| ) : PromptMessageContentMultimodal { | ||
| ) : ContentBlock, | ||
| CreateMessageResultContent, | ||
| SamplingMessageContent { | ||
| override val type: String = TYPE | ||
|
|
||
| public companion object { | ||
|
|
@@ -1056,19 +1086,80 @@ public data class AudioContent( | |
| * Optional annotations for the client. | ||
| */ | ||
| val annotations: Annotations? = null, | ||
| ) : PromptMessageContentMultimodal { | ||
| ) : ContentBlock, | ||
| CreateMessageResultContent, | ||
| SamplingMessageContent { | ||
| override val type: String = TYPE | ||
|
|
||
| public companion object { | ||
| public const val TYPE: String = "audio" | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * A Resource Link provided to or from an LLM. | ||
| */ | ||
| @Serializable | ||
| public data class ResourceLink( | ||
| /** | ||
| * A description of what this resource represents. | ||
| * | ||
| * This can be used by clients to improve the LLM’s understanding of available resources. It can be thought of like a “hint” to the model. | ||
| * | ||
| */ | ||
| val description: String? = null, | ||
|
|
||
| /** | ||
| * Intended for programmatic or logical use, but used as a display name in past specs or fallback (if title isn’t present). | ||
| */ | ||
| val name: String, | ||
|
|
||
| /** | ||
| * The size of the raw resource content, in bytes (i.e., before base64 encoding or any tokenization), if known. | ||
| * | ||
| * This can be used by Hosts to display file sizes and estimate context window usage. | ||
| * | ||
| */ | ||
| val size: Long? = null, | ||
|
|
||
| /** | ||
| * Intended for UI and end-user contexts — optimized to be human-readable and easily understood, even by those unfamiliar with domain-specific terminology. | ||
| * | ||
| * If not provided, the name should be used for display (except for Tool, where annotations.title should be given precedence over using name, if present). | ||
| * | ||
| */ | ||
| val title: String? = null, | ||
|
|
||
| /** | ||
| * The URI of this resource. | ||
| */ | ||
| val uri: String, | ||
|
|
||
| /** | ||
| * The MIME type of this resource, if known. | ||
| */ | ||
| val mimeType: String, | ||
|
|
||
| /** | ||
| * Optional annotations for the client. | ||
| */ | ||
| val annotations: Annotations? = null, | ||
| ) : ContentBlock { | ||
| override val type: String = TYPE | ||
|
|
||
| public companion object { | ||
| public const val TYPE: String = "resource_link" | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Unknown content provided to or from an LLM. | ||
| */ | ||
| @Serializable | ||
| public data class UnknownContent(override val type: String) : PromptMessageContentMultimodal | ||
| public data class UnknownContent(override val type: String) : | ||
| ContentBlock, | ||
| CreateMessageResultContent, | ||
| SamplingMessageContent | ||
|
|
||
| /** | ||
| * The contents of a resource, embedded into a prompt or tool call result. | ||
|
|
@@ -1084,7 +1175,7 @@ public data class EmbeddedResource( | |
| * Optional annotations for the client. | ||
| */ | ||
| val annotations: Annotations? = null, | ||
| ) : PromptMessageContent { | ||
| ) : ContentBlock { | ||
| override val type: String = TYPE | ||
|
|
||
| public companion object { | ||
|
|
@@ -1134,7 +1225,7 @@ public data class Annotations( | |
| * Describes a message returned as part of a prompt. | ||
| */ | ||
| @Serializable | ||
| public data class PromptMessage(val role: Role, val content: PromptMessageContent) | ||
| public data class PromptMessage(val role: Role, val content: ContentBlock) | ||
|
|
||
| /** | ||
| * The server's response to a prompts/get request from the client. | ||
|
|
@@ -1286,7 +1377,7 @@ public class ListToolsResult( | |
| */ | ||
| @Serializable | ||
| public sealed interface CallToolResultBase : ServerResult { | ||
| public val content: List<PromptMessageContent> | ||
| public val content: List<ContentBlock> | ||
| public val structuredContent: JsonObject? | ||
| public val isError: Boolean? get() = false | ||
| } | ||
|
|
@@ -1296,7 +1387,7 @@ public sealed interface CallToolResultBase : ServerResult { | |
| */ | ||
| @Serializable | ||
| public class CallToolResult( | ||
| override val content: List<PromptMessageContent>, | ||
| override val content: List<ContentBlock>, | ||
| override val structuredContent: JsonObject? = null, | ||
| override val isError: Boolean? = false, | ||
| override val _meta: JsonObject = EmptyJsonObject, | ||
|
|
@@ -1307,7 +1398,7 @@ public class CallToolResult( | |
| */ | ||
| @Serializable | ||
| public class CompatibilityCallToolResult( | ||
| override val content: List<PromptMessageContent>, | ||
| override val content: List<ContentBlock>, | ||
| override val structuredContent: JsonObject? = null, | ||
| override val isError: Boolean? = false, | ||
| override val _meta: JsonObject = EmptyJsonObject, | ||
|
|
@@ -1452,7 +1543,7 @@ public class ModelPreferences( | |
| * Describes a message issued to or received from an LLM API. | ||
| */ | ||
| @Serializable | ||
| public data class SamplingMessage(val role: Role, val content: PromptMessageContentMultimodal) | ||
| public data class SamplingMessage(val role: Role, val content: SamplingMessageContent) | ||
|
|
||
| /** | ||
| * A request from the server to sample an LLM via the client. | ||
|
|
@@ -1534,7 +1625,7 @@ public data class CreateMessageResult( | |
| */ | ||
| val stopReason: StopReason? = null, | ||
| val role: Role, | ||
| val content: PromptMessageContentMultimodal, | ||
| val content: CreateMessageResultContent, | ||
| override val _meta: JsonObject = EmptyJsonObject, | ||
| ) : ClientResult | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.