Package com.tnsai.annotations
Annotation Interface LLMSpec
LLM configuration for Agents and Roles.
Can be used:
- On Agent class - primary LLM configuration
- Within @RoleSpec - role-specific LLM override
Usage on Agent
@AgentSpec(description = "Support agent")
@LLMSpec(
provider = Provider.OLLAMA,
model = "llama3.2",
temperature = 0.7f
)
public class SupportAgent extends Agent { ... }
Usage in Role
@RoleSpec(
name = "Researcher",
llm = @LLMSpec(provider = Provider.OPENAI, model = "gpt-4o")
)
public class ResearchRole extends Role { ... }
- Author:
- TnsAI Team
-
Nested Class Summary
Nested Classes -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionEnvironment variable name for API key.API endpoint URL override.Fallback model if primary fails.floatFrequency penalty (-2.0 to 2.0).intMaximum tokens for LLM responses.LLM model name.floatPresence penalty (-2.0 to 2.0).LLM provider.booleanWhether to enable streaming responses.System prompt override.floatTemperature for response randomness (0.0 - 2.0).intRequest timeout in milliseconds.floatTop-p (nucleus sampling) value.
-
Element Details
-
provider
LLMSpec.Provider providerLLM provider.- Default:
OLLAMA
-
model
String modelLLM model name.- Default:
""
-
temperature
float temperatureTemperature for response randomness (0.0 - 2.0).- Default:
0.7f
-
maxTokens
int maxTokensMaximum tokens for LLM responses.- Default:
4096
-
topP
float topPTop-p (nucleus sampling) value.- Default:
1.0f
-
frequencyPenalty
float frequencyPenaltyFrequency penalty (-2.0 to 2.0).- Default:
0.0f
-
presencePenalty
float presencePenaltyPresence penalty (-2.0 to 2.0).- Default:
0.0f
-
fallbackModel
String fallbackModelFallback model if primary fails.- Default:
""
-
endpoint
String endpointAPI endpoint URL override.- Default:
""
-
apiKeyEnv
String apiKeyEnvEnvironment variable name for API key.- Default:
""
-
timeoutMs
int timeoutMsRequest timeout in milliseconds.- Default:
60000
-
streaming
boolean streamingWhether to enable streaming responses.- Default:
false
-
systemPrompt
String systemPromptSystem prompt override.- Default:
""
-