agentic-kit 0.1.1 → 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/esm/index.js +18 -2
- package/index.d.ts +1 -0
- package/index.js +18 -2
- package/package.json +4 -4
package/esm/index.js
CHANGED
|
@@ -59,9 +59,25 @@ export class AgentKit {
|
|
|
59
59
|
throw new Error('No provider set');
|
|
60
60
|
}
|
|
61
61
|
if (input.stream && options?.onChunk) {
|
|
62
|
-
|
|
62
|
+
try {
|
|
63
|
+
const result = await this.currentProvider.generateStreaming(input, options.onChunk);
|
|
64
|
+
options?.onComplete?.();
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
options?.onError?.(error);
|
|
69
|
+
throw error;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const result = await this.currentProvider.generate(input);
|
|
74
|
+
options?.onComplete?.();
|
|
75
|
+
return result;
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
options?.onError?.(error);
|
|
79
|
+
throw error;
|
|
63
80
|
}
|
|
64
|
-
return this.currentProvider.generate(input);
|
|
65
81
|
}
|
|
66
82
|
listProviders() {
|
|
67
83
|
return Array.from(this.providers.keys());
|
package/index.d.ts
CHANGED
|
@@ -9,6 +9,7 @@ export interface StreamingOptions {
|
|
|
9
9
|
onChunk?: (chunk: string) => void;
|
|
10
10
|
onStateChange?: (state: string) => void;
|
|
11
11
|
onError?: (error: Error) => void;
|
|
12
|
+
onComplete?: () => void;
|
|
12
13
|
}
|
|
13
14
|
export declare class OllamaAdapter implements AgentProvider {
|
|
14
15
|
readonly name = "ollama";
|
package/index.js
CHANGED
|
@@ -70,9 +70,25 @@ class AgentKit {
|
|
|
70
70
|
throw new Error('No provider set');
|
|
71
71
|
}
|
|
72
72
|
if (input.stream && options?.onChunk) {
|
|
73
|
-
|
|
73
|
+
try {
|
|
74
|
+
const result = await this.currentProvider.generateStreaming(input, options.onChunk);
|
|
75
|
+
options?.onComplete?.();
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
options?.onError?.(error);
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const result = await this.currentProvider.generate(input);
|
|
85
|
+
options?.onComplete?.();
|
|
86
|
+
return result;
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
options?.onError?.(error);
|
|
90
|
+
throw error;
|
|
74
91
|
}
|
|
75
|
-
return this.currentProvider.generate(input);
|
|
76
92
|
}
|
|
77
93
|
listProviders() {
|
|
78
94
|
return Array.from(this.providers.keys());
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentic-kit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"author": "Dan Lynch <pyramation@gmail.com>",
|
|
5
5
|
"description": "Agentic Kit",
|
|
6
6
|
"main": "index.js",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"test:watch": "jest --watch"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@agentic-kit/bradie": "^0.1.
|
|
34
|
-
"@agentic-kit/ollama": "^0.1.
|
|
33
|
+
"@agentic-kit/bradie": "^0.1.2",
|
|
34
|
+
"@agentic-kit/ollama": "^0.1.2"
|
|
35
35
|
},
|
|
36
36
|
"keywords": [],
|
|
37
|
-
"gitHead": "
|
|
37
|
+
"gitHead": "957a378bb3b08f3be63cce7b72d741f1f044ae95"
|
|
38
38
|
}
|