llm-mar 1.0.7 → 1.0.8
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 +132 -1
- package/commands/create.js +12 -6
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
LLM-MAR (Multi Agent Reasoning) is a compact CLI that creates LLM agents, lets them debate, answers questions, and builds workflows.
|
|
6
6
|
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
- [Installation](#installation)
|
|
10
|
+
- [Quick Start](#quick-start)
|
|
11
|
+
- [Usage](#usage)
|
|
12
|
+
- [YAML Structure](#yaml-structure)
|
|
13
|
+
|
|
7
14
|
## Installation
|
|
8
15
|
|
|
9
16
|
### Option 1: Install from npm (Recommended)
|
|
@@ -30,6 +37,74 @@ npm install -g llm-mar
|
|
|
30
37
|
export OPENAI_API_KEY=your_api_key_here
|
|
31
38
|
```
|
|
32
39
|
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
Get started with LLM-MAR in minutes! Create intelligent agents, form teams, and orchestrate debates—all through simple YAML configurations.
|
|
43
|
+
|
|
44
|
+
### 1. Create Your First Agent
|
|
45
|
+
|
|
46
|
+
Let's create an AI assistant specialized in creative writing:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
llm-mar create agent writer --model gpt-4 --goal "To write engaging stories" --role "Creative Writer" --system-prompt "You are a talented fiction writer with a vivid imagination." --instructions "Use descriptive language,Build suspense,End with a twist" --output text
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This generates a YAML configuration file that defines your agent's personality and capabilities.
|
|
53
|
+
|
|
54
|
+
### 2. See the YAML Structure
|
|
55
|
+
|
|
56
|
+
The command above creates `default/writer.yaml` with this structure:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
version: '1.0'
|
|
60
|
+
kind: Agent
|
|
61
|
+
metadata:
|
|
62
|
+
name: writer
|
|
63
|
+
description: An agent named writer
|
|
64
|
+
spec:
|
|
65
|
+
id: writer
|
|
66
|
+
model: gpt-4
|
|
67
|
+
goal: To write engaging stories
|
|
68
|
+
role: Creative Writer
|
|
69
|
+
system_prompt: You are a talented fiction writer with a vivid imagination.
|
|
70
|
+
instructions:
|
|
71
|
+
- Use descriptive language
|
|
72
|
+
- Build suspense
|
|
73
|
+
- End with a twist
|
|
74
|
+
output: text
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Key Components:**
|
|
78
|
+
- **metadata**: Basic info and description
|
|
79
|
+
- **spec**: The agent's configuration including model, role, and behavior
|
|
80
|
+
- **instructions**: List of guidelines for the AI's responses
|
|
81
|
+
|
|
82
|
+
### 3. Run Your Agent
|
|
83
|
+
|
|
84
|
+
Now let's use the agent to generate a story:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
llm-mar run default/writer.yaml --input "Write a short story about a mysterious old clock in an antique shop."
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
The agent will respond with a creative story based on its configuration!
|
|
91
|
+
|
|
92
|
+
### 4. Build a Team
|
|
93
|
+
|
|
94
|
+
Combine multiple agents for collaborative tasks:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
llm-mar create team story_team --agents "default/writer.yaml,default/editor.yaml" --output text
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### 5. Set Up a Debate
|
|
101
|
+
|
|
102
|
+
Create engaging debates between agents:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
llm-mar create debate tech_debate --agents "default/optimist.yaml,default/pessimist.yaml" --judges "default/judge.yaml" --input "Will AI replace human jobs?" --output text
|
|
106
|
+
```
|
|
107
|
+
|
|
33
108
|
## Usage
|
|
34
109
|
|
|
35
110
|
After installation, use the `llm-mar` command (or `npx llm-mar` if installed locally).
|
|
@@ -78,4 +153,60 @@ llm-mar run default/debate1.yaml
|
|
|
78
153
|
|
|
79
154
|
## YAML Structure
|
|
80
155
|
|
|
81
|
-
|
|
156
|
+
LLM-MAR uses YAML files to define agents, teams, and debates. Here's a quick overview of the structure:
|
|
157
|
+
|
|
158
|
+
### Agent YAML
|
|
159
|
+
|
|
160
|
+
```yaml
|
|
161
|
+
version: '1.0'
|
|
162
|
+
kind: Agent
|
|
163
|
+
metadata:
|
|
164
|
+
name: Scientist
|
|
165
|
+
description: A scientific analysis agent
|
|
166
|
+
spec:
|
|
167
|
+
id: scientist
|
|
168
|
+
model: gpt-4
|
|
169
|
+
goal: To provide scientific explanations
|
|
170
|
+
role: Research Scientist
|
|
171
|
+
system_prompt: You are an expert scientist...
|
|
172
|
+
instructions:
|
|
173
|
+
- Use evidence-based reasoning
|
|
174
|
+
- Explain complex concepts simply
|
|
175
|
+
output: text
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Team YAML
|
|
179
|
+
|
|
180
|
+
```yaml
|
|
181
|
+
version: '1.0'
|
|
182
|
+
kind: Team
|
|
183
|
+
metadata:
|
|
184
|
+
name: Research Team
|
|
185
|
+
description: Collaborative research team
|
|
186
|
+
spec:
|
|
187
|
+
agents:
|
|
188
|
+
- default/scientist.yaml
|
|
189
|
+
- default/analyst.yaml
|
|
190
|
+
output: text
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### Debate YAML
|
|
194
|
+
|
|
195
|
+
```yaml
|
|
196
|
+
version: '1.0'
|
|
197
|
+
kind: Debate
|
|
198
|
+
metadata:
|
|
199
|
+
name: Ethics Debate
|
|
200
|
+
description: Debate on AI ethics
|
|
201
|
+
spec:
|
|
202
|
+
method: majority_vote
|
|
203
|
+
input: Should AI have rights?
|
|
204
|
+
judges:
|
|
205
|
+
- default/judge.yaml
|
|
206
|
+
agents:
|
|
207
|
+
- default/pro.yaml
|
|
208
|
+
- default/con.yaml
|
|
209
|
+
output: text
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
For detailed configuration options and advanced features, see [docs/yaml-structure-guide.md](docs/yaml-structure-guide.md).
|
package/commands/create.js
CHANGED
|
@@ -13,8 +13,10 @@ function setupCreate(program) {
|
|
|
13
13
|
.option('--system-prompt <prompt>', 'system prompt', 'You are a helpful assistant.')
|
|
14
14
|
.option('--instructions <instructions>', 'instructions as comma-separated list', 'Think step by step,Answer clearly and concisely')
|
|
15
15
|
.option('--output <format>', 'output format', 'text')
|
|
16
|
+
.option('--output-file <path>', 'output file path')
|
|
16
17
|
.action((name, options) => {
|
|
17
18
|
const instructions = options.instructions.split(',').map(s => s.trim());
|
|
19
|
+
const outputFile = options.outputFile || `default/${name}.yaml`;
|
|
18
20
|
const config = {
|
|
19
21
|
version: '1.0',
|
|
20
22
|
kind: 'Agent',
|
|
@@ -33,8 +35,8 @@ function setupCreate(program) {
|
|
|
33
35
|
}
|
|
34
36
|
};
|
|
35
37
|
const yamlStr = yaml.dump(config);
|
|
36
|
-
fs.writeFileSync(
|
|
37
|
-
console.log(`Agent YAML created:
|
|
38
|
+
fs.writeFileSync(outputFile, yamlStr);
|
|
39
|
+
console.log(`Agent YAML created: ${outputFile}`);
|
|
38
40
|
});
|
|
39
41
|
|
|
40
42
|
createCmd
|
|
@@ -42,12 +44,14 @@ function setupCreate(program) {
|
|
|
42
44
|
.description('create a new team YAML')
|
|
43
45
|
.option('--agents <agents>', 'comma-separated list of agent YAML file paths')
|
|
44
46
|
.option('--output <format>', 'output format', 'text')
|
|
47
|
+
.option('--output-file <path>', 'output file path')
|
|
45
48
|
.action((name, options) => {
|
|
46
49
|
if (!options.agents) {
|
|
47
50
|
console.error('Error: --agents is required');
|
|
48
51
|
process.exit(1);
|
|
49
52
|
}
|
|
50
53
|
const agentFiles = options.agents.split(',').map(s => s.trim());
|
|
54
|
+
const outputFile = options.outputFile || `default/${name}.yaml`;
|
|
51
55
|
const config = {
|
|
52
56
|
version: '1.0',
|
|
53
57
|
kind: 'Team',
|
|
@@ -61,8 +65,8 @@ function setupCreate(program) {
|
|
|
61
65
|
}
|
|
62
66
|
};
|
|
63
67
|
const yamlStr = yaml.dump(config);
|
|
64
|
-
fs.writeFileSync(
|
|
65
|
-
console.log(`Team YAML created:
|
|
68
|
+
fs.writeFileSync(outputFile, yamlStr);
|
|
69
|
+
console.log(`Team YAML created: ${outputFile}`);
|
|
66
70
|
});
|
|
67
71
|
|
|
68
72
|
createCmd
|
|
@@ -73,6 +77,7 @@ function setupCreate(program) {
|
|
|
73
77
|
.option('--judges <judges>', 'comma-separated list of judge agent YAML file paths')
|
|
74
78
|
.option('--input <input>', 'debate input topic', 'A topic to debate')
|
|
75
79
|
.option('--output <format>', 'output format', 'text')
|
|
80
|
+
.option('--output-file <path>', 'output file path')
|
|
76
81
|
.action((name, options) => {
|
|
77
82
|
if (!options.agents || !options.judges) {
|
|
78
83
|
console.error('Error: --agents and --judges are required');
|
|
@@ -80,6 +85,7 @@ function setupCreate(program) {
|
|
|
80
85
|
}
|
|
81
86
|
const agents = options.agents.split(',').map(s => s.trim());
|
|
82
87
|
const judges = options.judges.split(',').map(s => s.trim());
|
|
88
|
+
const outputFile = options.outputFile || `default/${name}.yaml`;
|
|
83
89
|
const config = {
|
|
84
90
|
version: '1.0',
|
|
85
91
|
kind: 'Debate',
|
|
@@ -96,8 +102,8 @@ function setupCreate(program) {
|
|
|
96
102
|
}
|
|
97
103
|
};
|
|
98
104
|
const yamlStr = yaml.dump(config);
|
|
99
|
-
fs.writeFileSync(
|
|
100
|
-
console.log(`Debate YAML created:
|
|
105
|
+
fs.writeFileSync(outputFile, yamlStr);
|
|
106
|
+
console.log(`Debate YAML created: ${outputFile}`);
|
|
101
107
|
});
|
|
102
108
|
}
|
|
103
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-mar",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "LLM-MAR is a compact CLI that creates LLM agents, lets them debate, answers questions, and builds workflows.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
16
16
|
"type": "git",
|
|
17
|
-
"url": "git+https://github.com/
|
|
17
|
+
"url": "git+https://github.com/llm-mar/llm-mar.git"
|
|
18
18
|
},
|
|
19
19
|
"publishConfig": {
|
|
20
20
|
"access": "public",
|