Note that the modelPath is the only required parameter. For testing you can set this in the environment variable LLAMA_PATH.

interface TogetherAIInputs {
    apiKey?: string;
    cache?: boolean | BaseCache<Generation[]>;
    callbackManager?: CallbackManager;
    callbacks?: Callbacks;
    concurrency?: number;
    logprobs?: number;
    maxConcurrency?: number;
    maxRetries?: number;
    maxTokens?: number;
    metadata?: Record<string, unknown>;
    model?: string;
    modelName?: string;
    onFailedAttempt?: FailedAttemptHandler;
    repetitionPenalty?: number;
    safetyModel?: string;
    stop?: string[];
    streaming?: boolean;
    tags?: string[];
    temperature?: number;
    topK?: number;
    topP?: number;
    verbose?: boolean;
}

Hierarchy

  • BaseLLMParams
    • TogetherAIInputs

Properties

apiKey?: string

The API key to use for the TogetherAI API.

{process.env.TOGETHER_AI_API_KEY}
cache?: boolean | BaseCache<Generation[]>
callbackManager?: CallbackManager

Use callbacks instead

callbacks?: Callbacks
concurrency?: number

Use maxConcurrency instead

logprobs?: number

An integer that specifies how many top token log probabilities are included in the response for each token generation step.

maxConcurrency?: number

The maximum number of concurrent calls that can be made. Defaults to Infinity, which means no limit.

maxRetries?: number

The maximum number of retries that can be made for a single call, with an exponential backoff between each attempt. Defaults to 6.

maxTokens?: number

Limit the number of tokens generated.

metadata?: Record<string, unknown>
model?: string

The name of the model to query.

modelName?: string

The name of the model to query. Alias for model

onFailedAttempt?: FailedAttemptHandler

Custom handler to handle failed attempts. Takes the originally thrown error object as input, and should itself throw an error if the input error is not retryable.

repetitionPenalty?: number

A number that controls the diversity of generated text by reducing the likelihood of repeated sequences. Higher values decrease repetition.

{1}
safetyModel?: string

Run an LLM-based input-output safeguard model on top of any model.

stop?: string[]

A list of tokens at which the generation should stop.

streaming?: boolean

Whether or not to stream tokens as they are generated.

{false}
tags?: string[]
temperature?: number

A decimal number that determines the degree of randomness in the response. A value of 1 will always yield the same output. A temperature less than 1 favors more correctness and is appropriate for question answering or summarization. A value greater than 1 introduces more randomness in the output.

{0.7}
topK?: number

The topK parameter is used to limit the number of choices for the next predicted word or token. It specifies the maximum number of tokens to consider at each step, based on their probability of occurrence. This technique helps to speed up the generation process and can improve the quality of the generated text by focusing on the most likely options.

{50}
topP?: number

The topP (nucleus) parameter is used to dynamically adjust the number of choices for each predicted token based on the cumulative probabilities. It specifies a probability threshold, below which all less likely tokens are filtered out. This technique helps to maintain diversity and generate more fluent and natural-sounding text.

{0.7}
verbose?: boolean