ai-publish-sdk 1.7.0 → 1.8.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 +33 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,10 +88,20 @@ generateMessage(prompt: string, options: GenerateMessageOptions): Promise<string
|
|
|
88
88
|
interface GenerateMessageOptions {
|
|
89
89
|
withPageContext?: boolean // include current page content as context
|
|
90
90
|
systemPrompt?: string // guide AI behavior
|
|
91
|
-
model?: string // model name from getAllowedModels()
|
|
91
|
+
model?: string // model name from getAllowedModels(); omit for default
|
|
92
92
|
}
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
Example — use a specific model from `getAllowedModels()`:
|
|
96
|
+
|
|
97
|
+
```typescript
|
|
98
|
+
const { models, defaultModel } = await getAllowedModels()
|
|
99
|
+
const response = await generateMessage('Summarize this page', {
|
|
100
|
+
withPageContext: true,
|
|
101
|
+
model: models[0], // or defaultModel
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
95
105
|
### getBrandingAssets()
|
|
96
106
|
|
|
97
107
|
Get branding assets for white-label styling.
|
|
@@ -116,6 +126,28 @@ Emit structured analytics events from your app. The host auto-populates `timesta
|
|
|
116
126
|
|
|
117
127
|
```typescript
|
|
118
128
|
trackEvent(params: TrackEventParams): Promise<void>
|
|
129
|
+
|
|
130
|
+
interface TrackEventParams {
|
|
131
|
+
eventName: SnakeCase<string> // required — snake_case identifier (e.g. 'quiz_completed')
|
|
132
|
+
additionalDetails?: TrackEventDetails // optional — primitive-valued bag, one level of nesting allowed
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
type TrackEventDetailValue = string | number | boolean | null
|
|
136
|
+
|
|
137
|
+
type TrackEventDetails = Record<
|
|
138
|
+
string,
|
|
139
|
+
TrackEventDetailValue | Record<string, TrackEventDetailValue>
|
|
140
|
+
>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Only `eventName` is required. Example:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
await trackEvent({ eventName: 'quiz_completed' })
|
|
147
|
+
await trackEvent({
|
|
148
|
+
eventName: 'quiz_completed',
|
|
149
|
+
additionalDetails: { score: 8, total: 10, module: 'phishing' },
|
|
150
|
+
})
|
|
119
151
|
```
|
|
120
152
|
|
|
121
153
|
## Device API
|