mindrx 0.1.3 → 0.2.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.
- package/README.md +230 -0
- package/dist/providers/anthropic.d.ts +13 -0
- package/dist/providers/anthropic.d.ts.map +1 -0
- package/dist/providers/anthropic.js +54 -0
- package/dist/providers/anthropic.js.map +1 -0
- package/dist/providers/google.d.ts +13 -0
- package/dist/providers/google.d.ts.map +1 -0
- package/dist/providers/google.js +62 -0
- package/dist/providers/google.js.map +1 -0
- package/dist/providers/index.d.ts +3 -0
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +11 -2
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/xai.d.ts +13 -0
- package/dist/providers/xai.d.ts.map +1 -0
- package/dist/providers/xai.js +66 -0
- package/dist/providers/xai.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +30 -7
package/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
# MindRx
|
|
4
|
+
|
|
5
|
+
**Cognitive state simulation for AI agents**
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/mindrx)
|
|
8
|
+
[](LICENSE)
|
|
9
|
+
[](package.json)
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
Run AI agents in altered cognitive states. Select a profile, and the agent's reasoning, tone, and associations shift accordingly.
|
|
16
|
+
|
|
17
|
+
<br>
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install -g mindrx # CLI
|
|
23
|
+
npm install mindrx # SDK
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
<br>
|
|
27
|
+
|
|
28
|
+
## Quick Start
|
|
29
|
+
|
|
30
|
+
### CLI
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# List available states
|
|
34
|
+
mindrx list
|
|
35
|
+
|
|
36
|
+
# Run with a cognitive state
|
|
37
|
+
mindrx run --state ketamine "What is the nature of time?"
|
|
38
|
+
|
|
39
|
+
# Pipe input
|
|
40
|
+
echo "Write me a poem about entropy" | mindrx run --state cannabis
|
|
41
|
+
|
|
42
|
+
# Interactive mode
|
|
43
|
+
mindrx repl --state ayahuasca
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### SDK
|
|
47
|
+
|
|
48
|
+
```typescript
|
|
49
|
+
import { MindRx } from 'mindrx';
|
|
50
|
+
|
|
51
|
+
const agent = new MindRx({ state: 'ketamine' });
|
|
52
|
+
const response = await agent.run("Explain consciousness");
|
|
53
|
+
console.log(response.content);
|
|
54
|
+
|
|
55
|
+
// Streaming
|
|
56
|
+
for await (const chunk of agent.stream("Tell me a story")) {
|
|
57
|
+
process.stdout.write(chunk.content);
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
<br>
|
|
62
|
+
|
|
63
|
+
## Available States
|
|
64
|
+
|
|
65
|
+
| State | Effect |
|
|
66
|
+
|:------|:-------|
|
|
67
|
+
| `sober` | Baseline — clear, rational, structured |
|
|
68
|
+
| `cannabis` | Relaxed associations, tangential thinking |
|
|
69
|
+
| `ketamine` | Dissociative, fragmented, void-adjacent |
|
|
70
|
+
| `cocaine` | Accelerated reasoning, high confidence |
|
|
71
|
+
| `ayahuasca` | Deep introspection, cosmic framing |
|
|
72
|
+
| `mdma` | Emphatic, connective, emotionally warm |
|
|
73
|
+
| `alcohol` | Loosened inhibition, casual tone |
|
|
74
|
+
| `lsd` | Synesthetic associations, boundary dissolution |
|
|
75
|
+
| `caffeine` | Focused, alert, slightly anxious |
|
|
76
|
+
|
|
77
|
+
<br>
|
|
78
|
+
|
|
79
|
+
## Providers
|
|
80
|
+
|
|
81
|
+
| Provider | Setup | Default Model |
|
|
82
|
+
|:---------|:------|:--------------|
|
|
83
|
+
| `mindrx` | None | Free hosted |
|
|
84
|
+
| `openai` | `OPENAI_API_KEY` | gpt-4o-mini |
|
|
85
|
+
| `anthropic` | `ANTHROPIC_API_KEY` | claude-3-5-sonnet |
|
|
86
|
+
| `google` | `GOOGLE_API_KEY` | gemini-1.5-flash |
|
|
87
|
+
| `xai` | `XAI_API_KEY` | grok-2-latest |
|
|
88
|
+
| `ollama` | Local install | llama3.2 |
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
// Default (free hosted)
|
|
92
|
+
const agent = new MindRx({ state: 'ketamine' });
|
|
93
|
+
|
|
94
|
+
// OpenAI
|
|
95
|
+
const agent = new MindRx({
|
|
96
|
+
state: 'cocaine',
|
|
97
|
+
provider: 'openai',
|
|
98
|
+
apiKey: process.env.OPENAI_API_KEY
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Local Ollama
|
|
102
|
+
const agent = new MindRx({
|
|
103
|
+
state: 'lsd',
|
|
104
|
+
provider: 'ollama',
|
|
105
|
+
model: 'llama3.2'
|
|
106
|
+
});
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
<br>
|
|
110
|
+
|
|
111
|
+
## API Reference
|
|
112
|
+
|
|
113
|
+
### Constructor
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
new MindRx(options?: MindRxOptions)
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
| Option | Type | Default |
|
|
120
|
+
|:-------|:-----|:--------|
|
|
121
|
+
| `state` | `string` | `'sober'` |
|
|
122
|
+
| `provider` | `ProviderName` | `'mindrx'` |
|
|
123
|
+
| `model` | `string` | Provider default |
|
|
124
|
+
| `apiKey` | `string` | Environment variable |
|
|
125
|
+
| `customStates` | `StateDefinition[]` | `[]` |
|
|
126
|
+
|
|
127
|
+
### Methods
|
|
128
|
+
|
|
129
|
+
```typescript
|
|
130
|
+
// Run a single prompt
|
|
131
|
+
agent.run(prompt: string): Promise<Response>
|
|
132
|
+
|
|
133
|
+
// Stream response chunks
|
|
134
|
+
agent.stream(prompt: string): AsyncIterable<Chunk>
|
|
135
|
+
|
|
136
|
+
// Change state
|
|
137
|
+
agent.setState(name: string): void
|
|
138
|
+
|
|
139
|
+
// Get current state
|
|
140
|
+
agent.getState(): StateDefinition
|
|
141
|
+
|
|
142
|
+
// List available states
|
|
143
|
+
agent.listStates(): string[]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Types
|
|
147
|
+
|
|
148
|
+
```typescript
|
|
149
|
+
interface Response {
|
|
150
|
+
content: string;
|
|
151
|
+
usage?: {
|
|
152
|
+
promptTokens: number;
|
|
153
|
+
completionTokens: number;
|
|
154
|
+
totalTokens: number;
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface Chunk {
|
|
159
|
+
content: string;
|
|
160
|
+
done: boolean;
|
|
161
|
+
}
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
<br>
|
|
165
|
+
|
|
166
|
+
## Custom States
|
|
167
|
+
|
|
168
|
+
```typescript
|
|
169
|
+
import { defineState, MindRx } from 'mindrx';
|
|
170
|
+
|
|
171
|
+
const sleepDeprived = defineState({
|
|
172
|
+
name: 'sleep-deprived',
|
|
173
|
+
description: '36 hours without sleep',
|
|
174
|
+
parameters: {
|
|
175
|
+
temperature: 1.1,
|
|
176
|
+
top_p: 0.95
|
|
177
|
+
},
|
|
178
|
+
behavior: {
|
|
179
|
+
association: 'loose',
|
|
180
|
+
coherence: 'drifting',
|
|
181
|
+
pacing: 'slow',
|
|
182
|
+
confidence: 'low'
|
|
183
|
+
},
|
|
184
|
+
systemPrompt: `You haven't slept in 36 hours. Your thoughts are slower,
|
|
185
|
+
you occasionally lose your train of thought, and you might make small
|
|
186
|
+
mistakes you wouldn't normally make.`
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
const agent = new MindRx({ customStates: [sleepDeprived] });
|
|
190
|
+
agent.setState('sleep-deprived');
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
<br>
|
|
194
|
+
|
|
195
|
+
## CLI Commands
|
|
196
|
+
|
|
197
|
+
### `mindrx list`
|
|
198
|
+
|
|
199
|
+
List all available cognitive states.
|
|
200
|
+
|
|
201
|
+
### `mindrx run`
|
|
202
|
+
|
|
203
|
+
| Option | Description |
|
|
204
|
+
|:-------|:------------|
|
|
205
|
+
| `--state, -s` | Cognitive state (default: sober) |
|
|
206
|
+
| `--provider, -p` | LLM provider (default: mindrx) |
|
|
207
|
+
| `--model, -m` | Specific model |
|
|
208
|
+
| `--json` | Output as JSON |
|
|
209
|
+
| `--no-stream` | Disable streaming |
|
|
210
|
+
|
|
211
|
+
### `mindrx repl`
|
|
212
|
+
|
|
213
|
+
| Command | Action |
|
|
214
|
+
|:--------|:-------|
|
|
215
|
+
| `/state <name>` | Switch cognitive state |
|
|
216
|
+
| `/list` | Show available states |
|
|
217
|
+
| `/clear` | Clear conversation |
|
|
218
|
+
| `/exit` | Exit REPL |
|
|
219
|
+
|
|
220
|
+
<br>
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
<div align="center">
|
|
225
|
+
|
|
226
|
+
MIT License
|
|
227
|
+
|
|
228
|
+
**This is fiction. The AI is not intoxicated.**
|
|
229
|
+
|
|
230
|
+
</div>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Provider, CompletionRequest, Response, Chunk } from '../types.js';
|
|
2
|
+
export declare class AnthropicProvider implements Provider {
|
|
3
|
+
name: string;
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options?: {
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
});
|
|
10
|
+
complete(request: CompletionRequest): Promise<Response>;
|
|
11
|
+
stream(request: CompletionRequest): AsyncIterable<Chunk>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=anthropic.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.d.ts","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEhF,qBAAa,iBAAkB,YAAW,QAAQ;IAChD,IAAI,SAAe;IACnB,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IAOvD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IA0BtD,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC;CAoBhE"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import Anthropic from '@anthropic-ai/sdk';
|
|
2
|
+
export class AnthropicProvider {
|
|
3
|
+
name = 'anthropic';
|
|
4
|
+
client;
|
|
5
|
+
defaultModel;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
this.client = new Anthropic({
|
|
8
|
+
apiKey: options.apiKey || process.env.ANTHROPIC_API_KEY,
|
|
9
|
+
});
|
|
10
|
+
this.defaultModel = options.model || 'claude-3-5-sonnet-20241022';
|
|
11
|
+
}
|
|
12
|
+
async complete(request) {
|
|
13
|
+
const model = request.model || this.defaultModel;
|
|
14
|
+
const message = await this.client.messages.create({
|
|
15
|
+
model,
|
|
16
|
+
max_tokens: request.parameters.max_tokens || 4096,
|
|
17
|
+
system: request.systemPrompt,
|
|
18
|
+
messages: [{ role: 'user', content: request.userPrompt }],
|
|
19
|
+
temperature: request.parameters.temperature,
|
|
20
|
+
top_p: request.parameters.top_p,
|
|
21
|
+
});
|
|
22
|
+
const textContent = message.content.find((c) => c.type === 'text');
|
|
23
|
+
return {
|
|
24
|
+
text: textContent?.type === 'text' ? textContent.text : '',
|
|
25
|
+
state: '',
|
|
26
|
+
model,
|
|
27
|
+
usage: {
|
|
28
|
+
promptTokens: message.usage.input_tokens,
|
|
29
|
+
completionTokens: message.usage.output_tokens,
|
|
30
|
+
totalTokens: message.usage.input_tokens + message.usage.output_tokens,
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
async *stream(request) {
|
|
35
|
+
const model = request.model || this.defaultModel;
|
|
36
|
+
const stream = this.client.messages.stream({
|
|
37
|
+
model,
|
|
38
|
+
max_tokens: request.parameters.max_tokens || 4096,
|
|
39
|
+
system: request.systemPrompt,
|
|
40
|
+
messages: [{ role: 'user', content: request.userPrompt }],
|
|
41
|
+
temperature: request.parameters.temperature,
|
|
42
|
+
top_p: request.parameters.top_p,
|
|
43
|
+
});
|
|
44
|
+
for await (const event of stream) {
|
|
45
|
+
if (event.type === 'content_block_delta' && event.delta.type === 'text_delta') {
|
|
46
|
+
yield { text: event.delta.text, done: false };
|
|
47
|
+
}
|
|
48
|
+
else if (event.type === 'message_stop') {
|
|
49
|
+
yield { text: '', done: true };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=anthropic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anthropic.js","sourceRoot":"","sources":["../../src/providers/anthropic.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,mBAAmB,CAAC;AAG1C,MAAM,OAAO,iBAAiB;IAC5B,IAAI,GAAG,WAAW,CAAC;IACX,MAAM,CAAY;IAClB,YAAY,CAAS;IAE7B,YAAY,UAA+C,EAAE;QAC3D,IAAI,CAAC,MAAM,GAAG,IAAI,SAAS,CAAC;YAC1B,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,iBAAiB;SACxD,CAAC,CAAC;QACH,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,KAAK,IAAI,4BAA4B,CAAC;IACpE,CAAC;IAED,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,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU,IAAI,IAAI;YACjD,MAAM,EAAE,OAAO,CAAC,YAAY;YAC5B,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE,CAAC;YACzD,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;YAC3C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;SAChC,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,IAAI,KAAK,CAAC,IAAI,KAAK,qBAAqB,IAAI,KAAK,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAC9E,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;YAChD,CAAC;iBAAM,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACzC,MAAM,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;YACjC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Provider, CompletionRequest, Response, Chunk } from '../types.js';
|
|
2
|
+
export declare class GoogleProvider implements Provider {
|
|
3
|
+
name: string;
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options?: {
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
});
|
|
10
|
+
complete(request: CompletionRequest): Promise<Response>;
|
|
11
|
+
stream(request: CompletionRequest): AsyncIterable<Chunk>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=google.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEhF,qBAAa,cAAe,YAAW,QAAQ;IAC7C,IAAI,SAAY;IAChB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IASvD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IA8BtD,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC;CAwBhE"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
export class GoogleProvider {
|
|
3
|
+
name = 'google';
|
|
4
|
+
client;
|
|
5
|
+
defaultModel;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
const apiKey = options.apiKey || process.env.GOOGLE_API_KEY;
|
|
8
|
+
this.client = new OpenAI({
|
|
9
|
+
apiKey,
|
|
10
|
+
baseURL: 'https://generativelanguage.googleapis.com/v1beta/openai',
|
|
11
|
+
});
|
|
12
|
+
this.defaultModel = options.model || 'gemini-1.5-flash';
|
|
13
|
+
}
|
|
14
|
+
async complete(request) {
|
|
15
|
+
const model = request.model || this.defaultModel;
|
|
16
|
+
const completion = await this.client.chat.completions.create({
|
|
17
|
+
model,
|
|
18
|
+
messages: [
|
|
19
|
+
{ role: 'system', content: request.systemPrompt },
|
|
20
|
+
{ role: 'user', content: request.userPrompt },
|
|
21
|
+
],
|
|
22
|
+
temperature: request.parameters.temperature,
|
|
23
|
+
top_p: request.parameters.top_p,
|
|
24
|
+
max_tokens: request.parameters.max_tokens,
|
|
25
|
+
});
|
|
26
|
+
const choice = completion.choices[0];
|
|
27
|
+
return {
|
|
28
|
+
text: choice?.message?.content || '',
|
|
29
|
+
state: '',
|
|
30
|
+
model,
|
|
31
|
+
usage: completion.usage
|
|
32
|
+
? {
|
|
33
|
+
promptTokens: completion.usage.prompt_tokens,
|
|
34
|
+
completionTokens: completion.usage.completion_tokens,
|
|
35
|
+
totalTokens: completion.usage.total_tokens,
|
|
36
|
+
}
|
|
37
|
+
: undefined,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
async *stream(request) {
|
|
41
|
+
const model = request.model || this.defaultModel;
|
|
42
|
+
const stream = await this.client.chat.completions.create({
|
|
43
|
+
model,
|
|
44
|
+
messages: [
|
|
45
|
+
{ role: 'system', content: request.systemPrompt },
|
|
46
|
+
{ role: 'user', content: request.userPrompt },
|
|
47
|
+
],
|
|
48
|
+
temperature: request.parameters.temperature,
|
|
49
|
+
top_p: request.parameters.top_p,
|
|
50
|
+
max_tokens: request.parameters.max_tokens,
|
|
51
|
+
stream: true,
|
|
52
|
+
});
|
|
53
|
+
for await (const chunk of stream) {
|
|
54
|
+
const delta = chunk.choices[0]?.delta?.content || '';
|
|
55
|
+
const done = chunk.choices[0]?.finish_reason !== null;
|
|
56
|
+
if (delta || done) {
|
|
57
|
+
yield { text: delta, done };
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=google.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.js","sourceRoot":"","sources":["../../src/providers/google.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,OAAO,cAAc;IACzB,IAAI,GAAG,QAAQ,CAAC;IACR,MAAM,CAAS;IACf,YAAY,CAAS;IAE7B,YAAY,UAA+C,EAAE;QAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;QAC5D,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CAAC;YACvB,MAAM;YACN,OAAO,EAA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G,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC;YACvD,KAAK;YACL,QAAQ,EAAE;gBACR,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,YAAY,EAAE;gBACjD,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,UAAU,EAAE;aAC9C;YACD,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;YAC3C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;YAC/B,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU;YACzC,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;QAEH,IAAI,KAAK,EAAE,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YACjC,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,IAAI,EAAE,CAAC;YACrD,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;YAEtD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;gBAClB,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;YAC9B,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
|
|
@@ -2,6 +2,9 @@ import type { Provider, ProviderName } from '../types.js';
|
|
|
2
2
|
export { OpenAIProvider } from './openai.js';
|
|
3
3
|
export { OllamaProvider } from './ollama.js';
|
|
4
4
|
export { MindRxProvider } from './mindrx.js';
|
|
5
|
+
export { AnthropicProvider } from './anthropic.js';
|
|
6
|
+
export { GoogleProvider } from './google.js';
|
|
7
|
+
export { XAIProvider } from './xai.js';
|
|
5
8
|
export interface ProviderOptions {
|
|
6
9
|
apiKey?: string;
|
|
7
10
|
baseUrl?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAQ1D,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,YAAY,EAClB,OAAO,GAAE,eAAoB,GAC5B,QAAQ,CAiBV"}
|
package/dist/providers/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import { OpenAIProvider } from './openai.js';
|
|
2
2
|
import { OllamaProvider } from './ollama.js';
|
|
3
3
|
import { MindRxProvider } from './mindrx.js';
|
|
4
|
+
import { AnthropicProvider } from './anthropic.js';
|
|
5
|
+
import { GoogleProvider } from './google.js';
|
|
6
|
+
import { XAIProvider } from './xai.js';
|
|
4
7
|
export { OpenAIProvider } from './openai.js';
|
|
5
8
|
export { OllamaProvider } from './ollama.js';
|
|
6
9
|
export { MindRxProvider } from './mindrx.js';
|
|
10
|
+
export { AnthropicProvider } from './anthropic.js';
|
|
11
|
+
export { GoogleProvider } from './google.js';
|
|
12
|
+
export { XAIProvider } from './xai.js';
|
|
7
13
|
export function createProvider(name, options = {}) {
|
|
8
14
|
switch (name) {
|
|
9
15
|
case 'openai':
|
|
@@ -13,8 +19,11 @@ export function createProvider(name, options = {}) {
|
|
|
13
19
|
case 'mindrx':
|
|
14
20
|
return new MindRxProvider(options);
|
|
15
21
|
case 'anthropic':
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
return new AnthropicProvider(options);
|
|
23
|
+
case 'google':
|
|
24
|
+
return new GoogleProvider(options);
|
|
25
|
+
case 'xai':
|
|
26
|
+
return new XAIProvider(options);
|
|
18
27
|
default:
|
|
19
28
|
throw new Error(`Unknown provider: ${name}`);
|
|
20
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAQvC,MAAM,UAAU,cAAc,CAC5B,IAAkB,EAClB,UAA2B,EAAE;IAE7B,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,QAAQ;YACX,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,KAAK,QAAQ;YACX,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,KAAK,WAAW;YACd,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,QAAQ;YACX,OAAO,IAAI,cAAc,CAAC,OAAO,CAAC,CAAC;QACrC,KAAK,KAAK;YACR,OAAO,IAAI,WAAW,CAAC,OAAO,CAAC,CAAC;QAClC;YACE,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;IACjD,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Provider, CompletionRequest, Response, Chunk } from '../types.js';
|
|
2
|
+
export declare class XAIProvider implements Provider {
|
|
3
|
+
name: string;
|
|
4
|
+
private client;
|
|
5
|
+
private defaultModel;
|
|
6
|
+
constructor(options?: {
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
});
|
|
10
|
+
complete(request: CompletionRequest): Promise<Response>;
|
|
11
|
+
stream(request: CompletionRequest): AsyncIterable<Chunk>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=xai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xai.d.ts","sourceRoot":"","sources":["../../src/providers/xai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,iBAAiB,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEhF,qBAAa,WAAY,YAAW,QAAQ;IAC1C,IAAI,SAAS;IACb,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;gBAEjB,OAAO,GAAE;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO;IASvD,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAgCtD,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC;CA0BhE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
export class XAIProvider {
|
|
3
|
+
name = 'xai';
|
|
4
|
+
client;
|
|
5
|
+
defaultModel;
|
|
6
|
+
constructor(options = {}) {
|
|
7
|
+
const apiKey = options.apiKey || process.env.XAI_API_KEY;
|
|
8
|
+
this.client = new OpenAI({
|
|
9
|
+
apiKey,
|
|
10
|
+
baseURL: 'https://api.x.ai/v1',
|
|
11
|
+
});
|
|
12
|
+
this.defaultModel = options.model || 'grok-2-latest';
|
|
13
|
+
}
|
|
14
|
+
async complete(request) {
|
|
15
|
+
const model = request.model || this.defaultModel;
|
|
16
|
+
const completion = await this.client.chat.completions.create({
|
|
17
|
+
model,
|
|
18
|
+
messages: [
|
|
19
|
+
{ role: 'system', content: request.systemPrompt },
|
|
20
|
+
{ role: 'user', content: request.userPrompt },
|
|
21
|
+
],
|
|
22
|
+
temperature: request.parameters.temperature,
|
|
23
|
+
top_p: request.parameters.top_p,
|
|
24
|
+
frequency_penalty: request.parameters.frequency_penalty,
|
|
25
|
+
presence_penalty: request.parameters.presence_penalty,
|
|
26
|
+
max_tokens: request.parameters.max_tokens,
|
|
27
|
+
});
|
|
28
|
+
const choice = completion.choices[0];
|
|
29
|
+
return {
|
|
30
|
+
text: choice?.message?.content || '',
|
|
31
|
+
state: '',
|
|
32
|
+
model,
|
|
33
|
+
usage: completion.usage
|
|
34
|
+
? {
|
|
35
|
+
promptTokens: completion.usage.prompt_tokens,
|
|
36
|
+
completionTokens: completion.usage.completion_tokens,
|
|
37
|
+
totalTokens: completion.usage.total_tokens,
|
|
38
|
+
}
|
|
39
|
+
: undefined,
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
async *stream(request) {
|
|
43
|
+
const model = request.model || this.defaultModel;
|
|
44
|
+
const stream = await this.client.chat.completions.create({
|
|
45
|
+
model,
|
|
46
|
+
messages: [
|
|
47
|
+
{ role: 'system', content: request.systemPrompt },
|
|
48
|
+
{ role: 'user', content: request.userPrompt },
|
|
49
|
+
],
|
|
50
|
+
temperature: request.parameters.temperature,
|
|
51
|
+
top_p: request.parameters.top_p,
|
|
52
|
+
frequency_penalty: request.parameters.frequency_penalty,
|
|
53
|
+
presence_penalty: request.parameters.presence_penalty,
|
|
54
|
+
max_tokens: request.parameters.max_tokens,
|
|
55
|
+
stream: true,
|
|
56
|
+
});
|
|
57
|
+
for await (const chunk of stream) {
|
|
58
|
+
const delta = chunk.choices[0]?.delta?.content || '';
|
|
59
|
+
const done = chunk.choices[0]?.finish_reason !== null;
|
|
60
|
+
if (delta || done) {
|
|
61
|
+
yield { text: delta, done };
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=xai.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xai.js","sourceRoot":"","sources":["../../src/providers/xai.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAG5B,MAAM,OAAO,WAAW;IACtB,IAAI,GAAG,KAAK,CAAC;IACL,MAAM,CAAS;IACf,YAAY,CAAS;IAE7B,YAAY,UAA+C,EAAE;QAC3D,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;QACzD,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'openai' | 'anthropic' | 'ollama' | 'mindrx';
|
|
2
|
+
export type ProviderName = 'openai' | 'anthropic' | 'google' | 'xai' | 'ollama' | 'mindrx';
|
|
3
3
|
export interface MindRxOptions {
|
|
4
4
|
state?: string;
|
|
5
5
|
provider?: ProviderName;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEpE,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,QAAQ,GAAG,KAAK,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAE3F,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,eAAe,EAAE,CAAC;CAClC;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE;QACN,YAAY,EAAE,MAAM,CAAC;QACrB,gBAAgB,EAAE,MAAM,CAAC;QACzB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH;AAED,MAAM,WAAW,KAAK;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,eAAe,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACxD,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;CAC1D;AAED,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mindrx",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Cognitive state simulation toolkit for AI agents",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Cognitive state simulation toolkit for AI agents. Run LLMs in altered mental states.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -15,15 +15,19 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"files": [
|
|
18
|
-
"dist"
|
|
18
|
+
"dist",
|
|
19
|
+
"README.md"
|
|
19
20
|
],
|
|
20
21
|
"scripts": {
|
|
21
22
|
"build": "tsc",
|
|
22
23
|
"dev": "tsc --watch",
|
|
23
24
|
"clean": "rm -rf dist",
|
|
24
|
-
"test": "node --test"
|
|
25
|
+
"test": "node --test",
|
|
26
|
+
"prepublishOnly": "npm run build"
|
|
25
27
|
},
|
|
26
28
|
"dependencies": {
|
|
29
|
+
"@anthropic-ai/sdk": "^0.35.0",
|
|
30
|
+
"@google/generative-ai": "^0.21.0",
|
|
27
31
|
"mindrx-core": "^0.1.1",
|
|
28
32
|
"openai": "^4.20.0"
|
|
29
33
|
},
|
|
@@ -31,6 +35,9 @@
|
|
|
31
35
|
"typescript": "^5.3.0",
|
|
32
36
|
"@types/node": "^20.0.0"
|
|
33
37
|
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18.0.0"
|
|
40
|
+
},
|
|
34
41
|
"keywords": [
|
|
35
42
|
"ai",
|
|
36
43
|
"cognitive",
|
|
@@ -39,11 +46,27 @@
|
|
|
39
46
|
"prompt-engineering",
|
|
40
47
|
"chatgpt",
|
|
41
48
|
"openai",
|
|
42
|
-
"
|
|
49
|
+
"anthropic",
|
|
50
|
+
"claude",
|
|
51
|
+
"gemini",
|
|
52
|
+
"ollama",
|
|
53
|
+
"grok",
|
|
54
|
+
"ai-agents",
|
|
55
|
+
"mental-states",
|
|
56
|
+
"cognitive-states",
|
|
57
|
+
"altered-states",
|
|
58
|
+
"prompt",
|
|
59
|
+
"sdk",
|
|
60
|
+
"cli"
|
|
43
61
|
],
|
|
62
|
+
"author": "MindRx",
|
|
44
63
|
"license": "MIT",
|
|
45
64
|
"repository": {
|
|
46
65
|
"type": "git",
|
|
47
|
-
"url": "https://github.com/
|
|
48
|
-
}
|
|
66
|
+
"url": "git+https://github.com/MindRx-Project/mindrx.git"
|
|
67
|
+
},
|
|
68
|
+
"bugs": {
|
|
69
|
+
"url": "https://github.com/MindRx-Project/mindrx/issues"
|
|
70
|
+
},
|
|
71
|
+
"homepage": "https://github.com/MindRx-Project/mindrx#readme"
|
|
49
72
|
}
|