@albatrossai/albatross-sdk 0.2.0-b → 0.2.1
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 +53 -13
- package/dist/index.cjs +6 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,23 +1,63 @@
|
|
|
1
|
-
# albatross-sdk
|
|
1
|
+
# @albatrossai/albatross-sdk
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@albatrossai/albatross-sdk)
|
|
4
|
+
[](https://albatross-core.github.io/fake-ecommerce/)
|
|
4
5
|
|
|
5
|
-
-
|
|
6
|
-
- **validation**: zod (runtime type validation)
|
|
7
|
-
- **documentation**: jsdoc + TypeDoc (future)
|
|
6
|
+
Official TypeScript/JavaScript SDK for Albatross AI - intelligent content selection, recommendations, and personalization.
|
|
8
7
|
|
|
9
|
-
##
|
|
8
|
+
## Installation
|
|
10
9
|
|
|
11
10
|
```bash
|
|
12
|
-
|
|
13
|
-
bun run dev # watch mode
|
|
14
|
-
bun run typecheck # type checking
|
|
11
|
+
npm install @albatrossai/albatross-sdk
|
|
15
12
|
```
|
|
16
13
|
|
|
17
|
-
##
|
|
14
|
+
## Quick Start
|
|
18
15
|
|
|
19
16
|
```typescript
|
|
20
|
-
import Client from 'albatross-sdk';
|
|
17
|
+
import { Client } from '@albatrossai/albatross-sdk';
|
|
21
18
|
|
|
22
|
-
const client = new Client(token,
|
|
23
|
-
|
|
19
|
+
const client = new Client('your-api-token', 'your-tenant-id');
|
|
20
|
+
|
|
21
|
+
// Search
|
|
22
|
+
const results = await client.search('query', 'use-case', { limit: 10 });
|
|
23
|
+
|
|
24
|
+
// Recommendations
|
|
25
|
+
const recs = await client.getRecommendations('use-case', {
|
|
26
|
+
user_id: 'user-123',
|
|
27
|
+
limit: 10
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Track events
|
|
31
|
+
await client.putEvent({
|
|
32
|
+
eventType: 'view',
|
|
33
|
+
payload: { user_id: 'user-123', item_id: 'item-456' }
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Documentation
|
|
38
|
+
|
|
39
|
+
**📖 [Complete API Documentation](https://albatross-core.github.io/fake-ecommerce/)**
|
|
40
|
+
|
|
41
|
+
The full API reference with detailed examples, type definitions, and method documentation is available in the auto-generated TypeDoc documentation.
|
|
42
|
+
|
|
43
|
+
### Key Features
|
|
44
|
+
|
|
45
|
+
- 🎯 Content selection & search (text, image, vector)
|
|
46
|
+
- 🔮 AI predictions & recommendations
|
|
47
|
+
- 📊 Event tracking
|
|
48
|
+
- 📦 Catalog management
|
|
49
|
+
- 🛡️ Full TypeScript support
|
|
50
|
+
- 🔄 Auto-retry with exponential backoff
|
|
51
|
+
|
|
52
|
+
## Development
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
bun install # Install dependencies
|
|
56
|
+
bun run build # Build the SDK
|
|
57
|
+
bun test # Run tests
|
|
58
|
+
bun run docs # Generate documentation
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## License
|
|
62
|
+
|
|
63
|
+
MIT
|
package/dist/index.cjs
CHANGED
|
@@ -1029,7 +1029,7 @@ var Client = class {
|
|
|
1029
1029
|
if (request.options?.image) {
|
|
1030
1030
|
this.validateImageSize(request.options.image);
|
|
1031
1031
|
}
|
|
1032
|
-
const url = `${this.baseUrl}/
|
|
1032
|
+
const url = `${this.baseUrl}/prediction/content-selection`;
|
|
1033
1033
|
return this.makeRequest({
|
|
1034
1034
|
method: "POST",
|
|
1035
1035
|
url,
|
|
@@ -1474,7 +1474,7 @@ var Client = class {
|
|
|
1474
1474
|
*
|
|
1475
1475
|
* @example
|
|
1476
1476
|
* ```typescript
|
|
1477
|
-
* const
|
|
1477
|
+
* const ranking = await client.ranking({
|
|
1478
1478
|
* useCase: { uuid: "ranking-use-case" },
|
|
1479
1479
|
* context: { user_id: "user-123" },
|
|
1480
1480
|
* actions: [
|
|
@@ -1484,9 +1484,9 @@ var Client = class {
|
|
|
1484
1484
|
* });
|
|
1485
1485
|
* ```
|
|
1486
1486
|
*/
|
|
1487
|
-
|
|
1487
|
+
ranking = async (payload) => {
|
|
1488
1488
|
PredictionPayloadSchema.parse(payload);
|
|
1489
|
-
const url = `${this.baseUrl}/
|
|
1489
|
+
const url = `${this.baseUrl}/prediction/ranker`;
|
|
1490
1490
|
const data = this.predictionPreProcessing(payload);
|
|
1491
1491
|
return this.makeRequest({
|
|
1492
1492
|
method: "POST",
|
|
@@ -1501,7 +1501,7 @@ var Client = class {
|
|
|
1501
1501
|
* submits outcome feedback for a previous prediction.
|
|
1502
1502
|
*
|
|
1503
1503
|
* @param payload - feedback payload
|
|
1504
|
-
* @param payload.predictionUuid - id of the prediction to provide feedback for (from
|
|
1504
|
+
* @param payload.predictionUuid - id of the prediction to provide feedback for (from ranking() response)
|
|
1505
1505
|
* @param payload.value - feedback data (e.g., { reward: 1 }, { clicked: true }, { rating: 4.5 })
|
|
1506
1506
|
* @param payload.modelUuid - optional specific model uuid to send feedback to
|
|
1507
1507
|
*
|
|
@@ -1513,7 +1513,7 @@ var Client = class {
|
|
|
1513
1513
|
*
|
|
1514
1514
|
* @example
|
|
1515
1515
|
* ```typescript
|
|
1516
|
-
* const pred = await client.
|
|
1516
|
+
* const pred = await client.ranking({...});
|
|
1517
1517
|
* // later, after user interaction
|
|
1518
1518
|
* await client.feedback({
|
|
1519
1519
|
* predictionUuid: pred.id,
|