Interface LlmReference
-
- All Implemented Interfaces:
-
com.embabel.common.ai.prompt.PromptContributor,com.embabel.common.ai.prompt.PromptElement,com.embabel.common.core.types.Described,com.embabel.common.core.types.Named,com.embabel.common.core.types.NamedAndDescribed
public interface LlmReference implements NamedAndDescribed, PromptContributorAn 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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public classLlmReference.Companion
-
Method Summary
Modifier and Type Method Description StringtoolPrefix()A safe prefix for LLM tools associated with this reference. ToolObjecttoolObject()Create a tool object for this reference. List<Object>toolInstances()Return the instances of tool object. Stringcontribution()abstract Stringnotes()Notes about this reference, such as usage guidance. List<Tool>tools()Return framework-agnostic tools provided by this reference. LlmReferenceasMatryoshka()Convert this reference to a MatryoshkaReference, exposing a single tool object that supports nesting. StringTransformergetNamingStrategy()-
Methods inherited from class com.embabel.common.ai.prompt.PromptContributor
promptContribution -
Methods inherited from class com.embabel.common.core.types.Described
getDescription -
Methods inherited from class com.embabel.common.core.types.Named
getName -
Methods inherited from class com.embabel.common.ai.prompt.PromptElement
getPromptContributionLocation, getRole -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
toolPrefix
String toolPrefix()
A safe prefix for LLM tools associated with this reference. Defaults to the name lowercased with spaces replaced by underscores. Subclasses can override it
-
toolObject
@Deprecated(message = "Use tools() instead. Tools are now accessed via the tools() method.", level = DeprecationLevel.WARNING) ToolObject toolObject()
Create a tool object for this reference.
-
toolInstances
@Deprecated(message = "Use tools() instead. Convert @LlmTool objects using Tool.fromInstance().", replaceWith = @ReplaceWith(imports = {}, expression = "tools()"), level = DeprecationLevel.WARNING) List<Object> toolInstances()
Return the instances of tool object. Defaults to this
-
contribution
String contribution()
-
notes
abstract String notes()
Notes about this reference, such as usage guidance. Does not need to consider prompt prefix, name or description as they will be added automatically.
-
tools
List<Tool> tools()
Return framework-agnostic tools provided by this reference. These tools will be added to the PromptRunner when the reference is added.
The default implementation bridges from the deprecated toolInstances method by converting any @LlmTool annotated objects to Tool instances. New implementations should override this method directly.
-
asMatryoshka
LlmReference asMatryoshka()
Convert this reference to a MatryoshkaReference, exposing a single tool object that supports nesting. Do not rewrap a MatryoshkaReference. Thus repeated calls to this method are safe.
-
getNamingStrategy
StringTransformer getNamingStrategy()
-
-
-
-