@adzenai/ai 1.0.0 → 1.1.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 +11 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -21,6 +21,7 @@ import { AdzenAsyncMiddleware } from "@adzenai/ai/copilotkit";
|
|
|
21
21
|
|
|
22
22
|
const adzen = new AdzenAsyncMiddleware({
|
|
23
23
|
apiKey: process.env.ADZEN_API_KEY!,
|
|
24
|
+
location: process.env.ADZEN_LOCATION,
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
for await (const event of agentEventStream) {
|
|
@@ -49,7 +50,7 @@ dispatchPlacementEvents(events);
|
|
|
49
50
|
|
|
50
51
|
| Path | Environment | Provides |
|
|
51
52
|
| --- | --- | --- |
|
|
52
|
-
| `@adzenai/ai` | Any | Core type re-exports (`AdzenPlacement`, `
|
|
53
|
+
| `@adzenai/ai` | Any | Core type re-exports (`AdzenPlacement`, `ProcessResponse`, `ProcessResponseAd`) |
|
|
53
54
|
| `@adzenai/ai/copilotkit` | Server or client | `AdzenAsyncMiddleware`, `AdzenAsyncConfig` |
|
|
54
55
|
| `@adzenai/ai/copilotkit/react` | Browser (React 18+) | `AdzenCard`, `useAdzenPlacement`, `dispatchPlacementEvent(s)` |
|
|
55
56
|
|
|
@@ -59,7 +60,9 @@ dispatchPlacementEvents(events);
|
|
|
59
60
|
2. On message completion, it calls the Adzen `/process` API to match a contextual ad.
|
|
60
61
|
3. If matched, an `adzen_placement` custom event is appended to the downstream stream.
|
|
61
62
|
4. `dispatchPlacementEvents()` bridges these to browser `CustomEvent`s.
|
|
62
|
-
5. `AdzenCard` picks up the placement and renders it with automatic
|
|
63
|
+
5. `AdzenCard` picks up the placement and renders it with automatic impression tracking.
|
|
64
|
+
|
|
65
|
+
Impression beacons are fired as client-side GET requests directly to the delivery API — no server-side proxy needed.
|
|
63
66
|
|
|
64
67
|
The middleware is **additive only** — it never modifies, blocks, or delays the original event stream. All failures degrade silently.
|
|
65
68
|
|
|
@@ -67,10 +70,12 @@ The middleware is **additive only** — it never modifies, blocks, or delays the
|
|
|
67
70
|
|
|
68
71
|
```typescript
|
|
69
72
|
new AdzenAsyncMiddleware({
|
|
70
|
-
apiKey: string;
|
|
71
|
-
endpointUrl?: string;
|
|
72
|
-
timeoutMs?: number;
|
|
73
|
-
adUnitPosition?: string;
|
|
73
|
+
apiKey: string; // required — Adzen API key
|
|
74
|
+
endpointUrl?: string; // default: "https://api.adzen.ai/v1/ai"
|
|
75
|
+
timeoutMs?: number; // default: 3000
|
|
76
|
+
adUnitPosition?: string; // default: "chin"
|
|
77
|
+
location?: string; // optional — DMA location code for geo-targeting
|
|
78
|
+
conversationId?: string; // optional — links impressions to conversation context
|
|
74
79
|
});
|
|
75
80
|
```
|
|
76
81
|
|