java.lang.Object
com.agentforge4j.llm.LlmSecretReference
An opaque reference to an LLM provider credential, carried through neutral provider configuration so a raw credential
value never has to travel through the wiring layer.
A reference is either:
- literal — a direct credential value supplied programmatically (or already resolved by the embedding application); or
- indirect — a
scheme:keypointer (for exampleenv:OPENAI_API_KEY) that anLlmSecretResolverturns into anLlmSecretat the point of use.
Deliberately a final class, not a record: a literal reference holds a credential value, so its
toString() is fully redacted; an indirect reference renders only scheme:key (a key
name is not a secret value).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionkey()Returns the lookup key of an indirect reference.static LlmSecretReferenceCreates a literal reference wrapping a direct credential value.Returns the literal credential value.static LlmSecretReferenceParses a raw configuration value into a reference.static LlmSecretReferenceCreates an indirect reference pointing at a credential held in an external source.scheme()Returns the source scheme of an indirect reference.toString()
-
Constructor Details
-
LlmSecretReference
public LlmSecretReference()
-
-
Method Details
-
literal
Creates a literal reference wrapping a direct credential value.- Parameters:
value- the credential value; must not be blank- Returns:
- a literal reference
-
reference
Creates an indirect reference pointing at a credential held in an external source.- Parameters:
scheme- the source scheme, for exampleenvorsysprop; must not be blankkey- the lookup key within that source; must not be blank- Returns:
- an indirect reference
-
parse
Parses a raw configuration value into a reference. A value of the form${env:NAME}or${sysprop:name}becomes an indirect reference; any other value is treated as a literal.- Parameters:
raw- the raw value; must not be blank- Returns:
- the parsed reference
-
literalValue
Returns the literal credential value. Only valid for a literal reference.- Returns:
- the literal value
- Throws:
IllegalStateException- if this is an indirect reference
-
scheme
Returns the source scheme of an indirect reference.- Returns:
- the scheme, for example
env - Throws:
IllegalStateException- if this is a literal reference
-
key
Returns the lookup key of an indirect reference.- Returns:
- the key
- Throws:
IllegalStateException- if this is a literal reference
-
toString
-