LlmReference

An LLmReference exposes tools and is a prompt contributor. The prompt contribution might describe how to use the tools or can include relevant information directly. Consider, for example, a reference to an API which is so small it's included in the prompt, versus a large API which must be accessed via tools. The reference name is used in a strategy for tool naming, so should be fairly short. Description may be more verbose. If you want a custom naming strategy, use a ToolObject directly, and add the PromptContributor separately.

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Naming strategy for tools associated with this reference. Defaults to prefixing tool names with the tool prefix and an underscore.

Link copied to clipboard
open val role: String?

Role defaults to class simple name. Override for stereotyped roles.

Functions

Link copied to clipboard
open override fun contribution(): String

Return the string content of the contribution.

Link copied to clipboard
abstract fun notes(): String

Notes about this reference, such as usage guidance. Does not need to consider prompt prefix, name or description as they will be added automatically.

Link copied to clipboard
Link copied to clipboard
open fun toolInstances(): List<Any>

Return the instances of tool object. Defaults to this

Link copied to clipboard

Create a tool object for this reference.

Link copied to clipboard
open fun toolPrefix(): String

A safe prefix for LLM tools associated with this reference. Defaults to the name lowercased with spaces replaced by underscores. Subclasses can override it

Link copied to clipboard
open fun tools(): List<Tool>

Return framework-agnostic tools provided by this reference. These tools will be added to the PromptRunner when the reference is added.

Link copied to clipboard

Convert this reference to a reference exposing a single unfolding tool. Does not rewrap an unfolding reference. Thus repeated calls to this method are safe.

open fun withUnfolding(childToolUsageNotes: String?): LlmReference

Convert this reference to a reference exposing a single unfolding tool, with progressively-disclosed detail attached.