@aigne/example-chat-bot 1.11.0 → 1.12.1-0

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.
@@ -1,3 +1,18 @@
1
1
  # Change the name of this file to .env.local and fill in the following values
2
2
 
3
+ # Use this for OpenAI models
4
+ # MODEL="openai:gpt-4.1"
3
5
  OPENAI_API_KEY="" # Your OpenAI API key
6
+
7
+ # Use this for Anthropic models
8
+ # MODEL="anthropic:claude-3-7-sonnet-latest"
9
+ # ANTHROPIC_API_KEY="" # Your Anthropic API key
10
+
11
+ # Use this for AWS Bedrock models
12
+ # AWS_ACCESS_KEY_ID=""
13
+ # AWS_SECRET_ACCESS_KEY=""
14
+ # AWS_REGION=us-west-2
15
+ # MODEL=Bedrock:us.amazon.nova-premier-v1:0
16
+
17
+ # Setup proxy if needed
18
+ # HTTPS_PROXY=http://localhost:7890
package/index.js ADDED
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawnSync } = require("node:child_process");
4
+ const { argv } = require("node:process");
5
+
6
+ spawnSync("aigne", ["run", __dirname, ...argv.slice(2)], { stdio: "inherit" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/example-chat-bot",
3
- "version": "1.11.0",
3
+ "version": "1.12.1-0",
4
4
  "description": "A demonstration of using AIGNE Framework to build a chat bot",
5
5
  "author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
6
6
  "homepage": "https://github.com/AIGNE-io/aigne-framework/tree/main/examples/chat-bot",
@@ -10,7 +10,7 @@
10
10
  "url": "git+https://github.com/AIGNE-io/aigne-framework"
11
11
  },
12
12
  "type": "module",
13
- "bin": "index.ts",
13
+ "bin": "index.js",
14
14
  "files": [
15
15
  "agents",
16
16
  ".env.local.example",
@@ -18,15 +18,9 @@
18
18
  "README.md"
19
19
  ],
20
20
  "dependencies": {
21
- "@aigne/cli": "^1.16.0"
22
- },
23
- "devDependencies": {
24
- "@types/bun": "^1.2.9",
25
- "@aigne/test-utils": "^0.4.10"
21
+ "@aigne/cli": "^1.17.0"
26
22
  },
27
23
  "scripts": {
28
- "start": "bun run index.ts",
29
- "lint": "tsc --noEmit",
30
- "test:llm": "bun test index.test.ts"
24
+ "test": "aigne test"
31
25
  }
32
26
  }
package/agents/README.md DELETED
@@ -1,32 +0,0 @@
1
- # AIGNE Default Template
2
-
3
- This is the default project template for the AIGNE framework, providing a basic chat agent and JavaScript code execution functionality.
4
-
5
- ## Template Structure
6
-
7
- - `aigne.yaml` - Project configuration file that defines the chat model used and references to agents
8
- - `chat.yaml` - Chat agent configuration, including agent instructions and skills used
9
- - `sandbox.js` - JavaScript code execution tool for running JavaScript code within conversations
10
- - `sandbox.test.js` - Test file to verify the functionality of the code execution tool
11
-
12
- ## Quick Start
13
-
14
- ### Install AIGNE CLI
15
-
16
- ```bash
17
- npm install -g aigne
18
- ```
19
-
20
- ### Start the Project
21
-
22
- ```bash
23
- aigne run
24
- ```
25
-
26
- ## Testing
27
-
28
- Run the following command to execute test cases:
29
-
30
- ```bash
31
- aigne test
32
- ```
package/agents/aigne.yaml DELETED
@@ -1,7 +0,0 @@
1
- chat_model:
2
- name: gpt-4o-mini
3
- temperature: 0.8
4
- agents:
5
- - chat.yaml
6
- tools:
7
- - sandbox.js
package/agents/chat.yaml DELETED
@@ -1,8 +0,0 @@
1
- name: chat
2
- description: Chat agent
3
- instructions: |
4
- You are a helpful assistant that can answer questions and provide information on a wide range of topics.
5
- input_key: message
6
- memory: true
7
- tools:
8
- - sandbox.js
package/agents/sandbox.js DELETED
@@ -1,35 +0,0 @@
1
- import vm from "node:vm";
2
-
3
- export default async function evaluateJs({ jsCode }) {
4
- const sandbox = {};
5
- const context = vm.createContext(sandbox);
6
- const result = vm.runInContext(jsCode, context, { displayErrors: true });
7
- return { result };
8
- }
9
-
10
- evaluateJs.description = `
11
- This agent generates a JavaScript code snippet that is suitable to be passed directly into Node.js's 'vm.runInContext(code, context)' function. Follow these constraints:
12
- - Do NOT use any top-level 'return' statements, as the code is not inside a function.
13
- - The code can define variables or perform calculations.
14
- - To return a value from the code, make sure the final line is an expression (not a statement) whose value will be the result.
15
- - Do NOT wrap the code in a function or IIFE unless explicitly instructed.
16
- - The code should be self-contained and valid JavaScript.`;
17
-
18
- evaluateJs.input_schema = {
19
- type: "object",
20
- properties: {
21
- jsCode: {
22
- type: "string",
23
- description: "JavaScript code snippet to evaluate",
24
- },
25
- },
26
- required: ["jsCode"],
27
- };
28
-
29
- evaluateJs.output_schema = {
30
- type: "object",
31
- properties: {
32
- result: { type: "any", description: "Result of the evaluated code" },
33
- },
34
- required: ["result"],
35
- };
@@ -1,7 +0,0 @@
1
- import assert from "node:assert";
2
- import test from "node:test";
3
- import evaluateJs from "./sandbox.js";
4
-
5
- test("evaluateJs should execute script correctly", async () => {
6
- assert.deepEqual(await evaluateJs({ jsCode: "1 + 2" }), { result: 3 });
7
- });
package/index.test.ts DELETED
@@ -1,12 +0,0 @@
1
- import { expect, test } from "bun:test";
2
- import { runExampleTest } from "@aigne/test-utils/run-example-test.js";
3
-
4
- test(
5
- "should successfully run the chatbot",
6
- async () => {
7
- const { code, stderr } = await runExampleTest();
8
- expect(code).toBe(0);
9
- expect(stderr).not.toContain("FAILED");
10
- },
11
- { timeout: 600000 },
12
- );
package/index.ts DELETED
@@ -1,9 +0,0 @@
1
- #!/usr/bin/env bunwrapper
2
-
3
- import { spawnSync } from "node:child_process";
4
- import { join } from "node:path";
5
- import { argv } from "node:process";
6
-
7
- const path = join(import.meta.dirname, "agents");
8
-
9
- spawnSync("aigne", ["run", path, ...argv.slice(2)], { stdio: "inherit" });