Polyweave

@polyweave/groq (1.0.4)

Published 2026-07-10 18:30:44 +00:00 by Dvorak

Installation

@polyweave:registry=https://hub.kl1.tenere.ai/api/packages/Polyweave/npm/
npm install @polyweave/groq@1.0.4
"@polyweave/groq": "1.0.4"

About this package

Groq

Fast inference adapter for Polyweave. Powered by Groq's LPU inference engine (500-1000 tokens/second).

Published as @polyweave/groq.

Synopsis

import { createGroqAdapter } from '@polyweave/groq';
import { createTextFrame, createFrameSink } from '@polyweave/core';

var adapter = createGroqAdapter({ apiKey: process.env.GROQ_API_KEY, model: 'llama-3.3-70b-versatile' });

adapter.source.pipe(createFrameSink(function(frame) {
  if (frame.type === 'TEXT') console.log(frame.content.text);
}));

adapter.sink.write(createTextFrame('Explain quantum computing in one sentence'));

Install

npm install @polyweave/groq

Description

Groq adapter with OpenAI-compatible chat completions and Whisper audio transcription. Groq's LPU (Language Processing Unit) delivers the fastest inference speeds in the market.

Models: llama-3.3-70b-versatile, llama-3.1-8b-instant, openai/gpt-oss-120b, openai/gpt-oss-20b, qwen/qwen3-32b, whisper-large-v3, whisper-large-v3-turbo.

API

createGroqAdapter(config)

Parameter Type Default Description
config.apiKey string process.env.GROQ_API_KEY API key
config.baseURL string https://api.groq.com/openai/v1 Base URL override
config.model string llama-3.3-70b-versatile Default model
config.budget number 0 Budget cap
config.name string null Node name for PARAM targeting
config.timeout number 120000 Request timeout in ms

Returns an IFrameDuplex with source and sink.

Frame Protocol

Inbound Outbound
TEXT, AUDIO TEXT, AUDIO, TOOL_CALL, RECEIPT, ERROR, END
PARAM
COST_CHECK COST

PARAM Keys

model, max_tokens, temperature, top_p, stream, system, tools, tool_choice, response_format, audio_model, budget, apiKey

Tests

npm test

Covers adapter construction, frame buffering, and PARAM accumulation.

Requirements

Node.js 18 or later. ESM only.

Caveats

Groq's models are fast but have lower context windows than some providers. Audio transcription uses multipart form-data upload. Tool calling is OpenAI-compatible.

See Also

License

MIT

Dependencies

Development Dependencies

ID Version
@rigor/core *

Peer Dependencies

ID Version
@polyweave/core *
@polyweave/costs *

Keywords

polyweave groq llm lpu fast-inference adapter
Details
npm
2026-07-10 18:30:44 +00:00
4
John Dvorak
SEE LICENSE IN LICENSE
6.4 KiB
Assets (1)
groq-1.0.4.tgz 6.4 KiB
Versions (6) View all
1.0.7 2026-07-17
1.0.8 2026-07-11
1.0.5 2026-07-10
1.0.4 2026-07-10
1.0.3 2026-07-10