@codeworksh/aikit 0.4.1-dev.20260530133433 → 0.4.1-dev.20260530172609

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/README.md +34 -34
  2. package/package.json +1 -4
package/README.md CHANGED
@@ -12,8 +12,8 @@ It gives you the basic primitives for streaming LLM responses without the extra
12
12
  - [Tools](#tools)
13
13
  - [Providers and Models](#providers-and-models)
14
14
  - [CLI Tools](#cli-tools)
15
- - [Model Generation](#model-generation)
16
- - [OAuth Providers](#oauth-providers)
15
+ - [Model Generation](#model-generation)
16
+ - [OAuth Providers](#oauth-providers)
17
17
  - [Contribute](#contribute)
18
18
 
19
19
  ## Installation
@@ -47,23 +47,23 @@ if (!model) throw new Error("Model not found");
47
47
 
48
48
  // Setup conversation context
49
49
  const context: Message.Context = {
50
- systemPrompt: "You are a helpful coding assistant.",
51
- messages: [
52
- Message.createUserMessage({
53
- role: "user",
54
- time: { created: Date.now() },
55
- parts: [{ type: "text", text: "Write a simple loop in TypeScript." }],
56
- }),
57
- ],
50
+ systemPrompt: "You are a helpful coding assistant.",
51
+ messages: [
52
+ Message.createUserMessage({
53
+ role: "user",
54
+ time: { created: Date.now() },
55
+ parts: [{ type: "text", text: "Write a simple loop in TypeScript." }],
56
+ }),
57
+ ],
58
58
  };
59
59
 
60
60
  // Option 1: Stream events
61
61
  const s = stream(model, context, { apiKey: process.env.ANTHROPIC_API_KEY });
62
62
 
63
63
  for await (const event of s) {
64
- if (event.type === "text.delta") {
65
- process.stdout.write(event.delta);
66
- }
64
+ if (event.type === "text.delta") {
65
+ process.stdout.write(event.delta);
66
+ }
67
67
  }
68
68
 
69
69
  const finalMessage = await s.result();
@@ -82,41 +82,41 @@ Tools enable LLMs to interact with external systems. `@codeworksh/aikit` provide
82
82
  import { Type, llm, stream, Message, validateToolArguments } from "@codeworksh/aikit";
83
83
 
84
84
  const calculatorTool = {
85
- name: "calculator",
86
- description: "Evaluate arithmetic expressions",
87
- parameters: Type.Object({
88
- expression: Type.String(),
89
- }),
85
+ name: "calculator",
86
+ description: "Evaluate arithmetic expressions",
87
+ parameters: Type.Object({
88
+ expression: Type.String(),
89
+ }),
90
90
  };
91
91
 
92
92
  const context: Message.Context = {
93
- messages: [
94
- Message.createUserMessage({
95
- role: "user",
96
- time: { created: Date.now() },
97
- parts: [{ type: "text", text: "What is 25 * 18?" }],
98
- }),
99
- ],
100
- tools: [calculatorTool],
93
+ messages: [
94
+ Message.createUserMessage({
95
+ role: "user",
96
+ time: { created: Date.now() },
97
+ parts: [{ type: "text", text: "What is 25 * 18?" }],
98
+ }),
99
+ ],
100
+ tools: [calculatorTool],
101
101
  };
102
102
 
103
103
  const response = await stream.complete(model, context, { apiKey: process.env.ANTHROPIC_API_KEY });
104
104
 
105
105
  // Check for tool calls in the response
106
106
  for (const part of response.parts) {
107
- if (part.type === "toolCall") {
108
- console.log(`Executing tool: ${part.name}`);
109
-
110
- // Validates arguments against TypeBox schema automatically
111
- const args = validateToolArguments(calculatorTool.parameters, part.arguments);
112
- // Execute your tool logic here...
113
- }
107
+ if (part.type === "toolCall") {
108
+ console.log(`Executing tool: ${part.name}`);
109
+
110
+ // Validates arguments against TypeBox schema automatically
111
+ const args = validateToolArguments(calculatorTool.parameters, part.arguments);
112
+ // Execute your tool logic here...
113
+ }
114
114
  }
115
115
  ```
116
116
 
117
117
  ## Providers and Models
118
118
 
119
- `@codeworksh/aikit` uses a registry to fetch model specifications and metadata.
119
+ `@codeworksh/aikit` uses a registry to fetch model specifications and metadata.
120
120
 
121
121
  ```ts
122
122
  import { llm } from "@codeworksh/aikit";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeworksh/aikit",
3
- "version": "0.4.1-dev.20260530133433",
3
+ "version": "0.4.1-dev.20260530172609",
4
4
  "description": "Toolkit for building AI agents and agent harness.",
5
5
  "keywords": [
6
6
  "agent",
@@ -55,14 +55,11 @@
55
55
  "@ai-sdk/google-vertex": "^4.0.137",
56
56
  "@ai-sdk/openai": "^3.0.65",
57
57
  "@ai-sdk/openai-compatible": "^2.0.48",
58
- "@ai-sdk/provider": "^3.0.10",
59
58
  "@ai-sdk/xai": "^3.0.92",
60
59
  "@openrouter/ai-sdk-provider": "^2.9.0",
61
60
  "ai": "^6.0.191",
62
61
  "dedent": "^1.7.2",
63
- "esbuild": "^0.27.3",
64
62
  "partial-json": "^0.1.7",
65
- "quickjs-wasi": "^2.2.0",
66
63
  "remeda": "^2.33.6",
67
64
  "typebox": "^1.1.37",
68
65
  "uuidv7": "^1.2.1",