ACPex.Schema.Types.ContentBlock.Resource (ACPex v0.1.1)

Copy Markdown View Source

Embedded resource content block.

Represents embedded resource contents in a prompt or message. The resource can be either text or binary data.

Required Fields

  • type - Always "resource" for this variant
  • resource - Embedded resource contents (map with text or blob data)

Optional Fields

  • annotations - Additional annotations (map)
  • meta - Additional metadata (map)

Resource Structure

The resource field should contain either:

Text Resource

%{
  "uri" => "file:///path/to/file.txt",
  "text" => "file contents...",
  "mimeType" => "text/plain"
}

Blob Resource

%{
  "uri" => "file:///path/to/file.bin",
  "blob" => "base64-encoded-data...",
  "mimeType" => "application/octet-stream"
}

Example

%ACPex.Schema.Types.ContentBlock.Resource{
  type: "resource",
  resource: %{
    "uri" => "file:///home/user/config.json",
    "text" => "{\"setting\": \"value\"}",
    "mimeType" => "application/json"
  }
}

JSON Representation

{
  "type": "resource",
  "resource": {
    "uri": "file:///home/user/config.json",
    "text": "{\"setting\": \"value\"}",
    "mimeType": "application/json"
  }
}

Summary

Functions

Creates a changeset for validation.

Types

t()

@type t() :: %ACPex.Schema.Types.ContentBlock.Resource{
  annotations: map() | nil,
  meta: map() | nil,
  resource: map(),
  type: String.t()
}

Functions

changeset(struct \\ %__MODULE__{}, params)

@spec changeset(t(), map()) :: Ecto.Changeset.t()

Creates a changeset for validation.

Required Fields

  • resource - Must be present and contain either text or blob data

The type field defaults to "resource".