Skip to main content

GroqLLM

Groq LLM provider.

Constructor

apiKey
string
Groq API key. Defaults to the GROQ_API_KEY environment variable.
model
GroqLLMModel | string
Model ID to use. Default: 'llama-3.3-70b-versatile'.
temperature
number
Sampling temperature; higher values produce more random output. Range 0-2. Default: 0.7.
maxOutputTokens
number
Maximum number of tokens to generate in the completion. Default: 1024.
topP
number | null
Nucleus sampling probability mass (0-1). Default: null (provider default).
frequencyPenalty
number | null
Penalizes new tokens based on their frequency so far (-2.0 to 2.0). Default: null.
presencePenalty
number | null
Penalizes new tokens based on whether they appear so far (-2.0 to 2.0). Default: null.
seed
number | null
Seed for deterministic sampling; identical requests with the same seed aim to return the same result. Default: null.
stop
string | null
Stop sequence(s) at which generation halts. Default: null.
user
string | null
Stable identifier for the end user, used for abuse monitoring. Default: null.
toolChoice
string | null
Controls tool selection, e.g. 'none', 'auto', 'required', or a specific tool. Default: null.
parallelToolCalls
boolean | null
Whether to allow multiple tool calls to run in parallel. Default: null.
responseFormat
Record<string, any> | null
Output format specification, e.g. { type: 'json_object' }. Default: null.
reasoningEffort
string | null
Reasoning effort level for reasoning-capable models, e.g. 'low', 'medium', 'high'. Default: null.
reasoningFormat
string | null
How reasoning content is returned, e.g. 'parsed', 'raw', 'hidden'. Default: null.
serviceTier
string | null
Service tier for the request, e.g. 'auto', 'on_demand', 'flex'. Default: null.

cancelCurrentGeneration

Cancel the in-flight generation for the current session, if any.

chat

Stream a completion for the given messages, yielding LLMResponse chunks.
returns
AsyncIterator<LLMResponse>

close

Release any resources held by the provider.

closeEmitter

Close the emitter: drop all handlers and stop emitting. Waits up to 2 seconds for in-flight async handlers to settle before returning.

emit

event
string
required

getRuntimeConfig

returns
Record<string, any>

listenerCount

event
string
required
returns
number

off

event
string
required
handler
EventHandler
required

on

event
string
required
handler
EventHandler
required
returns
EventHandler

once

event
string
required
handler
EventHandler
required
returns
EventHandler

removeAllListeners

event
string

GroqLLMModel