Record Class AiRequest
java.lang.Object
java.lang.Record
com.shaft.pilot.ai.AiRequest
- Record Components:
requestId- safe request correlation identifierpurpose- purpose-bound operation nameschemaVersion- request contract versiontext- primary text inputevidence- additional textual evidenceimages- approved image evidencedesiredResponseSchema- desired JSON response schematimeout- request timeoutbudget- request budgetapprovalPolicy- explicit processing and evidence approvaldeterministicFallback- caller-owned deterministic result
public record AiRequest(String requestId, String purpose, String schemaVersion, String text, List<EvidenceReference> evidence, List<AiImage> images, com.fasterxml.jackson.databind.JsonNode desiredResponseSchema, Duration timeout, AiBudget budget, ApprovalPolicy approvalPolicy, com.fasterxml.jackson.databind.JsonNode deterministicFallback)
extends Record
Immutable provider-neutral request.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAiRequest(String requestId, String purpose, String schemaVersion, String text, List<EvidenceReference> evidence, List<AiImage> images, com.fasterxml.jackson.databind.JsonNode desiredResponseSchema, Duration timeout, AiBudget budget, ApprovalPolicy approvalPolicy, com.fasterxml.jackson.databind.JsonNode deterministicFallback) Creates and defensively copies a request. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theapprovalPolicyrecord component.budget()Returns the value of thebudgetrecord component.static AiRequest.BuilderStarts a request builder.com.fasterxml.jackson.databind.JsonNodeReturns the value of thedesiredResponseSchemarecord component.com.fasterxml.jackson.databind.JsonNodeReturns the value of thedeterministicFallbackrecord component.final booleanIndicates whether some other object is "equal to" this one.evidence()Returns the value of theevidencerecord component.Returns all evidence categories present in this request.final inthashCode()Returns a hash code value for this object.images()Returns the value of theimagesrecord component.purpose()Returns the value of thepurposerecord component.Returns the value of therequestIdrecord component.Returns the value of theschemaVersionrecord component.text()Returns the value of thetextrecord component.timeout()Returns the value of thetimeoutrecord component.final StringtoString()Returns a string representation of this record class.withSanitizedContent(String sanitizedText, List<EvidenceReference> sanitizedEvidence) Creates a copy containing sanitized text and evidence.withTimeout(Duration effectiveTimeout) Creates a copy with an effective timeout.
-
Field Details
-
CURRENT_SCHEMA_VERSION
- See Also:
-
-
Constructor Details
-
AiRequest
public AiRequest(String requestId, String purpose, String schemaVersion, String text, List<EvidenceReference> evidence, List<AiImage> images, com.fasterxml.jackson.databind.JsonNode desiredResponseSchema, Duration timeout, AiBudget budget, ApprovalPolicy approvalPolicy, com.fasterxml.jackson.databind.JsonNode deterministicFallback) Creates and defensively copies a request.
-
-
Method Details
-
builder
public static AiRequest.Builder builder(String purpose, com.fasterxml.jackson.databind.JsonNode responseSchema) Starts a request builder.- Parameters:
purpose- purpose-bound operation nameresponseSchema- desired JSON response schema- Returns:
- request builder
-
evidenceCategories
Returns all evidence categories present in this request.- Returns:
- immutable category set
-
withSanitizedContent
public AiRequest withSanitizedContent(String sanitizedText, List<EvidenceReference> sanitizedEvidence) Creates a copy containing sanitized text and evidence.- Parameters:
sanitizedText- redacted primary textsanitizedEvidence- redacted evidence- Returns:
- sanitized request copy
-
withTimeout
-
toString
-
hashCode
-
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). -
requestId
-
purpose
-
schemaVersion
Returns the value of theschemaVersionrecord component.- Returns:
- the value of the
schemaVersionrecord component
-
text
-
evidence
-
images
-
desiredResponseSchema
public com.fasterxml.jackson.databind.JsonNode desiredResponseSchema()Returns the value of thedesiredResponseSchemarecord component.- Returns:
- the value of the
desiredResponseSchemarecord component
-
timeout
-
budget
-
approvalPolicy
Returns the value of theapprovalPolicyrecord component.- Returns:
- the value of the
approvalPolicyrecord component
-
deterministicFallback
public com.fasterxml.jackson.databind.JsonNode deterministicFallback()Returns the value of thedeterministicFallbackrecord component.- Returns:
- the value of the
deterministicFallbackrecord component
-