Annotation Interface LLMSpec


@Documented @Retention(RUNTIME) @Target({}) public @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
  • Element Details

    • provider

      LLM provider.
      Default:
      OLLAMA
    • model

      String model
      LLM model name.
      Default:
      ""
    • temperature

      float temperature
      Temperature for response randomness (0.0 - 2.0).
      Default:
      0.7f
    • maxTokens

      int maxTokens
      Maximum tokens for LLM responses.
      Default:
      4096
    • topP

      float topP
      Top-p (nucleus sampling) value.
      Default:
      1.0f
    • frequencyPenalty

      float frequencyPenalty
      Frequency penalty (-2.0 to 2.0).
      Default:
      0.0f
    • presencePenalty

      float presencePenalty
      Presence penalty (-2.0 to 2.0).
      Default:
      0.0f
    • fallbackModel

      String fallbackModel
      Fallback model if primary fails.
      Default:
      ""
    • endpoint

      String endpoint
      API endpoint URL override.
      Default:
      ""
    • apiKeyEnv

      String apiKeyEnv
      Environment variable name for API key.
      Default:
      ""
    • timeoutMs

      int timeoutMs
      Request timeout in milliseconds.
      Default:
      60000
    • streaming

      boolean streaming
      Whether to enable streaming responses.
      Default:
      false
    • systemPrompt

      String systemPrompt
      System prompt override.
      Default:
      ""