Function model

  • model decorator to associate a model identifier and configuration with an agent.

    Parameters

    • modelIdentifier: string

      The model identifier string. List of model identifiers available at https://axar-ai.gitbook.io/axar/basics/model

    • Optionalconfig: ModelConfig

      Optional configuration for the model

      • maxTokens

        Maximum number of tokens to generate

      • temperature

        Sampling temperature between 0 and 1. Use either temperature or topP, not both.

      • topP

        Nucleus sampling threshold. Sample from tokens whose cumulative probability exceeds topP. Use either temperature or topP, not both.

      • topK

        Only sample from the top K options for each subsequent token. Recommended for advanced use cases only.

      • presencePenalty

        Penalize tokens based on their presence in the prompt and generated text. Value between -2.0 and 2.0.

      • frequencyPenalty

        Penalize tokens based on their frequency in the generated text. Value between -2.0 and 2.0.

      • maxRetries

        Maximum number of retries for failed requests (defaults to 2 in SDK)

      • maxSteps

        Maximum number of steps for tool calling (defaults to 3)

      • toolChoice

        Tool choice mode - 'auto' or 'none'

    Returns ClassDecorator

    A class decorator function.

    // Basic usage
    @model('openai:gpt-4-mini')
    class MyAgent extends Agent<string, string> {}

    // With configuration
    @model('openai:gpt-4-mini', {
    maxTokens: 100,
    temperature: 0.7,
    maxRetries: 3,
    maxSteps: 5,
    toolChoice: 'auto'
    })
    class MyConfiguredAgent extends Agent<string, string> {}

    // With advanced sampling parameters
    @model('openai:gpt-4-mini', {
    topP: 0.9, // nucleus sampling
    topK: 50, // top-k sampling
    presencePenalty: 0.6, // reduce repetition
    frequencyPenalty: 0.5 // reduce common tokens
    })
    class CreativeAgent extends Agent<string, string> {}