@o-lang/llm-groq 1.0.2 → 1.0.3

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.
Files changed (2) hide show
  1. package/index.js +30 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -40,12 +40,36 @@ async function summarize(prompt, context) {
40
40
  return output;
41
41
  }
42
42
 
43
+ // ✅ O-Lang Resolver Interface
43
44
  module.exports = async (action, context) => {
44
- if (action.startsWith('Ask ')) {
45
- // Flexible: take everything after "Ask ..." as prompt
46
- const prompt = action.replace(/^Ask\s+\S*\s*/i, '').trim();
47
- if (!prompt) return null;
48
- return await summarize(prompt, context);
45
+ // Only handle: "Ask llm-groq ..."
46
+ if (action.startsWith('Ask llm-groq ')) {
47
+ // Extract everything after "Ask llm-groq" (including quoted strings)
48
+ const prompt = action.replace(/^Ask\s+llm-groq\s+/i, '').trim();
49
+
50
+ // Remove surrounding quotes if present
51
+ const cleanPrompt = prompt.startsWith('"') && prompt.endsWith('"')
52
+ ? prompt.slice(1, -1)
53
+ : prompt;
54
+
55
+ if (!cleanPrompt) {
56
+ return undefined;
57
+ }
58
+
59
+ try {
60
+ return await summarize(cleanPrompt, context);
61
+ } catch (error) {
62
+ if (context?.__verbose) {
63
+ console.error('💥 [GroqLLM] Error:', error.message);
64
+ }
65
+ // Re-throw to let workflow handle failure
66
+ throw error;
67
+ }
49
68
  }
50
- return null;
69
+
70
+ // ✅ Critical: return undefined, not null
71
+ return undefined;
51
72
  };
73
+
74
+ // ✅ Required for O-Lang allowlist policy
75
+ module.exports.resolverName = 'llm-groq';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@o-lang/llm-groq",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "O-Lang resolver for Groq (Llama 3.1) LLM",
5
5
  "main": "index.js",
6
6
  "scripts": {},