@yesvara/svara 0.2.1 → 0.2.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.
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.mjs +1 -1
- package/dist/{new-ULRP6IUQ.mjs → new-CKIQEA2K.mjs} +3 -3
- package/my-agent/.env.example +4 -0
- package/my-agent/docs/README.md +3 -0
- package/my-agent/package.json +19 -0
- package/my-agent/src/index.ts +35 -0
- package/my-agent/tsconfig.json +19 -0
- package/package.json +1 -1
- package/src/cli/commands/new.ts +3 -3
package/dist/cli/index.js
CHANGED
|
@@ -140,7 +140,7 @@ function generateEnvExample(provider, channels) {
|
|
|
140
140
|
}
|
|
141
141
|
function generateIndexFile(name, provider, channels) {
|
|
142
142
|
const modelMap = {
|
|
143
|
-
openai: "gpt-4o",
|
|
143
|
+
openai: "gpt-4o-mini",
|
|
144
144
|
anthropic: "claude-opus-4-6",
|
|
145
145
|
ollama: "llama3"
|
|
146
146
|
};
|
|
@@ -181,10 +181,10 @@ const timeTool = createTool({
|
|
|
181
181
|
// Create agent
|
|
182
182
|
const agent = new SvaraAgent({
|
|
183
183
|
name: '${name}',
|
|
184
|
-
model: '${modelMap[provider] ?? "gpt-4o"}',
|
|
184
|
+
model: '${modelMap[provider] ?? "gpt-4o-mini"}',
|
|
185
185
|
systemPrompt: 'You are a helpful AI assistant. Be concise and friendly.',
|
|
186
186
|
tools: [timeTool],
|
|
187
|
-
knowledge: './docs', // Add your documents here for RAG
|
|
187
|
+
knowledge: './docs/**/*', // Add your documents here for RAG
|
|
188
188
|
});
|
|
189
189
|
|
|
190
190
|
// Setup channels
|
package/dist/cli/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ var pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
|
9
9
|
var program = new Command();
|
|
10
10
|
program.name("svara").description(pkg.description).version(pkg.version, "-v, --version");
|
|
11
11
|
program.command("new <name>").description("Create a new SvaraJS project").option("--provider <provider>", "LLM provider (openai|anthropic|ollama)", "openai").option("--channel <channels...>", "Channels to include", ["web"]).option("--no-install", "Skip npm install").action(async (name, opts) => {
|
|
12
|
-
const { newProject } = await import("../new-
|
|
12
|
+
const { newProject } = await import("../new-CKIQEA2K.mjs");
|
|
13
13
|
await newProject({
|
|
14
14
|
name,
|
|
15
15
|
provider: opts.provider,
|
|
@@ -109,7 +109,7 @@ function generateEnvExample(provider, channels) {
|
|
|
109
109
|
}
|
|
110
110
|
function generateIndexFile(name, provider, channels) {
|
|
111
111
|
const modelMap = {
|
|
112
|
-
openai: "gpt-4o",
|
|
112
|
+
openai: "gpt-4o-mini",
|
|
113
113
|
anthropic: "claude-opus-4-6",
|
|
114
114
|
ollama: "llama3"
|
|
115
115
|
};
|
|
@@ -150,10 +150,10 @@ const timeTool = createTool({
|
|
|
150
150
|
// Create agent
|
|
151
151
|
const agent = new SvaraAgent({
|
|
152
152
|
name: '${name}',
|
|
153
|
-
model: '${modelMap[provider] ?? "gpt-4o"}',
|
|
153
|
+
model: '${modelMap[provider] ?? "gpt-4o-mini"}',
|
|
154
154
|
systemPrompt: 'You are a helpful AI assistant. Be concise and friendly.',
|
|
155
155
|
tools: [timeTool],
|
|
156
|
-
knowledge: './docs', // Add your documents here for RAG
|
|
156
|
+
knowledge: './docs/**/*', // Add your documents here for RAG
|
|
157
157
|
});
|
|
158
158
|
|
|
159
159
|
// Setup channels
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-agent",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "tsx watch src/index.ts",
|
|
7
|
+
"build": "tsc",
|
|
8
|
+
"start": "node dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"@yesvara/svara": "^0.1.3",
|
|
12
|
+
"dotenv": "^16.4.5"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"@types/node": "^20.14.2",
|
|
16
|
+
"tsx": "^4.15.7",
|
|
17
|
+
"typescript": "^5.4.5"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import 'dotenv/config';
|
|
2
|
+
import { SvaraApp, SvaraAgent, createTool } from '@yesvara/svara';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* my-agent — powered by SvaraJS
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// Define tools
|
|
9
|
+
const timeTool = createTool({
|
|
10
|
+
name: 'get_time',
|
|
11
|
+
description: 'Get the current date and time',
|
|
12
|
+
parameters: {},
|
|
13
|
+
async run() {
|
|
14
|
+
return {
|
|
15
|
+
datetime: new Date().toISOString(),
|
|
16
|
+
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Create agent
|
|
22
|
+
const agent = new SvaraAgent({
|
|
23
|
+
name: 'my-agent',
|
|
24
|
+
model: 'gpt-4o',
|
|
25
|
+
systemPrompt: 'You are a helpful AI assistant. Be concise and friendly.',
|
|
26
|
+
tools: [timeTool],
|
|
27
|
+
knowledge: './docs', // Add your documents here for RAG
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Setup channels
|
|
31
|
+
const app = new SvaraApp({ cors: true });
|
|
32
|
+
app.route('/chat', agent.handler());
|
|
33
|
+
app.listen(3000);
|
|
34
|
+
|
|
35
|
+
console.log('✨ my-agent is running!');
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "CommonJS",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"outDir": "dist",
|
|
7
|
+
"rootDir": "src",
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"src/**/*"
|
|
14
|
+
],
|
|
15
|
+
"exclude": [
|
|
16
|
+
"node_modules",
|
|
17
|
+
"dist"
|
|
18
|
+
]
|
|
19
|
+
}
|
package/package.json
CHANGED
package/src/cli/commands/new.ts
CHANGED
|
@@ -142,7 +142,7 @@ function generateIndexFile(
|
|
|
142
142
|
channels: string[]
|
|
143
143
|
): string {
|
|
144
144
|
const modelMap: Record<string, string> = {
|
|
145
|
-
openai: 'gpt-4o',
|
|
145
|
+
openai: 'gpt-4o-mini',
|
|
146
146
|
anthropic: 'claude-opus-4-6',
|
|
147
147
|
ollama: 'llama3',
|
|
148
148
|
};
|
|
@@ -184,10 +184,10 @@ const timeTool = createTool({
|
|
|
184
184
|
// Create agent
|
|
185
185
|
const agent = new SvaraAgent({
|
|
186
186
|
name: '${name}',
|
|
187
|
-
model: '${modelMap[provider] ?? 'gpt-4o'}',
|
|
187
|
+
model: '${modelMap[provider] ?? 'gpt-4o-mini'}',
|
|
188
188
|
systemPrompt: 'You are a helpful AI assistant. Be concise and friendly.',
|
|
189
189
|
tools: [timeTool],
|
|
190
|
-
knowledge: './docs', // Add your documents here for RAG
|
|
190
|
+
knowledge: './docs/**/*', // Add your documents here for RAG
|
|
191
191
|
});
|
|
192
192
|
|
|
193
193
|
// Setup channels
|