Package com.tnsai.llm.observability
Record Class ToolSurface
java.lang.Object
java.lang.Record
com.tnsai.llm.observability.ToolSurface
public record ToolSurface(List<String> toolNames, List<String> toolSchemas, String surfaceHash)
extends Record
Snapshot of the tool set advertised to the LLM on one call (issue #79).
surfaceHash is a stable SHA-256 fingerprint derived from
sorted tool names + their schemas. Two calls with the same tool set
(same names, same JSON schemas, any order) produce the same hash —
letting operators spot prompt-caching opportunities (Anthropic charges
less for cached prompt prefixes, and the tool-surface portion of the
prompt is often the longest stable prefix).
- Since:
- 0.5.0 (issue #79)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ToolSurfaceempty()An empty tool surface — the LLM call advertised no tools.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.static ToolSurfaceBuild a tool surface from parallelnamesandschemaslists.Returns the value of thesurfaceHashrecord component.Returns the value of thetoolNamesrecord component.Returns the value of thetoolSchemasrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ToolSurface
Creates an instance of aToolSurfacerecord class.- Parameters:
toolNames- the value for thetoolNamesrecord componenttoolSchemas- the value for thetoolSchemasrecord componentsurfaceHash- the value for thesurfaceHashrecord component
-
-
Method Details
-
empty
An empty tool surface — the LLM call advertised no tools. -
of
Build a tool surface from parallelnamesandschemaslists. The hash is derived from the (name, schema) pairs sorted by name — order-independent. -
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). -
toolNames
Returns the value of thetoolNamesrecord component.- Returns:
- the value of the
toolNamesrecord component
-
toolSchemas
Returns the value of thetoolSchemasrecord component.- Returns:
- the value of the
toolSchemasrecord component
-
surfaceHash
Returns the value of thesurfaceHashrecord component.- Returns:
- the value of the
surfaceHashrecord component
-