@argentic-ai/client 0.4.0 → 0.5.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 +2 -1
- package/dist/argentic.d.ts +10 -0
- package/dist/argentic.js +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,8 @@ const tools = { refund_order: tool({
|
|
|
39
39
|
execute: async (args, { toolCallId }) => refund(args, toolCallId),
|
|
40
40
|
}) }
|
|
41
41
|
|
|
42
|
-
// apiKey defaults to ARGENTIC_API_KEY and
|
|
42
|
+
// apiKey defaults to ARGENTIC_API_KEY, modelKey to MODEL_KEY, and embedKey to EMBED_KEY
|
|
43
|
+
// (optional: with it, the agent's recall also finds what was said in other words)
|
|
43
44
|
const client = new Argentic()
|
|
44
45
|
const out = await run({
|
|
45
46
|
client, agent: 'my-agent', runId: 'order-1182', ledgerPath: '.argentic-ledger.json',
|
package/dist/argentic.d.ts
CHANGED
|
@@ -133,6 +133,15 @@ export interface ClientOptions {
|
|
|
133
133
|
apiKey?: string;
|
|
134
134
|
/** Sent as X-Model-Key on wake. Defaults to the MODEL_KEY environment variable. */
|
|
135
135
|
modelKey?: string;
|
|
136
|
+
/**
|
|
137
|
+
* Your embedding provider key, sent as X-Embed-Key on wake, so the agent's recall also finds what was said in other words. Defaults to the
|
|
138
|
+
* EMBED_KEY environment variable; without one, recall works by words. Never stored by Argentic; your provider bills you for it.
|
|
139
|
+
*/
|
|
140
|
+
embedKey?: string;
|
|
141
|
+
/** Sent as X-Embed-Provider: `cohere` (the default) or `bedrock`. Defaults to the EMBED_PROVIDER environment variable. */
|
|
142
|
+
embedProvider?: string;
|
|
143
|
+
/** Sent as X-Embed-Region, for `bedrock` (default `us-east-1`). Defaults to the EMBED_REGION environment variable. */
|
|
144
|
+
embedRegion?: string;
|
|
136
145
|
baseUrl?: string;
|
|
137
146
|
/** How long one request may take before that try counts as a network failure, in milliseconds. Default 300000; 0 means no limit. */
|
|
138
147
|
timeoutMs?: number;
|
|
@@ -146,6 +155,7 @@ export interface ClientOptions {
|
|
|
146
155
|
export declare class Argentic {
|
|
147
156
|
private readonly apiKey;
|
|
148
157
|
private readonly modelKey?;
|
|
158
|
+
private readonly embed;
|
|
149
159
|
private readonly baseUrl;
|
|
150
160
|
private readonly timeoutMs;
|
|
151
161
|
private readonly doFetch;
|
package/dist/argentic.js
CHANGED
|
@@ -119,6 +119,8 @@ export function hintFor(e) {
|
|
|
119
119
|
return 'Check ARGENTIC_API_KEY. A key only works on the API it was made for, so if you set ARGENTIC_BASE_URL, make the key in that dashboard.';
|
|
120
120
|
if (code === 'model_key_rejected')
|
|
121
121
|
return 'Your model provider refused MODEL_KEY. Check it is a key for the provider in the error (a free NVIDIA key starts with nvapi-).';
|
|
122
|
+
if (code === 'bad_embed_key')
|
|
123
|
+
return 'The API cannot use EMBED_KEY as sent: EMBED_PROVIDER is cohere (the default) or bedrock, EMBED_REGION goes with bedrock only, and the key has no spaces. Unset EMBED_KEY to recall by words alone.';
|
|
122
124
|
if (code === 'bad_model')
|
|
123
125
|
return 'Your provider does not know this model id. Set ARGENTIC_MODEL_ID to one it serves, or unset it for the free default.';
|
|
124
126
|
if (e.status === 402)
|
|
@@ -133,6 +135,7 @@ const wait = (ms) => new Promise((r) => setTimeout(r, ms));
|
|
|
133
135
|
export class Argentic {
|
|
134
136
|
apiKey;
|
|
135
137
|
modelKey;
|
|
138
|
+
embed;
|
|
136
139
|
baseUrl;
|
|
137
140
|
timeoutMs;
|
|
138
141
|
doFetch;
|
|
@@ -144,6 +147,12 @@ export class Argentic {
|
|
|
144
147
|
constructor(opts = {}) {
|
|
145
148
|
this.apiKey = opts.apiKey ?? process.env.ARGENTIC_API_KEY ?? '';
|
|
146
149
|
this.modelKey = opts.modelKey || process.env.MODEL_KEY || undefined;
|
|
150
|
+
const embedKey = opts.embedKey || process.env.EMBED_KEY || undefined;
|
|
151
|
+
const embedProvider = opts.embedProvider || process.env.EMBED_PROVIDER || undefined;
|
|
152
|
+
const embedRegion = opts.embedRegion || process.env.EMBED_REGION || undefined;
|
|
153
|
+
this.embed = embedKey
|
|
154
|
+
? { 'X-Embed-Key': embedKey, ...(embedProvider ? { 'X-Embed-Provider': embedProvider } : {}), ...(embedRegion ? { 'X-Embed-Region': embedRegion } : {}) }
|
|
155
|
+
: {};
|
|
147
156
|
this.timeoutMs = opts.timeoutMs ?? defaultTimeoutMs;
|
|
148
157
|
this.baseUrl = (opts.baseUrl ?? process.env.ARGENTIC_BASE_URL ?? defaultBaseUrl).replace(/\/+$/, '');
|
|
149
158
|
this.doFetch = opts.fetch ?? fetch;
|
|
@@ -166,6 +175,7 @@ export class Argentic {
|
|
|
166
175
|
};
|
|
167
176
|
if (this.modelKey)
|
|
168
177
|
headers['X-Model-Key'] = this.modelKey;
|
|
178
|
+
Object.assign(headers, this.embed);
|
|
169
179
|
const path = `/v1/agents/${encodeURIComponent(agent)}/wake`;
|
|
170
180
|
const { results, ...plain } = body;
|
|
171
181
|
let res;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argentic-ai/client",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Argentic client for TypeScript. Argentic is an engine that keeps AI agents right for hours while prompt size is bounded. Adapters for the Vercel AI SDK and Mastra.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|