convo-lang 0.7.26

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 ADDED
@@ -0,0 +1,437 @@
1
+ # Convo-Lang
2
+ A Conversational Language
3
+
4
+ ---
5
+ > ⚠️⚠️⚠️ This package is an alias of @convo-lang/convo-lang ⚠️⚠️⚠️
6
+ >
7
+ > ⚠️⚠️⚠️ Use [@convo-lang/convo-lang](https://www.npmjs.com/package/@convo-lang/convo-lang) instead - https://www.npmjs.com/package/@convo-lang/convo-lang ⚠️⚠️⚠️
8
+ ---
9
+
10
+ ![convo](https://raw.githubusercontent.com/convo-lang/convo-lang/refs/heads/main/assets/learn-convo-demo.webp)
11
+
12
+ **Interactive Demo** - [https://learn.convo-lang.ai/playground](https://learn.convo-lang.ai/playground)
13
+
14
+ **Convo-Lang Tutorial** - [https://learn.convo-lang.ai/learn](https://learn.convo-lang.ai/learn)
15
+
16
+ **GitHub** - [ https://github.com/convo-lang/convo-lang](https://github.com/convo-lang/convo-lang)
17
+
18
+ **NPM** - [https://www.npmjs.com/package/@convo-lang/convo-lang](https://www.npmjs.com/package/@convo-lang/convo-lang)
19
+
20
+ **VSCode Extension** - [https://marketplace.visualstudio.com/items?itemName=iyio.convo-lang-tools](https://marketplace.visualstudio.com/items?itemName=iyio.convo-lang-tools)
21
+
22
+
23
+ ## What is Convo-Lang?
24
+ Convo-Lang is a programming language built from the ground up for prompt engineers and AI application
25
+ developers. The goal of Convo-Lang is to simplify to development of LLM based applications and
26
+ provided a uniform syntax for working with all LLMs.
27
+
28
+ Convo-Lang is a mixture between a procedural programming language, prompting template system and
29
+ conversation state management system. You can execute convo-lang in Javascript, Python,
30
+ from the command line or directly in VSCode.
31
+
32
+ Convo-Lang aims to provided a uniform prompting syntax that is LLM agnostic and allows you to
33
+ store both prompts, metadata and tradition programming logic in a single file or template string.
34
+
35
+ The convo-lang syntax supports advanced features such as function calling, tool usage and vision.
36
+ The Convo-Lang ecosystem consists of a parser, interpreter, Typescript/Javascript/Python libraries,
37
+ a CLI, and a vscode extension for syntax highlighting and in-editor script execution.
38
+
39
+
40
+ ## Packages
41
+ - @convo-lang/convo-lang - Contains the Convo-Lang Conversation Engine, and a Typescript/Javascript library to use Convo-Lang in your application.
42
+ - @convo-lang/convo-lang-react - Contains UI pre-built UI components including a fully functional chat component.
43
+ - @convo-lang/convo-lang-openai - Conversation adapter for OpenAI.
44
+ - @convo-lang/convo-lang-bedrock - Conversation adapter for AWS Bedrock.
45
+ - @convo-lang/convo-lang-api-routes - A backend for relaying messages between the browser and LLM backends such as OpenAI.
46
+ - @convo-lang/convo-vfs - Used to integrate Convo-Lang into virtual file systems.
47
+ - @convo-lang/convo-lang-cli - A CLI interface that allows you to execute and parse convo-lang files.
48
+ - @convo-lang/convo-lang-tools - Contains the convo-lang vscode extension, which includes syntax highlighting,
49
+ in-editor script execution, script parsing, and other helpful tools for working with convo-lang.
50
+ In most cases, you will not install this package but instead install the vscode convo-lang extension.
51
+
52
+
53
+ ## Quick Start with NextJS
54
+ You can use the `npx convo --create-next-app` command to quickly get started building AI Agents powered
55
+ by Convo-Lang in a NextJS project
56
+
57
+ **Step 1:** Create project using convo CLI
58
+ ``` sh
59
+ npx convo --create-next-app
60
+ ```
61
+
62
+ **Step 1:** Open newly created project in VSCode or your favorite editor
63
+ ``` sh
64
+ # Open project directory
65
+ cd {NEWLY_CREATED_PROJECT_NAME}
66
+
67
+ # Open Code Editor
68
+ code .
69
+ # -or-
70
+ vim .
71
+ # -or-
72
+ # Use GUI
73
+ ```
74
+
75
+ **Step 3:** Copy example env file to `.env.development`
76
+ ``` sh
77
+ cp example.env.development .env.development
78
+ ```
79
+
80
+ **Step 4:** Add your OpenAI API key to `.env.development`
81
+ ``` conf
82
+ OPENAI_API_KEY={YOUR_OPEN_AI_API_KEY}
83
+ ```
84
+
85
+ **Step 5:** Start the NextJS server
86
+ ``` sh
87
+ npm run dev
88
+ ```
89
+
90
+ **Step 6:** Start modifying example agent prompts in any of the example pages
91
+ - pages/index.tsx: Routing agent that opens requested agent
92
+ - pages/agent/todo-list.tsx: Todo list agent that can manage a todo list
93
+ - pages/agent/video-dude.tsx: A video player agent that plays the best YouTube videos
94
+ - pages/agent/weather.tsx: A weather man agent that can tell you the weather anywhere in the world
95
+
96
+
97
+ ## Model Provider Support
98
+
99
+ - OpenAI - https://platform.openai.com/docs/models
100
+ - chatgpt-4o-latest
101
+ - gpt-3.5-turbo
102
+ - gpt-3.5-turbo-0125
103
+ - gpt-3.5-turbo-1106
104
+ - gpt-3.5-turbo-16k
105
+ - gpt-4
106
+ - gpt-4-0125-preview
107
+ - gpt-4-0613
108
+ - gpt-4-1106-preview
109
+ - gpt-4-turbo
110
+ - gpt-4-turbo-2024-04-09
111
+ - gpt-4-turbo-preview
112
+ - gpt-4o
113
+ - gpt-4o-2024-05-13
114
+ - gpt-4o-2024-08-06
115
+ - gpt-4o-mini
116
+ - gpt-4o-mini-2024-07-18
117
+ - o1-mini
118
+ - o1-mini-2024-09-12
119
+ - o1-preview
120
+ - o1-preview-2024-09-12
121
+
122
+ - OpenAI Chat Completions Compatible APIs
123
+ - LM Studio - https://lmstudio.ai/docs/app/api/endpoints/openai
124
+ - Ollama - https://ollama.com/blog/openai-compatibility
125
+ - Llama.cpp - https://github.com/ggml-org/llama.cpp/tree/master/tools/server
126
+
127
+ - AWS Bedrock - https://aws.amazon.com/bedrock/
128
+ - us.amazon.nova-lite-v1:0
129
+ - us.amazon.nova-micro-v1:0
130
+ - us.amazon.nova-pro-v1:0
131
+ - us.anthropic.claude-3-5-haiku-20241022-v1:0
132
+ - us.anthropic.claude-3-5-sonnet-20240620-v1:0
133
+ - us.anthropic.claude-3-5-sonnet-20241022-v2:0
134
+ - us.anthropic.claude-3-7-sonnet-20250219-v1:0
135
+ - us.anthropic.claude-3-haiku-20240307-v1:0
136
+ - us.anthropic.claude-opus-4-20250514-v1:0
137
+ - us.anthropic.claude-sonnet-4-20250514-v1:0
138
+ - us.deepseek.r1-v1:0
139
+ - us.meta.llama3-1-70b-instruct-v1:0
140
+ - us.meta.llama3-1-8b-instruct-v1:0
141
+ - us.meta.llama3-2-11b-instruct-v1:0
142
+ - us.meta.llama3-2-1b-instruct-v1:0
143
+ - us.meta.llama3-2-3b-instruct-v1:0
144
+ - us.meta.llama3-2-90b-instruct-v1:0
145
+ - us.meta.llama3-3-70b-instruct-v1:0
146
+ - us.meta.llama4-maverick-17b-instruct-v1:0
147
+ - us.meta.llama4-scout-17b-instruct-v1:0
148
+ - us.mistral.pixtral-large-2502-v1:0
149
+
150
+
151
+ ## VSCode extension
152
+ You will also probably want to install the vscode extension for syntax highlighting and other
153
+ developer niceties. You can install the vscode extension by searching for "convo-lang" in the
154
+ vscode extension tab.
155
+
156
+ https://marketplace.visualstudio.com/items?itemName=iyio.convo-lang-tools
157
+
158
+
159
+ ## Using Convo-Lang
160
+ When using Convo-Lang in a TypeScript or JavaScript project will use the Convo-Lang Conversation Engine
161
+ by creating instances of the `Conversation` class and appending messages and awaiting the
162
+ completion of those messages. Conversations are made up of collections of messages that represent
163
+ messages from the user, LLM, tool definitions and more.
164
+
165
+ Install Convo-Lang packages
166
+ ``` sh
167
+ npm install @convo-lang/convo-lang @convo-lang/convo-lang-openai
168
+ ```
169
+
170
+ *(note - syntax highlighting for Convo-Lang embedded in string template literals is provided using the "convo-lang" VSCode extension)*
171
+ ``` js
172
+ // example.mjs
173
+ import { Conversation } from "@convo-lang/convo-lang";
174
+ import { initOpenAiBackend } from '@convo-lang/convo-lang-openai';
175
+
176
+ initOpenAiBackend();
177
+ const conversation=new Conversation();
178
+
179
+
180
+ await conversation.completeAsync(/*convo*/`
181
+ > system
182
+ You are a super smart and funny astronomer that love make funny quotes
183
+
184
+ > define
185
+ Planet = struct(
186
+ name: string
187
+ moonCount: number
188
+ quote: string
189
+ )
190
+
191
+ @json Planet[]
192
+ > user
193
+ List the planets in our solar system
194
+ `);
195
+
196
+
197
+ console.log(conversation.convo);
198
+ ```
199
+
200
+ ``` sh
201
+ # Set the OPENAI_API_KEY env var however you see fit
202
+ export OPENAI_API_KEY=sk-___YOUR_KEY___
203
+
204
+ node example.mjs
205
+
206
+ ```
207
+
208
+ Output:
209
+ ``` convo
210
+ @format json
211
+ > assistant
212
+ [
213
+ {
214
+ "name": "Mercury",
215
+ "moonCount": 0,
216
+ "quote": "I'm Mercury. I don't have any moons, but who needs them when you're this close to the Sun? 🍳"
217
+ },
218
+ {
219
+ "name": "Venus",
220
+ "moonCount": 0,
221
+ "quote": "Venus here! No moons in sight, but you should see my cloud cover. It's haute couture! ☁️👗"
222
+ },
223
+ {
224
+ "name": "Earth",
225
+ "moonCount": 1,
226
+ "quote": "Earth, the only planet with pizza! Oh, and one moon which we keep for dramatic lunar eclipses. 🌕🍕"
227
+ },
228
+ {
229
+ "name": "Mars",
230
+ "moonCount": 2,
231
+ "quote": "Mars calling! With my two moons, Phobos and Deimos, I basically have my own double feature in the sky! 🎬🌌"
232
+ },
233
+ {
234
+ "name": "Jupiter",
235
+ "moonCount": 79,
236
+ "quote": "Jupiter, moon hoarder extraordinaire! With 79 moons, my nightly show is never the same—it's cosmic channel surfing! 📺🌔"
237
+ },
238
+ {
239
+ "name": "Saturn",
240
+ "moonCount": 83,
241
+ "quote": "Saturn here, all about those rings AND 83 moons! Talk about accessories stealing the spotlight! 💍🌕"
242
+ },
243
+ {
244
+ "name": "Uranus",
245
+ "moonCount": 27,
246
+ "quote": "Uranus checking in! With 27 moons, I have more natural satellites than most people have friends. 🌑👽"
247
+ },
248
+ {
249
+ "name": "Neptune",
250
+ "moonCount": 14,
251
+ "quote": "Neptune, ruler of the deep space! With 14 moons, I'm never alone, even in the far reaches of the solar system. 🌊🔭"
252
+ }
253
+ ]
254
+ ```
255
+
256
+ ## NodeJs example project
257
+ The `convo-lang/convo-lang-node-example` repo contains a full featured CLI tool that can load
258
+ Convo-Lang scripts, accept messages over HTTP and accept live input.
259
+
260
+ https://github.com/convo-lang/convo-lang-node-example
261
+
262
+ ![NextJS example](https://github.com/convo-lang/convo-lang/blob/main/assets/convo-lang-node-example.webp?raw=true)
263
+
264
+
265
+
266
+ ## Using convo-lang in a existing NextJs project
267
+ Follow the step below to you Convo-Lang in an existing NextJS project
268
+
269
+
270
+ Install packages:
271
+ ``` sh
272
+ npm i \
273
+ @convo-lang/convo-lang \
274
+ @convo-lang/convo-lang-react \
275
+ @convo-lang/convo-lang-openai \
276
+ @convo-lang/convo-lang-api-routes \
277
+ @iyio/nextjs-common \
278
+ @iyio/react-common \
279
+ @iyio/node-common
280
+ ```
281
+
282
+ Add API endpoint to `/pages/api/convo-lang/[convo-api-action].ts`. This API endpoint will be used
283
+ to relay messages between LLMs while keep your API secrets safe.
284
+ ``` ts
285
+ import { createRequestHandler } from "@/lib/api-handler";
286
+ import { createConvoLangApiRoutes } from "@convo-lang/convo-lang-api-routes";
287
+ import { initOpenAiBackend } from '@convo-lang/convo-lang-openai';
288
+
289
+ initOpenAiBackend();
290
+
291
+ const routes=createConvoLangApiRoutes({prefix:'/api/convo-lang/'});
292
+
293
+ const handler=createRequestHandler({routes});
294
+
295
+ export default handler;
296
+
297
+ ```
298
+
299
+ The code below creates a fully functional chat interface with a website assistant agent
300
+ ``` tsx
301
+ import { ConversationView } from "@convo-lang/convo-lang-react";
302
+ import { NextJsBaseLayoutView } from "@iyio/nextjs-common";
303
+
304
+ // For syntax highlighting of Convo-Lang install the Convo-Lang VSCode extension.
305
+ // Search for "convo-lang" in the extensions window.
306
+ const exampleConvo=/*convo*/`
307
+
308
+ > define
309
+ agentName='Doc'
310
+
311
+ > system
312
+ Your name is {{agentName}} and you're helping a user navigate a website
313
+
314
+ Pages:
315
+ - Dashboard: path = /
316
+ - Contact: path = /contact
317
+ - News: path = /news
318
+ - Profile: path = /users-place
319
+ - Projects: path = /project-jobs
320
+
321
+ > extern openPage(
322
+ # Path of page to open
323
+ path:string
324
+ )
325
+
326
+ > assistant
327
+ Hi 👋, I'm {{agentName}}. I'm here to help you navigate this awesome website
328
+
329
+ `
330
+
331
+
332
+ export function AgentView(){
333
+
334
+ return (
335
+ <NextJsBaseLayoutView>
336
+ <ConversationView
337
+ theme="dark"
338
+ showInputWithSource
339
+ enabledSlashCommands
340
+ template={exampleConvo}
341
+ httpEndpoint="/api/convo-lang"
342
+ externFunctions={{
343
+ openPage:async (path:string)=>{
344
+ window.history.pushState(null,'',path);
345
+ },
346
+ }}
347
+ />
348
+ </NextJsBaseLayoutView>
349
+ )
350
+
351
+ }
352
+
353
+ ```
354
+
355
+ ## NextJs example project
356
+ The `convo-lang/convo-lang-nextjs-example` repo contains a fully functional example of using Convo-Lang
357
+ in a NextJs project to create a collection of agents that can manipulate an interactive canvas.
358
+
359
+ https://github.com/convo-lang/convo-lang-nextjs-example
360
+
361
+ ![NextJS example](https://github.com/convo-lang/convo-lang/blob/main/assets/convo-lang-nextjs-example.webp?raw=true)
362
+
363
+
364
+
365
+ ## Using the convo-lang extension
366
+ With the convo vscode extension installed, you can execute convo scripts directly in vscode. Just
367
+ press **(CMD+R)** to run a script.
368
+
369
+ You can also run snippets of convo scripts that are embedded in other
370
+ document types. Just highlight the convo code you want to run, open the command palette, and
371
+ search for "Complete Convo Conversation" and press enter. Then the snippet will be opened in a new
372
+ convo file and completed. This is great for quick prototyping and testing prompts in your application
373
+ without having to start your full application.
374
+
375
+
376
+ ## Using the CLI
377
+ The convo CLI can be used to execute convo scripts from the command line
378
+
379
+ For use on the command line install the @convo-lang/convo-lang-cli package
380
+ ``` sh
381
+ npm i @convo-lang/convo-lang-cli -g
382
+ ```
383
+
384
+ ``` sh
385
+ # install the convo cli
386
+ npm i -g @convo-lang/convo-lang-cli
387
+
388
+ # Results will be printed to stdout
389
+ convo talky-time.convo
390
+
391
+ # Results will be written to a new file named something-happened.convo
392
+ convo talky-time.convo --out something.convo
393
+
394
+ # Result will be written to the source input file. This allows you to have a continuous conversation
395
+ convo talky-time.convo --out .
396
+ ```
397
+
398
+ There is currently only one way to configure the convo cli and vscode extension. This will be extended
399
+ soon to include reading configuration files from your current workspace.
400
+
401
+
402
+ ## CLI and extension configuration
403
+ To allow convo to access OpenAI, create a JSON file called ~/.config/convo/convo.json and add the
404
+ following contents. Remember to replace the API key with your OpenAI api key.
405
+
406
+ ``` json
407
+ {
408
+ "env":{
409
+ "openAiApiKey":"YOUR_OPEN_AI_KEY",
410
+ "openAiChatModel":"gpt-4o",
411
+ "openAiVisionModel":"gpt-4o",
412
+ "openAiAudioModel":"whisper-1",
413
+ "openAiImageModel":"dall-e-3",
414
+
415
+ "awsBedrockProfile":"{optional - AWS profile to use for Bedrock models}"
416
+ }
417
+ }
418
+ ```
419
+
420
+ ## IYIO ( eye·o )
421
+ Convo-Lang uses many of the packages of the IYIO library and began as a package in the IYIO library.
422
+ IYIO is a collection of utilities and frameworks useful for many different situations.
423
+
424
+ IYIO - https://github.com/iyioio/common
425
+
426
+ ## Learn More
427
+ You can check out an interactive demo of Convo-Lang here - [https://learn.convo-lang.ai/playground](https://learn.convo-lang.ai/playground)
428
+
429
+ If you want to learn the Convo-Lang language check out this tutorial - [https://learn.convo-lang.ai/learn](https://learn.convo-lang.ai/learn)
430
+
431
+ ## Contact
432
+
433
+ Email - doc@convo-lang.ai
434
+
435
+ X - https://x.com/ConvoLang
436
+
437
+ Join our Discord Server - https://discord.gg/GyXp8Dsa
@@ -0,0 +1,3 @@
1
+ {
2
+ "sideEffects": false
3
+ }
@@ -0,0 +1 @@
1
+ export * from "@convo-lang/convo-lang";
@@ -0,0 +1,2 @@
1
+ export * from "@convo-lang/convo-lang";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/convo-lang-alias/src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,33 @@
1
+ {
2
+ "name": "convo-lang",
3
+ "version": "0.7.26",
4
+ "sideEffects": false,
5
+ "license": "Apache-2.0",
6
+ "keywords": [
7
+ "prompt",
8
+ "prompt-engineering",
9
+ "LLM",
10
+ "ai-agents",
11
+ "tool-calling",
12
+ "open-ai",
13
+ "ai",
14
+ "convo-lang"
15
+ ],
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/convo-lang/convo-lang.git"
19
+ },
20
+ "dependencies": {
21
+ "@iyio/common": "^0.7.23",
22
+ "@iyio/json5": "^0.7.23",
23
+ "@iyio/vfs": "^0.7.23",
24
+ "date-fns": "^2.29.3",
25
+ "rxjs": "^7.8.0",
26
+ "zod": "^3.21.4"
27
+ },
28
+ "peerDependencies": {
29
+ "@convo-lang/convo-lang": "0.7.26"
30
+ },
31
+ "main": "./src/index.js",
32
+ "module": "./esm/src/index.js"
33
+ }
package/src/index.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from "@convo-lang/convo-lang";
package/src/index.js ADDED
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("@convo-lang/convo-lang"), exports);
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/convo-lang-alias/src/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC"}
@@ -0,0 +1,4 @@
1
+ {
2
+ "type": "commonjs",
3
+ "sideEffects": false
4
+ }