Sake.Content (Sake v0.4.3)

Copy Markdown View Source

A content block of a tool result, a resource read, or a prompt message.

Summary

Types

t()

@type t() :: %Sake.Content{
  annotations: map() | nil,
  blob: boolean(),
  data: binary() | nil,
  description: String.t() | nil,
  meta: map() | nil,
  mime_type: String.t() | nil,
  name: String.t() | nil,
  text: String.t() | nil,
  title: String.t() | nil,
  type: :text | :image | :audio | :resource_link | :resource,
  uri: String.t() | nil
}

Functions

audio(data, mime, opts \\ [])

@spec audio(binary(), String.t(), keyword()) :: t()

from_wire(w)

@spec from_wire(map()) :: t() | {:error, :unknown_content}

image(data, mime, opts \\ [])

@spec image(binary(), String.t(), keyword()) :: t()

resource(uri, content, opts \\ [])

@spec resource(String.t(), String.t() | {:blob, binary()}, keyword()) :: t()

An embedded resource: content is text, or {:blob, binary}.

resource_link(uri, opts \\ [])

@spec resource_link(String.t(), keyword()) :: t()

text(text, opts \\ [])

@spec text(String.t(), keyword()) :: t()

to_wire(c)

@spec to_wire(t()) :: map()