Table of Contents

Method GetContentAsync

Namespace
LMKit.Agents.Skills
Assembly
LM-Kit.NET.dll

GetContentAsync(Encoding, CancellationToken)

Gets the text content of this resource asynchronously.

Content is cached after first load. Subsequent calls return the cached value.

public Task<string> GetContentAsync(Encoding encoding = null, CancellationToken cancellationToken = default)

Parameters

encoding Encoding

The encoding to use when reading the file. Defaults to UTF-8 if null.

cancellationToken CancellationToken

A token to observe while waiting for the task to complete.

Returns

Task<string>

A task representing the asynchronous read operation.

Examples

Asynchronously loading resource content:

var skill = AgentSkill.Load("./skills/api-designer");
var template = skill.GetResource("templates/openapi.yaml");
string content = await template.GetContentAsync();

Exceptions

FileNotFoundException

Thrown when the resource file does not exist.

IOException

Thrown when an I/O error occurs while reading the file.