@nestbox-ai/cli 1.0.49 → 1.0.51
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 +532 -19
- package/package.json +3 -3
- package/templates/base-js/index.js.hbs +30 -0
- package/templates/base-js/nestbox-agents.yaml.hbs +12 -0
- package/templates/base-js/package.json +15 -0
- package/templates/base-py/main.py.hbs +42 -0
- package/templates/base-py/nestbox-agents.yaml.hbs +12 -0
- package/templates/base-py/pyproject.toml +19 -0
- package/templates/base-ts/eslint.config.mjs +27 -0
- package/templates/base-ts/nestbox-agents.yaml.hbs +12 -0
- package/templates/base-ts/nestbox.config.json +9 -0
- package/templates/base-ts/package.json +24 -0
- package/templates/base-ts/src/index.ts.hbs +29 -0
- package/templates/base-ts/tsconfig.json +14 -0
- package/templates/chatbot-js/index.js.hbs +18 -0
- package/templates/chatbot-js/package-lock.json +1571 -0
- package/templates/chatbot-js/package.json +15 -0
- package/templates/chatbot-py/main.py.hbs +42 -0
- package/templates/chatbot-py/nestbox-agents.yaml.hbs +12 -0
- package/templates/chatbot-py/pyproject.toml +19 -0
- package/templates/chatbot-ts/eslint.config.mjs +27 -0
- package/templates/chatbot-ts/package.json +24 -0
- package/templates/chatbot-ts/src/index.ts.hbs +18 -0
- package/templates/chatbot-ts/tsconfig.json +14 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "app"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Nestbox AI Python Agent"
|
|
9
|
+
requires-python = ">=3.9"
|
|
10
|
+
|
|
11
|
+
dependencies = [
|
|
12
|
+
"nestbox-ai-functions>=2.0.3",
|
|
13
|
+
"openai>=1.40.0",
|
|
14
|
+
"httpx>=0.27.0",
|
|
15
|
+
"anyio>=4.0.0"
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[tool.setuptools]
|
|
19
|
+
packages = ["."]
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import tsParser from "@typescript-eslint/parser";
|
|
2
|
+
import eslintPluginTs from "@typescript-eslint/eslint-plugin";
|
|
3
|
+
|
|
4
|
+
export default [
|
|
5
|
+
{
|
|
6
|
+
files: ["**/*.ts"],
|
|
7
|
+
languageOptions: {
|
|
8
|
+
parser: tsParser,
|
|
9
|
+
parserOptions: {
|
|
10
|
+
ecmaVersion: "latest",
|
|
11
|
+
sourceType: "module",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
plugins: {
|
|
15
|
+
"@typescript-eslint": eslintPluginTs,
|
|
16
|
+
},
|
|
17
|
+
rules: {
|
|
18
|
+
...eslintPluginTs.configs.recommended.rules,
|
|
19
|
+
// Optional custom rules:
|
|
20
|
+
// '@typescript-eslint/no-explicit-any': 'warn',
|
|
21
|
+
// '@typescript-eslint/explicit-function-return-type': 'off',
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
ignores: ["dist/", "node_modules/"],
|
|
26
|
+
},
|
|
27
|
+
];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
agents:
|
|
2
|
+
- name: {{ agentNameInYaml }}
|
|
3
|
+
description: Our new agent {{ agentNameInYaml }} that uses the nestbox API
|
|
4
|
+
entry: {{agentName}}
|
|
5
|
+
inputSchema:
|
|
6
|
+
type: object
|
|
7
|
+
properties:
|
|
8
|
+
content:
|
|
9
|
+
type: string
|
|
10
|
+
description: The content of the input as string
|
|
11
|
+
minLength: 10
|
|
12
|
+
maxLength: 5000
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "app-ts",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"main": "dist/index.js",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"build": "tsc",
|
|
7
|
+
"start": "node dist/index.js",
|
|
8
|
+
"dev": "ts-node src/index.ts",
|
|
9
|
+
"lint": "eslint ."
|
|
10
|
+
},
|
|
11
|
+
"author": "",
|
|
12
|
+
"license": "ISC",
|
|
13
|
+
"description": "",
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@nestbox-ai/functions": "^2.0.0",
|
|
16
|
+
"openai": "^6.5.0"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@typescript-eslint/eslint-plugin": "^8.31.0",
|
|
20
|
+
"@typescript-eslint/parser": "^8.31.0",
|
|
21
|
+
"eslint": "^9.25.1",
|
|
22
|
+
"typescript": "^5.8.3"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AgentContext, AgentEvents, useAgent } from "@nestbox-ai/functions";
|
|
2
|
+
import OpenAI from 'openai';
|
|
3
|
+
|
|
4
|
+
const MODEL_NAME = 'openai/gpt-oss-20b';
|
|
5
|
+
|
|
6
|
+
const client = new OpenAI({
|
|
7
|
+
baseURL: 'http://localhost:8000/v1',
|
|
8
|
+
apiKey: 'sk-xxxxxx'
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
export const {{agentName}} = useAgent(
|
|
12
|
+
async (context: AgentContext, events: AgentEvents) => {
|
|
13
|
+
const response = await client.chat.completions.create({
|
|
14
|
+
model: MODEL_NAME,
|
|
15
|
+
messages: [
|
|
16
|
+
{
|
|
17
|
+
role: "user",
|
|
18
|
+
content: "Why is the sky blue?"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
});
|
|
22
|
+
const result = response.choices[0].message.content;
|
|
23
|
+
if (!result) {
|
|
24
|
+
events.emitQueryFailed({ data: { error: 'No response from model' } });
|
|
25
|
+
} else {
|
|
26
|
+
events.emitQueryCompleted({ data: result });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
4
|
+
"module": "commonjs", /* Specify what module code is generated. */
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./dist",
|
|
7
|
+
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
8
|
+
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
9
|
+
"strict": true, /* Enable all strict type-checking options. */
|
|
10
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"],
|
|
13
|
+
"exclude": ["node_modules", "**/*.spec.ts", "**/*.test.ts"],
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var { useChatbot } = require('@nestbox-ai/functions');
|
|
2
|
+
var { Ollama } = require('ollama');
|
|
3
|
+
|
|
4
|
+
const ollama = new Ollama()
|
|
5
|
+
|
|
6
|
+
var {{agentName}} = useChatbot(async (context, events) => {
|
|
7
|
+
|
|
8
|
+
const response = await ollama.chat({
|
|
9
|
+
messages: context.messages,
|
|
10
|
+
model: 'gemma3:27b',
|
|
11
|
+
stream: false,
|
|
12
|
+
});
|
|
13
|
+
const result = response.message.content;
|
|
14
|
+
|
|
15
|
+
events.emitQueryCompleted({ data: result });
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
module.exports = { {{agentName}} };
|