@memberjunction/ai-groq 4.4.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -3
- package/README.md +0 -89
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/ai-groq",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "5.0.0",
|
|
5
5
|
"description": "MemberJunction Wrapper for Groq AI LPU inference engine",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"typescript": "^5.9.3"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@memberjunction/ai": "
|
|
25
|
-
"@memberjunction/global": "
|
|
24
|
+
"@memberjunction/ai": "5.0.0",
|
|
25
|
+
"@memberjunction/global": "5.0.0",
|
|
26
26
|
"groq-sdk": "^0.37.0"
|
|
27
27
|
},
|
|
28
28
|
"repository": {
|
package/README.md
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
# @memberjunction/ai-groq
|
|
2
|
-
|
|
3
|
-
MemberJunction AI provider for Groq's ultra-fast inference platform. This package extends the OpenAI provider to work with Groq's OpenAI-compatible API, providing access to LLM inference powered by Groq's custom Language Processing Units (LPUs) for industry-leading inference speed.
|
|
4
|
-
|
|
5
|
-
## Architecture
|
|
6
|
-
|
|
7
|
-
```mermaid
|
|
8
|
-
graph TD
|
|
9
|
-
A["GroqLLM<br/>(Provider)"] -->|extends| B["OpenAILLM<br/>(@memberjunction/ai-openai)"]
|
|
10
|
-
B -->|extends| C["BaseLLM<br/>(@memberjunction/ai)"]
|
|
11
|
-
A -->|overrides base URL| D["Groq API<br/>(api.groq.com/openai/v1)"]
|
|
12
|
-
D -->|runs on| E["Groq LPU<br/>Inference Engine"]
|
|
13
|
-
C -->|registered via| F["@RegisterClass"]
|
|
14
|
-
|
|
15
|
-
style A fill:#7c5295,stroke:#563a6b,color:#fff
|
|
16
|
-
style B fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
17
|
-
style C fill:#2d6a9f,stroke:#1a4971,color:#fff
|
|
18
|
-
style D fill:#2d8659,stroke:#1a5c3a,color:#fff
|
|
19
|
-
style E fill:#b8762f,stroke:#8a5722,color:#fff
|
|
20
|
-
style F fill:#b8762f,stroke:#8a5722,color:#fff
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## Features
|
|
24
|
-
|
|
25
|
-
- **Ultra-Fast Inference**: Groq's custom LPU hardware delivers extremely low latency
|
|
26
|
-
- **OpenAI Compatible**: Inherits all features from the OpenAI provider
|
|
27
|
-
- **Streaming**: Full streaming support for real-time responses
|
|
28
|
-
- **Thinking/Reasoning**: Thinking block extraction for reasoning models
|
|
29
|
-
- **Multiple Models**: Access to Llama, Mixtral, Gemma, and other open models optimized for Groq
|
|
30
|
-
|
|
31
|
-
## Installation
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm install @memberjunction/ai-groq
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Usage
|
|
38
|
-
|
|
39
|
-
```typescript
|
|
40
|
-
import { GroqLLM } from '@memberjunction/ai-groq';
|
|
41
|
-
|
|
42
|
-
const llm = new GroqLLM('your-groq-api-key');
|
|
43
|
-
|
|
44
|
-
const result = await llm.ChatCompletion({
|
|
45
|
-
model: 'llama-3.1-70b-versatile',
|
|
46
|
-
messages: [
|
|
47
|
-
{ role: 'system', content: 'You are a helpful assistant.' },
|
|
48
|
-
{ role: 'user', content: 'Explain neural networks.' }
|
|
49
|
-
],
|
|
50
|
-
temperature: 0.7,
|
|
51
|
-
maxOutputTokens: 1000
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
if (result.success) {
|
|
55
|
-
console.log(result.data.choices[0].message.content);
|
|
56
|
-
}
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
### Streaming
|
|
60
|
-
|
|
61
|
-
```typescript
|
|
62
|
-
const result = await llm.ChatCompletion({
|
|
63
|
-
model: 'llama-3.1-8b-instant',
|
|
64
|
-
messages: [{ role: 'user', content: 'Write a haiku about speed.' }],
|
|
65
|
-
streaming: true,
|
|
66
|
-
streamingCallbacks: {
|
|
67
|
-
OnContent: (content) => process.stdout.write(content),
|
|
68
|
-
OnComplete: () => console.log('\nDone!')
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## How It Works
|
|
74
|
-
|
|
75
|
-
`GroqLLM` is a thin subclass of `OpenAILLM` that redirects API calls to Groq's endpoint at `https://api.groq.com/openai/v1`. Since Groq implements an OpenAI-compatible API, all chat, streaming, and parameter handling logic is inherited from the OpenAI provider.
|
|
76
|
-
|
|
77
|
-
## Supported Parameters
|
|
78
|
-
|
|
79
|
-
All parameters supported by the OpenAI provider are available, including `temperature`, `maxOutputTokens`, `topP`, `frequencyPenalty`, `presencePenalty`, `seed`, `stopSequences`, and `responseFormat`.
|
|
80
|
-
|
|
81
|
-
## Class Registration
|
|
82
|
-
|
|
83
|
-
Registered as `GroqLLM` via `@RegisterClass(BaseLLM, 'GroqLLM')`.
|
|
84
|
-
|
|
85
|
-
## Dependencies
|
|
86
|
-
|
|
87
|
-
- `@memberjunction/ai` - Core AI abstractions
|
|
88
|
-
- `@memberjunction/ai-openai` - OpenAI provider (parent class)
|
|
89
|
-
- `@memberjunction/global` - Class registration
|