@aithos/sdk 0.1.0-alpha.18 → 0.1.0-alpha.19
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/dist/src/compute.d.ts +42 -0
- package/dist/src/compute.js +50 -0
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +1 -1
- package/package.json +1 -1
package/dist/src/compute.d.ts
CHANGED
|
@@ -118,6 +118,38 @@ export interface InvokeImageResult {
|
|
|
118
118
|
/** Audit log id for traceability. */
|
|
119
119
|
readonly auditId: string;
|
|
120
120
|
}
|
|
121
|
+
export interface InvokeBedrockVisionArgs {
|
|
122
|
+
readonly mandateId?: string;
|
|
123
|
+
/**
|
|
124
|
+
* Model id. Sonnet 4.6 is the default — it's vision-capable and
|
|
125
|
+
* returns reliable structured JSON when prompted.
|
|
126
|
+
*/
|
|
127
|
+
readonly model?: string;
|
|
128
|
+
/** Source image — Blob (recommended) or raw base64. */
|
|
129
|
+
readonly image: Blob | {
|
|
130
|
+
readonly base64: string;
|
|
131
|
+
readonly contentType: string;
|
|
132
|
+
};
|
|
133
|
+
/** Text prompt accompanying the image. */
|
|
134
|
+
readonly prompt: string;
|
|
135
|
+
/** Optional system prompt. */
|
|
136
|
+
readonly system?: string;
|
|
137
|
+
readonly maxTokens?: number;
|
|
138
|
+
readonly temperature?: number;
|
|
139
|
+
readonly idempotencyKey?: string;
|
|
140
|
+
readonly signal?: AbortSignal;
|
|
141
|
+
}
|
|
142
|
+
export interface InvokeBedrockVisionResult {
|
|
143
|
+
readonly content: string;
|
|
144
|
+
readonly stopReason: StopReason;
|
|
145
|
+
readonly usage: {
|
|
146
|
+
readonly inputTokens: number;
|
|
147
|
+
readonly outputTokens: number;
|
|
148
|
+
};
|
|
149
|
+
readonly creditsCharged: number;
|
|
150
|
+
readonly walletBalance: number;
|
|
151
|
+
readonly auditId: string;
|
|
152
|
+
}
|
|
121
153
|
export interface InvokeSegmentationArgs {
|
|
122
154
|
/** Mandate id (optional for owner sessions — see InvokeImageArgs). */
|
|
123
155
|
readonly mandateId?: string;
|
|
@@ -199,6 +231,16 @@ export declare class ComputeNamespace {
|
|
|
199
231
|
* `mandate_revoked`, `insufficient_credits`, …).
|
|
200
232
|
*/
|
|
201
233
|
invokeBedrock(args: InvokeBedrockArgs): Promise<InvokeBedrockResult>;
|
|
234
|
+
/**
|
|
235
|
+
* Multimodal Bedrock invoke — image + text → text response.
|
|
236
|
+
* Default model: `claude-sonnet-4-6` (vision-capable, reliable JSON).
|
|
237
|
+
*
|
|
238
|
+
* Use when you need a VLM to reason about an image: locating
|
|
239
|
+
* features, structured extraction, semantic Q&A. Prompt the model
|
|
240
|
+
* to return JSON if you need structured output (the API itself is
|
|
241
|
+
* unstructured).
|
|
242
|
+
*/
|
|
243
|
+
invokeBedrockVision(args: InvokeBedrockVisionArgs): Promise<InvokeBedrockVisionResult>;
|
|
202
244
|
/**
|
|
203
245
|
* Generate one or more images through the Aithos compute proxy
|
|
204
246
|
* (currently powered by fal.ai FLUX models). Spec mirror of
|
package/dist/src/compute.js
CHANGED
|
@@ -86,6 +86,56 @@ export class ComputeNamespace {
|
|
|
86
86
|
signal: args.signal,
|
|
87
87
|
});
|
|
88
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Multimodal Bedrock invoke — image + text → text response.
|
|
91
|
+
* Default model: `claude-sonnet-4-6` (vision-capable, reliable JSON).
|
|
92
|
+
*
|
|
93
|
+
* Use when you need a VLM to reason about an image: locating
|
|
94
|
+
* features, structured extraction, semantic Q&A. Prompt the model
|
|
95
|
+
* to return JSON if you need structured output (the API itself is
|
|
96
|
+
* unstructured).
|
|
97
|
+
*/
|
|
98
|
+
async invokeBedrockVision(args) {
|
|
99
|
+
const { endpoints, fetch: fetchImpl } = this.#deps;
|
|
100
|
+
const choice = this.#resolveSigner(args.mandateId);
|
|
101
|
+
let imageBase64;
|
|
102
|
+
let imageContentType;
|
|
103
|
+
if ("base64" in args.image) {
|
|
104
|
+
imageBase64 = args.image.base64;
|
|
105
|
+
imageContentType = args.image.contentType;
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
const buf = await args.image.arrayBuffer();
|
|
109
|
+
imageBase64 = arrayBufferToBase64(buf);
|
|
110
|
+
imageContentType = args.image.type || "image/png";
|
|
111
|
+
}
|
|
112
|
+
const url = computeInvokeUrl(endpoints);
|
|
113
|
+
const idempotencyKey = args.idempotencyKey ?? generateIdempotencyKey();
|
|
114
|
+
const model = args.model ?? "claude-sonnet-4-6";
|
|
115
|
+
const params = {
|
|
116
|
+
app_did: this.#deps.appDid,
|
|
117
|
+
mandate_id: this.#resolveMandateIdForWire(args.mandateId, choice),
|
|
118
|
+
model,
|
|
119
|
+
image_base64: imageBase64,
|
|
120
|
+
image_content_type: imageContentType,
|
|
121
|
+
prompt: args.prompt,
|
|
122
|
+
idempotency_key: idempotencyKey,
|
|
123
|
+
};
|
|
124
|
+
if (args.system !== undefined)
|
|
125
|
+
params.system = args.system;
|
|
126
|
+
if (args.maxTokens !== undefined)
|
|
127
|
+
params.max_tokens = args.maxTokens;
|
|
128
|
+
if (args.temperature !== undefined)
|
|
129
|
+
params.temperature = args.temperature;
|
|
130
|
+
return await this.#signAndPost({
|
|
131
|
+
url,
|
|
132
|
+
method: "aithos.compute_invoke_bedrock_vision",
|
|
133
|
+
params,
|
|
134
|
+
choice,
|
|
135
|
+
fetchImpl,
|
|
136
|
+
signal: args.signal,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
89
139
|
/**
|
|
90
140
|
* Generate one or more images through the Aithos compute proxy
|
|
91
141
|
* (currently powered by fal.ai FLUX models). Spec mirror of
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.19";
|
|
2
2
|
export { AithosSDK } from "./sdk.js";
|
|
3
3
|
export type { AithosSDKConfig } from "./types.js";
|
|
4
4
|
export { AithosSDKError } from "./types.js";
|
|
5
5
|
export { AithosRpcError } from "@aithos/protocol-client";
|
|
6
6
|
export type { AithosSdkEndpoints } from "./endpoints.js";
|
|
7
7
|
export { DEFAULT_SDK_ENDPOINTS } from "./endpoints.js";
|
|
8
|
-
export type { ComputeMessage, ImageAspectRatio, ImageModelId, InvokeBedrockArgs, InvokeBedrockResult, InvokeImageArgs, InvokeImageImage, InvokeImageResult, InvokeSegmentationArgs, InvokeSegmentationResult, SegmentPolygon, StopReason, } from "./compute.js";
|
|
8
|
+
export type { ComputeMessage, ImageAspectRatio, ImageModelId, InvokeBedrockArgs, InvokeBedrockResult, InvokeBedrockVisionArgs, InvokeBedrockVisionResult, InvokeImageArgs, InvokeImageImage, InvokeImageResult, InvokeSegmentationArgs, InvokeSegmentationResult, SegmentPolygon, StopReason, } from "./compute.js";
|
|
9
9
|
export { ComputeNamespace } from "./compute.js";
|
|
10
10
|
export type { CreditPackId, CreateTopupSessionArgs, CreateTopupSessionResult, GetBalanceArgs, GetBalanceResult, } from "./wallet.js";
|
|
11
11
|
export { WalletNamespace } from "./wallet.js";
|
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// Public types specific to the SDK (`AithosSDKConfig`, `AithosSDKError`)
|
|
18
18
|
// are exported from here. Endpoint config (`AithosSdkEndpoints`,
|
|
19
19
|
// `DEFAULT_SDK_ENDPOINTS`) likewise.
|
|
20
|
-
export const VERSION = "0.1.0-alpha.
|
|
20
|
+
export const VERSION = "0.1.0-alpha.19";
|
|
21
21
|
export { AithosSDK } from "./sdk.js";
|
|
22
22
|
export { AithosSDKError } from "./types.js";
|
|
23
23
|
// Re-export protocol-client's JSON-RPC error type so consumers can
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aithos/sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.19",
|
|
4
4
|
"description": "Aithos SDK — high-level TypeScript developer kit for building agentic apps on the Aithos protocol. Wraps @aithos/protocol-client and exposes the Aithos compute proxy and wallet (Stripe top-up) endpoints.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aithos",
|