@yamzzdev/aiyamz 1.0.4 → 1.0.5

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.
@@ -6,26 +6,7 @@ class GroqProvider {
6
6
  throw new Error('API Key is required. Get your API key at: https://console.groq.com/keys');
7
7
  }
8
8
  this.client = new Groq({ apiKey });
9
- this.model = "gpt-oss-120b";
10
- this.availableModels = [
11
- "gpt-oss-120b",
12
- "llama-3.1-8b-instant",
13
- "llama-3.1-70b-versatile",
14
- "mixtral-8x7b-32768",
15
- "gemma2-9b-it"
16
- ];
17
- }
18
-
19
- setModel(modelName) {
20
- if (this.availableModels.includes(modelName)) {
21
- this.model = modelName;
22
- return true;
23
- }
24
- return false;
25
- }
26
-
27
- getModels() {
28
- return this.availableModels;
9
+ this.model = "llama-3.1-8b-instant";
29
10
  }
30
11
 
31
12
  async chat(message, options = {}) {
@@ -46,11 +27,9 @@ class GroqProvider {
46
27
 
47
28
  const completion = await this.client.chat.completions.create({
48
29
  messages: messages,
49
- model: options.model || this.model,
30
+ model: this.model,
50
31
  temperature: options.temperature || 0.7,
51
32
  max_tokens: options.maxTokens || 2048,
52
- top_p: options.topP || 1,
53
- stop: options.stop || null
54
33
  });
55
34
 
56
35
  if (!completion.choices || completion.choices.length === 0) {
@@ -64,8 +43,6 @@ class GroqProvider {
64
43
  throw new Error('Invalid API key. Please check your GROQ_API_KEY');
65
44
  } else if (error.status === 429) {
66
45
  throw new Error('Rate limit exceeded. Please wait a moment and try again');
67
- } else if (error.status === 404) {
68
- throw new Error('Model not found. Please check the model name');
69
46
  } else {
70
47
  throw new Error(`API Error: ${error.message}`);
71
48
  }
@@ -76,10 +53,9 @@ class GroqProvider {
76
53
  try {
77
54
  const stream = await this.client.chat.completions.create({
78
55
  messages: [{ role: "user", content: message }],
79
- model: options.model || this.model,
56
+ model: this.model,
80
57
  temperature: options.temperature || 0.7,
81
58
  max_tokens: options.maxTokens || 2048,
82
- top_p: options.topP || 1,
83
59
  stream: true,
84
60
  });
85
61
 
@@ -91,29 +67,7 @@ class GroqProvider {
91
67
  }
92
68
 
93
69
  } catch (error) {
94
- if (error.status === 401) {
95
- throw new Error('Invalid API key. Please check your GROQ_API_KEY');
96
- } else if (error.status === 429) {
97
- throw new Error('Rate limit exceeded. Please wait a moment and try again');
98
- } else {
99
- throw new Error(`Stream error: ${error.message}`);
100
- }
101
- }
102
- }
103
-
104
- async chatWithHistory(messages, options = {}) {
105
- try {
106
- const completion = await this.client.chat.completions.create({
107
- messages: messages,
108
- model: options.model || this.model,
109
- temperature: options.temperature || 0.7,
110
- max_tokens: options.maxTokens || 2048,
111
- });
112
-
113
- return completion.choices[0].message.content || "No response content";
114
-
115
- } catch (error) {
116
- throw new Error(`API Error: ${error.message}`);
70
+ throw new Error(`Stream error: ${error.message}`);
117
71
  }
118
72
  }
119
73
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yamzzdev/aiyamz",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
4
4
  "description": "AI chat package by yamzzdev - powered by Groq (FREE)",
5
5
  "main": "lib/index.js",
6
6
  "bin": {