Package com.tnsai.prompt
Record Class PromptSpec
java.lang.Object
java.lang.Record
com.tnsai.prompt.PromptSpec
public record PromptSpec(String version, String description, String author, Set<String> requiredVariables, Set<String> tags, Map<String,String> extra, Instant createdAt, Instant updatedAt)
extends Record
Spec for prompt templates.
Contains versioning information, descriptions, and other metadata useful for prompt management and debugging.
Usage
PromptSpec metadata = PromptSpec.builder()
.version("1.2.0")
.description("Code review prompt for security analysis")
.author("security-team")
.requiredVariables(Set.of("code", "language"))
.tag("security", "code-review")
.build();
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionauthor()Returns the value of theauthorrecord component.static PromptSpec.Builderbuilder()Creates a builder for metadata.Returns the value of thecreatedAtrecord component.static PromptSpecdefaults()Creates default metadata.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.extra()Returns the value of theextrarecord component.Gets an extra metadata value.final inthashCode()Returns a hash code value for this object.booleanReturns whether this prompt has a specific tag.Returns the value of therequiredVariablesrecord component.tags()Returns the value of thetagsrecord component.final StringtoString()Returns a string representation of this record class.Returns the value of theupdatedAtrecord component.version()Returns the value of theversionrecord component.
-
Constructor Details
-
Method Details
-
defaults
Creates default metadata.- Returns:
- default metadata
-
builder
Creates a builder for metadata.- Returns:
- new builder
-
hasTag
Returns whether this prompt has a specific tag.- Parameters:
tag- the tag to check- Returns:
- true if tag exists
-
getExtra
Gets an extra metadata value.- Parameters:
key- the key- Returns:
- value or null
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
version
Returns the value of theversionrecord component.- Returns:
- the value of the
versionrecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
author
Returns the value of theauthorrecord component.- Returns:
- the value of the
authorrecord component
-
requiredVariables
Returns the value of therequiredVariablesrecord component.- Returns:
- the value of the
requiredVariablesrecord component
-
tags
Returns the value of thetagsrecord component.- Returns:
- the value of the
tagsrecord component
-
extra
Returns the value of theextrarecord component.- Returns:
- the value of the
extrarecord component
-
createdAt
Returns the value of thecreatedAtrecord component.- Returns:
- the value of the
createdAtrecord component
-
updatedAt
Returns the value of theupdatedAtrecord component.- Returns:
- the value of the
updatedAtrecord component
-