promptgun 0.16.4 → 0.16.5

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
@@ -83,6 +83,32 @@ You can also avoid writing a file altogether and get the byte array directly:
83
83
  const byteArray = await ai.image('A black hole')
84
84
  ```
85
85
 
86
+ ## Conversations
87
+ With `ai.createConversation()` you can create a dedicated client
88
+ for a single conversation. Every prompt you do gets appended
89
+ to the message history. This saves you from having to re-add the
90
+ old messages to the message history every time you want to do a
91
+ new prompt while maintaining the context.
92
+ ```typescript
93
+ const conversation = ai.createConversation()
94
+ await conversation
95
+ .chat('Give 5 top bars in London')
96
+ .getArray(d => d
97
+ .object(obj => obj
98
+ .hasString('name')
99
+ .hasString('address', /* optional hint */ 'Street and address only!')
100
+ )
101
+ )
102
+ await conversation
103
+ .chat('Give 5 more')
104
+ .getArray(d => d
105
+ .object(obj => obj
106
+ .hasString('name')
107
+ .hasString('address', /* optional hint */ 'Street and address only!')
108
+ )
109
+ )
110
+ ```
111
+
86
112
  ## Setup
87
113
  Before you do any prompts, do:
88
114
  ```typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "promptgun",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
4
4
  "type": "module",
5
5
  "exports": "./build/index.js",
6
6
  "types": "./build/index.d.ts",