groq-rag 0.1.0 → 0.1.2

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/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # groq-rag
2
2
 
3
- [![CI](https://github.com/mithun50/groq-rag/actions/workflows/ci.yml/badge.svg)](https://github.com/mithun50/groq-rag/actions/workflows/ci.yml)
4
3
  [![npm version](https://badge.fury.io/js/groq-rag.svg)](https://www.npmjs.com/package/groq-rag)
5
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0-blue.svg)](https://www.typescriptlang.org/)
6
6
 
7
- Extended Groq SDK with RAG (Retrieval-Augmented Generation), web browsing, and agent capabilities.
7
+ Extended Groq SDK with RAG (Retrieval-Augmented Generation), web browsing, and agent capabilities. Build AI agents that can search the web, fetch URLs, query knowledge bases, and more.
8
8
 
9
9
  ## Features
10
10
 
@@ -16,6 +16,19 @@ Extended Groq SDK with RAG (Retrieval-Augmented Generation), web browsing, and a
16
16
  - **TypeScript**: Full type safety and IntelliSense support
17
17
  - **Zero Config**: Works out of the box with sensible defaults
18
18
 
19
+ ## Supported Models
20
+
21
+ This package works with all Groq-supported models. Recommended models:
22
+
23
+ | Model | Description | Best For |
24
+ |-------|-------------|----------|
25
+ | `llama-3.3-70b-versatile` | Latest Llama 3.3 70B | General purpose, best quality |
26
+ | `llama-3.1-8b-instant` | Fast Llama 3.1 8B | Quick responses, lower cost |
27
+ | `qwen/qwen3-32b` | Qwen 3 32B | Alternative, good reasoning |
28
+ | `meta-llama/llama-4-scout-17b-16e-instruct` | Llama 4 Scout | Vision tasks, newest |
29
+
30
+ See [Groq Models](https://console.groq.com/docs/models) for the full list.
31
+
19
32
  ## Installation
20
33
 
21
34
  ```bash
package/dist/index.cjs CHANGED
@@ -1175,7 +1175,16 @@ function createToolExecutor(tools) {
1175
1175
 
1176
1176
  // src/agents/agent.ts
1177
1177
  function parseTextFunctionCall(text) {
1178
- const match = text.match(/<function=(\w+)(\{[\s\S]*?\})<\/function>/);
1178
+ let match = text.match(/<function=(\w+)\s*\(\s*(\{[\s\S]*?\})\s*\)/);
1179
+ if (!match) {
1180
+ match = text.match(/<function=(\w+)(?:\[\])?[=\s]*(\{[\s\S]*?\})[^<]*<\/function>/);
1181
+ }
1182
+ if (!match) {
1183
+ match = text.match(/<function=(\w+)[=\s]*\[\s*(\{[\s\S]*?\})\s*\]/);
1184
+ }
1185
+ if (!match) {
1186
+ match = text.match(/<function=(\w+)[\s=\[\]\(]*(\{[\s\S]*\})/);
1187
+ }
1179
1188
  if (match) {
1180
1189
  try {
1181
1190
  const name = match[1];
@@ -1281,13 +1290,18 @@ When you don't know something or need current information, use the appropriate t
1281
1290
  actionInput: textFunctionCall.args,
1282
1291
  observation: result.error || JSON.stringify(result.result)
1283
1292
  });
1293
+ const toolResultStr = result.error ? `Error: ${result.error}` : JSON.stringify(result.result, null, 2);
1284
1294
  this.messages.push({
1285
1295
  role: "assistant",
1286
- content: `I'll use the ${textFunctionCall.name} tool to help with this.`
1296
+ content: `I'll use the ${textFunctionCall.name} tool to help answer this.`
1287
1297
  });
1288
1298
  this.messages.push({
1289
1299
  role: "user",
1290
- content: `Tool result: ${result.error || JSON.stringify(result.result)}`
1300
+ content: `Here is the result from ${textFunctionCall.name}:
1301
+
1302
+ ${toolResultStr}
1303
+
1304
+ Please provide a helpful response based on this information.`
1291
1305
  });
1292
1306
  continue;
1293
1307
  }
package/dist/index.js CHANGED
@@ -1101,7 +1101,16 @@ function createToolExecutor(tools) {
1101
1101
 
1102
1102
  // src/agents/agent.ts
1103
1103
  function parseTextFunctionCall(text) {
1104
- const match = text.match(/<function=(\w+)(\{[\s\S]*?\})<\/function>/);
1104
+ let match = text.match(/<function=(\w+)\s*\(\s*(\{[\s\S]*?\})\s*\)/);
1105
+ if (!match) {
1106
+ match = text.match(/<function=(\w+)(?:\[\])?[=\s]*(\{[\s\S]*?\})[^<]*<\/function>/);
1107
+ }
1108
+ if (!match) {
1109
+ match = text.match(/<function=(\w+)[=\s]*\[\s*(\{[\s\S]*?\})\s*\]/);
1110
+ }
1111
+ if (!match) {
1112
+ match = text.match(/<function=(\w+)[\s=\[\]\(]*(\{[\s\S]*\})/);
1113
+ }
1105
1114
  if (match) {
1106
1115
  try {
1107
1116
  const name = match[1];
@@ -1207,13 +1216,18 @@ When you don't know something or need current information, use the appropriate t
1207
1216
  actionInput: textFunctionCall.args,
1208
1217
  observation: result.error || JSON.stringify(result.result)
1209
1218
  });
1219
+ const toolResultStr = result.error ? `Error: ${result.error}` : JSON.stringify(result.result, null, 2);
1210
1220
  this.messages.push({
1211
1221
  role: "assistant",
1212
- content: `I'll use the ${textFunctionCall.name} tool to help with this.`
1222
+ content: `I'll use the ${textFunctionCall.name} tool to help answer this.`
1213
1223
  });
1214
1224
  this.messages.push({
1215
1225
  role: "user",
1216
- content: `Tool result: ${result.error || JSON.stringify(result.result)}`
1226
+ content: `Here is the result from ${textFunctionCall.name}:
1227
+
1228
+ ${toolResultStr}
1229
+
1230
+ Please provide a helpful response based on this information.`
1217
1231
  });
1218
1232
  continue;
1219
1233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "groq-rag",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Extended Groq SDK with RAG, web browsing, and agent capabilities",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs",