voyageai-cli 1.24.0 → 1.26.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.
Files changed (43) hide show
  1. package/package.json +1 -1
  2. package/src/cli.js +2 -0
  3. package/src/commands/about.js +1 -1
  4. package/src/commands/bug.js +1 -1
  5. package/src/commands/playground.js +31 -0
  6. package/src/commands/scaffold.js +23 -1
  7. package/src/commands/workflow.js +336 -0
  8. package/src/lib/explanations.js +53 -0
  9. package/src/lib/scaffold-structure.js +8 -9
  10. package/src/lib/telemetry.js +1 -1
  11. package/src/lib/template-engine.js +240 -0
  12. package/src/lib/templates/nextjs/README.md.tpl +78 -55
  13. package/src/lib/templates/nextjs/favicon.svg.tpl +11 -0
  14. package/src/lib/templates/nextjs/footer.jsx.tpl +49 -0
  15. package/src/lib/templates/nextjs/layout.jsx.tpl +16 -10
  16. package/src/lib/templates/nextjs/lib-mongo.js.tpl +5 -5
  17. package/src/lib/templates/nextjs/lib-voyage.js.tpl +13 -8
  18. package/src/lib/templates/nextjs/navbar.jsx.tpl +98 -0
  19. package/src/lib/templates/nextjs/page-home.jsx.tpl +201 -0
  20. package/src/lib/templates/nextjs/page-search.jsx.tpl +184 -82
  21. package/src/lib/templates/nextjs/theme-registry.jsx.tpl +51 -0
  22. package/src/lib/templates/nextjs/theme.js.tpl +138 -65
  23. package/src/lib/templates/nextjs/vai-logo-256.png +0 -0
  24. package/src/lib/workflow-utils.js +65 -0
  25. package/src/lib/workflow.js +1259 -0
  26. package/src/mcp/tools/management.js +1 -60
  27. package/src/playground/icons/dark/128.png +0 -0
  28. package/src/playground/icons/dark/16.png +0 -0
  29. package/src/playground/icons/dark/256.png +0 -0
  30. package/src/playground/icons/dark/32.png +0 -0
  31. package/src/playground/icons/dark/64.png +0 -0
  32. package/src/playground/icons/light/128.png +0 -0
  33. package/src/playground/icons/light/16.png +0 -0
  34. package/src/playground/icons/light/256.png +0 -0
  35. package/src/playground/icons/light/32.png +0 -0
  36. package/src/playground/icons/light/64.png +0 -0
  37. package/src/playground/icons/watermark.png +0 -0
  38. package/src/playground/index.html +125 -73
  39. package/src/workflows/consistency-check.json +64 -0
  40. package/src/workflows/cost-analysis.json +69 -0
  41. package/src/workflows/multi-collection-search.json +80 -0
  42. package/src/workflows/research-and-summarize.json +46 -0
  43. package/src/workflows/smart-ingest.json +63 -0
@@ -0,0 +1,64 @@
1
+ {
2
+ "$schema": "https://vai.dev/schemas/workflow-v1.json",
3
+ "name": "Consistency Check",
4
+ "description": "Compare content about the same topic across two collections using semantic similarity",
5
+ "version": "1.0.0",
6
+ "inputs": {
7
+ "topic": {
8
+ "type": "string",
9
+ "description": "The topic to check consistency for",
10
+ "required": true
11
+ },
12
+ "collection1": {
13
+ "type": "string",
14
+ "description": "First collection to search",
15
+ "required": true
16
+ },
17
+ "collection2": {
18
+ "type": "string",
19
+ "description": "Second collection to search",
20
+ "required": true
21
+ }
22
+ },
23
+ "defaults": {},
24
+ "steps": [
25
+ {
26
+ "id": "search_source_a",
27
+ "name": "Search first collection",
28
+ "tool": "query",
29
+ "inputs": {
30
+ "query": "{{ inputs.topic }}",
31
+ "collection": "{{ inputs.collection1 }}",
32
+ "limit": 5,
33
+ "rerank": false
34
+ }
35
+ },
36
+ {
37
+ "id": "search_source_b",
38
+ "name": "Search second collection",
39
+ "tool": "query",
40
+ "inputs": {
41
+ "query": "{{ inputs.topic }}",
42
+ "collection": "{{ inputs.collection2 }}",
43
+ "limit": 5,
44
+ "rerank": false
45
+ }
46
+ },
47
+ {
48
+ "id": "compare",
49
+ "name": "Compare top results from each source",
50
+ "tool": "similarity",
51
+ "inputs": {
52
+ "text1": "{{ search_source_a.output.results[0].text }}",
53
+ "text2": "{{ search_source_b.output.results[0].text }}"
54
+ },
55
+ "condition": "{{ search_source_a.output.results.length > 0 && search_source_b.output.results.length > 0 }}"
56
+ }
57
+ ],
58
+ "output": {
59
+ "similarity": "{{ compare.output.similarity }}",
60
+ "sourceA": "{{ search_source_a.output.results[0] }}",
61
+ "sourceB": "{{ search_source_b.output.results[0] }}",
62
+ "topic": "{{ inputs.topic }}"
63
+ }
64
+ }
@@ -0,0 +1,69 @@
1
+ {
2
+ "$schema": "https://vai.dev/schemas/workflow-v1.json",
3
+ "name": "Cost Analysis",
4
+ "description": "Compare embedding costs across different models and scenarios",
5
+ "version": "1.0.0",
6
+ "inputs": {
7
+ "docs": {
8
+ "type": "number",
9
+ "description": "Number of documents to estimate for",
10
+ "required": true
11
+ },
12
+ "queries": {
13
+ "type": "number",
14
+ "description": "Monthly query volume",
15
+ "default": 1000
16
+ },
17
+ "months": {
18
+ "type": "number",
19
+ "description": "Planning horizon in months",
20
+ "default": 12
21
+ }
22
+ },
23
+ "defaults": {},
24
+ "steps": [
25
+ {
26
+ "id": "cost_large",
27
+ "name": "Estimate with voyage-4-large (best quality)",
28
+ "tool": "estimate",
29
+ "inputs": {
30
+ "model": "voyage-4-large",
31
+ "docs": "{{ inputs.docs }}",
32
+ "queries": "{{ inputs.queries }}",
33
+ "months": "{{ inputs.months }}"
34
+ }
35
+ },
36
+ {
37
+ "id": "cost_balanced",
38
+ "name": "Estimate with voyage-4 (balanced)",
39
+ "tool": "estimate",
40
+ "inputs": {
41
+ "model": "voyage-4",
42
+ "docs": "{{ inputs.docs }}",
43
+ "queries": "{{ inputs.queries }}",
44
+ "months": "{{ inputs.months }}"
45
+ }
46
+ },
47
+ {
48
+ "id": "cost_lite",
49
+ "name": "Estimate with voyage-4-lite (budget)",
50
+ "tool": "estimate",
51
+ "inputs": {
52
+ "model": "voyage-4-lite",
53
+ "docs": "{{ inputs.docs }}",
54
+ "queries": "{{ inputs.queries }}",
55
+ "months": "{{ inputs.months }}"
56
+ }
57
+ }
58
+ ],
59
+ "output": {
60
+ "comparison": [
61
+ "{{ cost_large.output }}",
62
+ "{{ cost_balanced.output }}",
63
+ "{{ cost_lite.output }}"
64
+ ],
65
+ "docs": "{{ inputs.docs }}",
66
+ "queriesPerMonth": "{{ inputs.queries }}",
67
+ "months": "{{ inputs.months }}"
68
+ }
69
+ }
@@ -0,0 +1,80 @@
1
+ {
2
+ "$schema": "https://vai.dev/schemas/workflow-v1.json",
3
+ "name": "Multi-Collection Search",
4
+ "description": "Search multiple collections, merge results, and rerank for best relevance",
5
+ "version": "1.0.0",
6
+ "inputs": {
7
+ "query": {
8
+ "type": "string",
9
+ "description": "The search query",
10
+ "required": true
11
+ },
12
+ "collection1": {
13
+ "type": "string",
14
+ "description": "First collection to search",
15
+ "required": true
16
+ },
17
+ "collection2": {
18
+ "type": "string",
19
+ "description": "Second collection to search",
20
+ "required": true
21
+ },
22
+ "limit": {
23
+ "type": "number",
24
+ "description": "Results per collection",
25
+ "default": 10
26
+ }
27
+ },
28
+ "defaults": {},
29
+ "steps": [
30
+ {
31
+ "id": "search_1",
32
+ "name": "Search first collection",
33
+ "tool": "query",
34
+ "inputs": {
35
+ "query": "{{ inputs.query }}",
36
+ "collection": "{{ inputs.collection1 }}",
37
+ "limit": "{{ inputs.limit }}",
38
+ "rerank": false
39
+ }
40
+ },
41
+ {
42
+ "id": "search_2",
43
+ "name": "Search second collection",
44
+ "tool": "query",
45
+ "inputs": {
46
+ "query": "{{ inputs.query }}",
47
+ "collection": "{{ inputs.collection2 }}",
48
+ "limit": "{{ inputs.limit }}",
49
+ "rerank": false
50
+ }
51
+ },
52
+ {
53
+ "id": "merge",
54
+ "name": "Merge results",
55
+ "tool": "merge",
56
+ "inputs": {
57
+ "arrays": [
58
+ "{{ search_1.output.results }}",
59
+ "{{ search_2.output.results }}"
60
+ ],
61
+ "dedup": true,
62
+ "dedup_field": "source"
63
+ }
64
+ },
65
+ {
66
+ "id": "rerank_all",
67
+ "name": "Rerank merged results",
68
+ "tool": "rerank",
69
+ "inputs": {
70
+ "query": "{{ inputs.query }}",
71
+ "documents": "{{ merge.output.results }}"
72
+ }
73
+ }
74
+ ],
75
+ "output": {
76
+ "results": "{{ rerank_all.output.results }}",
77
+ "resultCount": "{{ rerank_all.output.resultCount }}",
78
+ "query": "{{ inputs.query }}"
79
+ }
80
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "https://vai.dev/schemas/workflow-v1.json",
3
+ "name": "Research and Summarize",
4
+ "description": "Search knowledge base, then use LLM to produce a structured summary",
5
+ "version": "1.0.0",
6
+ "inputs": {
7
+ "question": {
8
+ "type": "string",
9
+ "description": "The research question to answer",
10
+ "required": true
11
+ },
12
+ "limit": {
13
+ "type": "number",
14
+ "description": "Maximum documents to retrieve",
15
+ "default": 10
16
+ }
17
+ },
18
+ "defaults": {},
19
+ "steps": [
20
+ {
21
+ "id": "research",
22
+ "name": "Search knowledge base",
23
+ "tool": "query",
24
+ "inputs": {
25
+ "query": "{{ inputs.question }}",
26
+ "limit": "{{ inputs.limit }}"
27
+ }
28
+ },
29
+ {
30
+ "id": "summarize",
31
+ "name": "Generate summary with LLM",
32
+ "tool": "generate",
33
+ "inputs": {
34
+ "prompt": "Based on the following documents, provide a structured summary answering: {{ inputs.question }}",
35
+ "context": "{{ research.output.results }}",
36
+ "systemPrompt": "You are a research analyst. Structure your response with: Key Findings, Supporting Evidence, and Gaps in Available Information. Cite sources when possible."
37
+ }
38
+ }
39
+ ],
40
+ "output": {
41
+ "summary": "{{ summarize.output.text }}",
42
+ "sources": "{{ research.output.results }}",
43
+ "sourceCount": "{{ research.output.resultCount }}",
44
+ "question": "{{ inputs.question }}"
45
+ }
46
+ }
@@ -0,0 +1,63 @@
1
+ {
2
+ "$schema": "https://vai.dev/schemas/workflow-v1.json",
3
+ "name": "Smart Ingest",
4
+ "description": "Check if a document is novel before ingesting (avoid duplicates)",
5
+ "version": "1.0.0",
6
+ "inputs": {
7
+ "text": {
8
+ "type": "string",
9
+ "description": "The document text to ingest",
10
+ "required": true
11
+ },
12
+ "source": {
13
+ "type": "string",
14
+ "description": "Source identifier for the document",
15
+ "required": true
16
+ },
17
+ "threshold": {
18
+ "type": "number",
19
+ "description": "Similarity threshold (0-1). Documents more similar than this are considered duplicates",
20
+ "default": 0.85
21
+ }
22
+ },
23
+ "defaults": {},
24
+ "steps": [
25
+ {
26
+ "id": "check_existing",
27
+ "name": "Search for similar existing documents",
28
+ "tool": "search",
29
+ "inputs": {
30
+ "query": "{{ inputs.text }}",
31
+ "limit": 3
32
+ }
33
+ },
34
+ {
35
+ "id": "similarity_check",
36
+ "name": "Check similarity to top match",
37
+ "tool": "similarity",
38
+ "inputs": {
39
+ "text1": "{{ inputs.text }}",
40
+ "text2": "{{ check_existing.output.results[0].text }}"
41
+ },
42
+ "condition": "{{ check_existing.output.results.length > 0 }}"
43
+ },
44
+ {
45
+ "id": "ingest_doc",
46
+ "name": "Ingest if sufficiently novel",
47
+ "tool": "ingest",
48
+ "inputs": {
49
+ "text": "{{ inputs.text }}",
50
+ "source": "{{ inputs.source }}",
51
+ "metadata": {
52
+ "ingested_via": "smart-ingest-workflow"
53
+ }
54
+ },
55
+ "condition": "{{ !similarity_check.output || similarity_check.output.similarity < 0.85 }}"
56
+ }
57
+ ],
58
+ "output": {
59
+ "ingested": "{{ ingest_doc.output ? true : false }}",
60
+ "similarityScore": "{{ similarity_check.output.similarity }}",
61
+ "existingDocs": "{{ check_existing.output.resultCount }}"
62
+ }
63
+ }