promptgun 1.4.1 → 1.4.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/README.md +30 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -117,6 +117,32 @@ You can also avoid writing a file altogether and get the byte array directly:
|
|
|
117
117
|
const byteArray = await ai.image('A black hole')
|
|
118
118
|
```
|
|
119
119
|
|
|
120
|
+
## System and User Prompts
|
|
121
|
+
|
|
122
|
+
By default, `.chat()` with a string creates a user message. To add system instructions, pass message objects:
|
|
123
|
+
|
|
124
|
+
```typescript
|
|
125
|
+
const response = await ai
|
|
126
|
+
.chat(
|
|
127
|
+
{system: 'You are a helpful assistant that speaks like a pirate'},
|
|
128
|
+
{user: 'Tell me about the weather'}
|
|
129
|
+
)
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
This works with structured output too:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
const response = await ai
|
|
136
|
+
.chat(
|
|
137
|
+
{system: 'You are a JSON API that returns restaurant data'},
|
|
138
|
+
{user: 'I want Italian restaurants in Rome'}
|
|
139
|
+
)
|
|
140
|
+
.getObject(o => o
|
|
141
|
+
.hasString('name')
|
|
142
|
+
.hasString('address')
|
|
143
|
+
)
|
|
144
|
+
```
|
|
145
|
+
|
|
120
146
|
## Conversations
|
|
121
147
|
With `ai.createConversation()` you can create a dedicated client
|
|
122
148
|
for a single conversation. Every prompt you do gets appended
|
|
@@ -300,14 +326,15 @@ const user = await ai
|
|
|
300
326
|
|
|
301
327
|
## Model Selection
|
|
302
328
|
|
|
303
|
-
Switch models using either a string
|
|
304
|
-
|
|
329
|
+
By default, Promptgun uses GPT-5. Switch models using either a string:
|
|
305
330
|
```typescript
|
|
306
331
|
// Using a string
|
|
307
332
|
const result = await ai
|
|
308
333
|
.chat('Hello')
|
|
309
334
|
.model('gpt-5')
|
|
310
|
-
|
|
335
|
+
```
|
|
336
|
+
or the `AiModel` enum:
|
|
337
|
+
```typescript
|
|
311
338
|
// Using the enum - get in-place documentation!
|
|
312
339
|
const result = await ai
|
|
313
340
|
.chat('Hello')
|