promptgun 1.4.1 → 1.4.2

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 (2) hide show
  1. package/README.md +26 -0
  2. 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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgun",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "type": "module",
5
5
  "exports": "./build/index.js",
6
6
  "types": "./build/index.d.ts",