@aui.io/aui-client 1.2.28 → 1.2.29
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 +199 -5
- package/dist/cjs/Client.js +2 -2
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/Client.mjs +2 -2
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,9 +144,7 @@ The `ApolloClient` constructor accepts the following options:
|
|
|
144
144
|
|
|
145
145
|
```typescript
|
|
146
146
|
interface ApolloClient.Options {
|
|
147
|
-
//
|
|
148
|
-
baseUrl?: string; // Custom base URL (e.g., staging)
|
|
149
|
-
environment?: ApolloEnvironment; // Or use predefined environment
|
|
147
|
+
environment?: ApolloEnvironment; // Use predefined environment (Gcp or Azure)
|
|
150
148
|
|
|
151
149
|
// Authentication (required)
|
|
152
150
|
networkApiKey: string; // Your API key (x-network-api-key header)
|
|
@@ -242,12 +240,34 @@ Submit a new message to an existing task (non-streaming).
|
|
|
242
240
|
const messageResponse = await client.controllerApi.sendMessage({
|
|
243
241
|
task_id: string, // Task identifier
|
|
244
242
|
text: string, // Message text
|
|
245
|
-
is_external_api?: boolean // Optional: mark as external API call
|
|
243
|
+
is_external_api?: boolean, // Optional: mark as external API call
|
|
244
|
+
context?: { // Optional: additional context
|
|
245
|
+
url?: string,
|
|
246
|
+
lead_details?: Record<string, any>,
|
|
247
|
+
welcome_message?: string
|
|
248
|
+
},
|
|
249
|
+
agent_variables?: Record<string, unknown> // Optional: custom agent variables (NEW in v1.2.28)
|
|
246
250
|
});
|
|
247
251
|
|
|
248
252
|
// Returns: Message - Complete agent response with optional product cards
|
|
249
253
|
```
|
|
250
254
|
|
|
255
|
+
**New in v1.2.28:** The `agent_variables` parameter allows you to pass custom context to the agent:
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
// Example: Send message with agent variables
|
|
259
|
+
const response = await client.controllerApi.sendMessage({
|
|
260
|
+
task_id: 'your-task-id',
|
|
261
|
+
text: 'What products do you recommend?',
|
|
262
|
+
is_external_api: true,
|
|
263
|
+
agent_variables: {
|
|
264
|
+
context: 'User is interested in electric vehicles',
|
|
265
|
+
user_preference: 'eco-friendly',
|
|
266
|
+
budget: 'mid-range'
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
```
|
|
270
|
+
|
|
251
271
|
#### `listUserTasks(request)` - List User Tasks
|
|
252
272
|
Retrieve all tasks for a specific user with pagination.
|
|
253
273
|
|
|
@@ -272,6 +292,58 @@ const metadata = await client.controllerApi.getProductMetadata({
|
|
|
272
292
|
// Returns: Record<string, any> - Product metadata object
|
|
273
293
|
```
|
|
274
294
|
|
|
295
|
+
#### `getAgentContext(request)` - Get Agent Context (NEW in v1.2.28)
|
|
296
|
+
Retrieve the agent's context configuration including parameters, entities, and static context.
|
|
297
|
+
|
|
298
|
+
```typescript
|
|
299
|
+
const agentContext = await client.controllerApi.getAgentContext({
|
|
300
|
+
task_id: 'your-task-id',
|
|
301
|
+
query: 'test context'
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
// Returns: CreateTopicRequestBody - Agent context with:
|
|
305
|
+
// - title: string
|
|
306
|
+
// - params: TaskParameter[]
|
|
307
|
+
// - entities: TaskTopicEntity[]
|
|
308
|
+
// - static_context: string
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
**Example:**
|
|
312
|
+
|
|
313
|
+
```typescript
|
|
314
|
+
// Get agent context to understand available parameters
|
|
315
|
+
const context = await client.controllerApi.getAgentContext({
|
|
316
|
+
task_id: 'your-task-id',
|
|
317
|
+
query: 'test context'
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
console.log('Agent Title:', context.title);
|
|
321
|
+
console.log('Available Parameters:', context.params?.length);
|
|
322
|
+
console.log('Entities:', context.entities?.length);
|
|
323
|
+
console.log('Static Context:', context.static_context);
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
#### `getDirectFollowupSuggestions(taskId)` - Get Direct Followup Suggestions (NEW in v1.2.28)
|
|
327
|
+
Retrieve AI-generated followup suggestions for a specific task.
|
|
328
|
+
|
|
329
|
+
```typescript
|
|
330
|
+
const suggestions: string[] = await client.controllerApi.getDirectFollowupSuggestions('your-task-id');
|
|
331
|
+
|
|
332
|
+
// Returns: string[] - Array of suggested followup questions
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
**Example:**
|
|
336
|
+
|
|
337
|
+
```typescript
|
|
338
|
+
// Get followup suggestions for a task
|
|
339
|
+
const suggestions: string[] = await client.controllerApi.getDirectFollowupSuggestions('your-task-id');
|
|
340
|
+
|
|
341
|
+
console.log('Suggested followups:');
|
|
342
|
+
suggestions.forEach((suggestion, index) => {
|
|
343
|
+
console.log(`${index + 1}. ${suggestion}`);
|
|
344
|
+
});
|
|
345
|
+
```
|
|
346
|
+
|
|
275
347
|
---
|
|
276
348
|
|
|
277
349
|
### WebSocket API
|
|
@@ -479,6 +551,128 @@ async function fetchProductMetadata(productLink: string) {
|
|
|
479
551
|
fetchProductMetadata('https://www.example.com/product/12345');
|
|
480
552
|
```
|
|
481
553
|
|
|
554
|
+
### Send Message with Agent Variables (NEW in v1.2.28)
|
|
555
|
+
|
|
556
|
+
```typescript
|
|
557
|
+
import { ApolloClient } from '@aui.io/aui-client';
|
|
558
|
+
|
|
559
|
+
const client = new ApolloClient({
|
|
560
|
+
networkApiKey: 'API_KEY_YOUR_KEY_HERE'
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
async function sendContextualMessage(taskId: string, message: string, userContext: Record<string, unknown>) {
|
|
564
|
+
try {
|
|
565
|
+
// Send a message with custom agent variables for contextual responses
|
|
566
|
+
const response = await client.controllerApi.sendMessage({
|
|
567
|
+
task_id: taskId,
|
|
568
|
+
text: message,
|
|
569
|
+
is_external_api: true,
|
|
570
|
+
agent_variables: userContext
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
console.log('Agent Response:', response.text);
|
|
574
|
+
|
|
575
|
+
// The agent will use the provided context to tailor its response
|
|
576
|
+
if (response.cards && response.cards.length > 0) {
|
|
577
|
+
console.log('Recommended products:', response.cards.length);
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
return response;
|
|
581
|
+
} catch (error) {
|
|
582
|
+
console.error('Error sending message:', error);
|
|
583
|
+
throw error;
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
// Example usage - provide context about user preferences
|
|
588
|
+
sendContextualMessage('task-123', 'What do you recommend?', {
|
|
589
|
+
context: 'User is browsing electric vehicles',
|
|
590
|
+
user_preference: 'eco-friendly',
|
|
591
|
+
budget_range: '$30,000 - $50,000',
|
|
592
|
+
location: 'California'
|
|
593
|
+
});
|
|
594
|
+
```
|
|
595
|
+
|
|
596
|
+
### Get Agent Context (NEW in v1.2.28)
|
|
597
|
+
|
|
598
|
+
```typescript
|
|
599
|
+
import { ApolloClient } from '@aui.io/aui-client';
|
|
600
|
+
|
|
601
|
+
const client = new ApolloClient({
|
|
602
|
+
networkApiKey: 'API_KEY_YOUR_KEY_HERE'
|
|
603
|
+
});
|
|
604
|
+
|
|
605
|
+
async function exploreAgentCapabilities() {
|
|
606
|
+
try {
|
|
607
|
+
// Get the agent's context configuration
|
|
608
|
+
const context = await client.controllerApi.getAgentContext({
|
|
609
|
+
task_id: 'your-task-id',
|
|
610
|
+
query: 'test context'
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
console.log('Agent Configuration:');
|
|
614
|
+
console.log(' Title:', context.title);
|
|
615
|
+
console.log(' Static Context:', context.static_context);
|
|
616
|
+
|
|
617
|
+
// Explore available parameters
|
|
618
|
+
if (context.params && context.params.length > 0) {
|
|
619
|
+
console.log('\nAvailable Parameters:');
|
|
620
|
+
context.params.forEach(param => {
|
|
621
|
+
console.log(` - ${param.title}: ${param.param}`);
|
|
622
|
+
});
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
// Explore entities
|
|
626
|
+
if (context.entities && context.entities.length > 0) {
|
|
627
|
+
console.log('\nConfigured Entities:', context.entities.length);
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
return context;
|
|
631
|
+
} catch (error) {
|
|
632
|
+
console.error('Error getting agent context:', error);
|
|
633
|
+
throw error;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
exploreAgentCapabilities();
|
|
638
|
+
```
|
|
639
|
+
|
|
640
|
+
### Get Direct Followup Suggestions (NEW in v1.2.28)
|
|
641
|
+
|
|
642
|
+
```typescript
|
|
643
|
+
import { ApolloClient } from '@aui.io/aui-client';
|
|
644
|
+
|
|
645
|
+
const client = new ApolloClient({
|
|
646
|
+
networkApiKey: 'API_KEY_YOUR_KEY_HERE'
|
|
647
|
+
});
|
|
648
|
+
|
|
649
|
+
async function getSuggestedQuestions(taskId: string) {
|
|
650
|
+
try {
|
|
651
|
+
// Get AI-generated followup suggestions based on conversation context
|
|
652
|
+
const suggestions = await client.controllerApi.getDirectFollowupSuggestions(taskId);
|
|
653
|
+
|
|
654
|
+
console.log('Suggested followup questions:');
|
|
655
|
+
suggestions.forEach((suggestion, index) => {
|
|
656
|
+
console.log(` ${index + 1}. ${suggestion}`);
|
|
657
|
+
});
|
|
658
|
+
|
|
659
|
+
// Use these suggestions to guide the user's next interaction
|
|
660
|
+
return suggestions;
|
|
661
|
+
} catch (error) {
|
|
662
|
+
console.error('Error getting suggestions:', error);
|
|
663
|
+
throw error;
|
|
664
|
+
}
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
// Example usage
|
|
668
|
+
getSuggestedQuestions('task-123');
|
|
669
|
+
// Output:
|
|
670
|
+
// Suggested followup questions:
|
|
671
|
+
// 1. "What colors are available?"
|
|
672
|
+
// 2. "Do you offer financing options?"
|
|
673
|
+
// 3. "Can I schedule a test drive?"
|
|
674
|
+
```
|
|
675
|
+
|
|
482
676
|
## 🔧 Advanced Configuration
|
|
483
677
|
|
|
484
678
|
### Custom Timeout and Retries
|
|
@@ -634,7 +828,7 @@ const client = new ApolloClient({
|
|
|
634
828
|
});
|
|
635
829
|
|
|
636
830
|
// The key should start with "API_KEY_"
|
|
637
|
-
// Example:
|
|
831
|
+
// Example: API_KEY_01K------
|
|
638
832
|
```
|
|
639
833
|
|
|
640
834
|
### CORS Errors (Browser Only)
|
package/dist/cjs/Client.js
CHANGED
|
@@ -45,8 +45,8 @@ class ApolloClient {
|
|
|
45
45
|
"x-network-api-key": _options === null || _options === void 0 ? void 0 : _options.networkApiKey,
|
|
46
46
|
"X-Fern-Language": "JavaScript",
|
|
47
47
|
"X-Fern-SDK-Name": "@aui.io/aui-client",
|
|
48
|
-
"X-Fern-SDK-Version": "1.2.
|
|
49
|
-
"User-Agent": "@aui.io/aui-client/1.2.
|
|
48
|
+
"X-Fern-SDK-Version": "1.2.29",
|
|
49
|
+
"User-Agent": "@aui.io/aui-client/1.2.29",
|
|
50
50
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
51
51
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
52
52
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.2.
|
|
1
|
+
export declare const SDK_VERSION = "1.2.29";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/Client.mjs
CHANGED
|
@@ -9,8 +9,8 @@ export class ApolloClient {
|
|
|
9
9
|
"x-network-api-key": _options === null || _options === void 0 ? void 0 : _options.networkApiKey,
|
|
10
10
|
"X-Fern-Language": "JavaScript",
|
|
11
11
|
"X-Fern-SDK-Name": "@aui.io/aui-client",
|
|
12
|
-
"X-Fern-SDK-Version": "1.2.
|
|
13
|
-
"User-Agent": "@aui.io/aui-client/1.2.
|
|
12
|
+
"X-Fern-SDK-Version": "1.2.29",
|
|
13
|
+
"User-Agent": "@aui.io/aui-client/1.2.29",
|
|
14
14
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
15
15
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
16
16
|
}, _options === null || _options === void 0 ? void 0 : _options.headers) });
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "1.2.
|
|
1
|
+
export declare const SDK_VERSION = "1.2.29";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "1.2.
|
|
1
|
+
export const SDK_VERSION = "1.2.29";
|