@personize/sdk 0.6.5 → 0.6.6
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 +21 -0
- package/dist/client.js +7 -1
- package/dist/types.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -109,6 +109,27 @@ const ctx = await client.ai.smartGuidelines({
|
|
|
109
109
|
console.log(ctx.data.compiledContext);
|
|
110
110
|
```
|
|
111
111
|
|
|
112
|
+
#### Content Budget
|
|
113
|
+
|
|
114
|
+
Control how much guideline content is delivered:
|
|
115
|
+
|
|
116
|
+
```typescript
|
|
117
|
+
const result = await client.ai.smartGuidelines({
|
|
118
|
+
message: "write a cold email",
|
|
119
|
+
maxContentTokens: 5000, // deliver ~2-3 full guidelines, rest as summaries
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
// Demoted guidelines (over budget) returned with id + description for follow-up
|
|
123
|
+
if (result.data.budgetMetadata?.demotedGuidelines) {
|
|
124
|
+
for (const g of result.data.budgetMetadata.demotedGuidelines) {
|
|
125
|
+
// Fetch specific section: client.guidelines.getSection(g.id, { header: "Cold Email" })
|
|
126
|
+
console.log(`${g.name}: ${g.description} — sections: ${g.sections.join(', ')}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Default: 10,000 tokens. Guidelines too large for the budget are automatically trimmed to relevant sections. Remaining guidelines are returned as summaries with `id`, `description`, and `sections[]` for follow-up via `client.guidelines.getSection()`.
|
|
132
|
+
|
|
112
133
|
### Prompt Execution
|
|
113
134
|
|
|
114
135
|
```typescript
|
package/dist/client.js
CHANGED
|
@@ -153,7 +153,13 @@ class Personize {
|
|
|
153
153
|
* POST /api/v1/ai/smart-guidelines — Smart guidelines routing. Selects relevant organizational guidelines for a task.
|
|
154
154
|
*/
|
|
155
155
|
smartGuidelines: async (options) => {
|
|
156
|
-
|
|
156
|
+
// Normalize snake_case alias → camelCase
|
|
157
|
+
const { max_content_tokens, ...rest } = options;
|
|
158
|
+
const normalized = {
|
|
159
|
+
...rest,
|
|
160
|
+
maxContentTokens: rest.maxContentTokens ?? max_content_tokens,
|
|
161
|
+
};
|
|
162
|
+
const response = await this.client.post('/api/v1/ai/smart-guidelines', normalized);
|
|
157
163
|
return response.data;
|
|
158
164
|
},
|
|
159
165
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -292,6 +292,10 @@ export interface SmartGuidelinesOptions {
|
|
|
292
292
|
minScore?: number;
|
|
293
293
|
/** Session ID for conversation continuity. */
|
|
294
294
|
sessionId?: string;
|
|
295
|
+
/** Maximum tokens of guideline content to deliver. The system selects the most relevant guidelines and trims to fit. Default: 10000. */
|
|
296
|
+
maxContentTokens?: number;
|
|
297
|
+
/** @deprecated Use maxContentTokens instead. */
|
|
298
|
+
max_content_tokens?: number;
|
|
295
299
|
}
|
|
296
300
|
/** @deprecated Use SmartGuidelinesOptions instead. */
|
|
297
301
|
export type SmartContextOptions = SmartGuidelinesOptions;
|