@base44-preview/sdk 0.8.50-pr.291.10ee07f → 0.8.50-pr.292.d7cb5e4
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.
|
@@ -33,7 +33,7 @@ export interface AiGatewayModuleConfig {
|
|
|
33
33
|
* `connection()` hands you a `baseURL` and `token` that authenticate as your
|
|
34
34
|
* Base44 app. An OpenAI-compatible client is any library, such as the `openai`
|
|
35
35
|
* SDK or the Vercel AI SDK, that has the same request and response format
|
|
36
|
-
* as OpenAI's API and lets you point it at a custom `baseURL`
|
|
36
|
+
* as OpenAI's Chat Completions API and lets you point it at a custom `baseURL`
|
|
37
37
|
* instead of OpenAI's own servers. Pass `connection()`'s values to one of
|
|
38
38
|
* these clients and it works against Base44's gateway exactly as it would
|
|
39
39
|
* against the provider directly, no separate account, API key, or billing
|
|
@@ -55,15 +55,6 @@ export interface AiGatewayModuleConfig {
|
|
|
55
55
|
* Pass `'automatic'` to let Base44 choose one, or pin a specific model such
|
|
56
56
|
* as `'claude_sonnet_4_6'`, `'gpt_5_5'`, or `'gemini_3_1_pro'`.
|
|
57
57
|
*
|
|
58
|
-
* ## Images
|
|
59
|
-
*
|
|
60
|
-
* The gateway also serves OpenAI's image endpoints, `/images/generations`
|
|
61
|
-
* and `/images/edits`, so you can generate images and edit them using
|
|
62
|
-
* reference images. Image requests use their own set of models: pass
|
|
63
|
-
* `'automatic'` to let Base44 choose one, or pin a model such as
|
|
64
|
-
* `'gemini_3_1_flash_image'` or `'gpt_image_2'`. For request options, the
|
|
65
|
-
* full model list, and limits, see [Generate images with the AI Gateway](/developers/references/sdk/getting-started/ai-gateway-images).
|
|
66
|
-
*
|
|
67
58
|
* ## Authentication Modes
|
|
68
59
|
*
|
|
69
60
|
* There's no permission difference between modes. Both just determine which
|
|
@@ -154,29 +145,6 @@ export interface AiGatewayModule {
|
|
|
154
145
|
*
|
|
155
146
|
* await agent.generate({ prompt: `Review this return request: ${JSON.stringify(returnRequest)}` });
|
|
156
147
|
* ```
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* ```typescript
|
|
160
|
-
* // Generate an image
|
|
161
|
-
* import { createClientFromRequest } from "@base44/sdk";
|
|
162
|
-
* import { generateImage } from "ai";
|
|
163
|
-
* import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
|
|
164
|
-
*
|
|
165
|
-
* // Runs inside a backend function
|
|
166
|
-
* const base44 = createClientFromRequest(request);
|
|
167
|
-
* const { baseURL, token } = base44.aiGateway.connection();
|
|
168
|
-
* const models = createOpenAICompatible({ name: "base44", baseURL, apiKey: token });
|
|
169
|
-
*
|
|
170
|
-
* const { image } = await generateImage({
|
|
171
|
-
* model: models.imageModel("automatic"),
|
|
172
|
-
* prompt: "A watercolor illustration of a lighthouse at dawn",
|
|
173
|
-
* // Base44 options go under the provider name you passed above
|
|
174
|
-
* providerOptions: { base44: { aspect_ratio: "16:9" } },
|
|
175
|
-
* });
|
|
176
|
-
*
|
|
177
|
-
* const file = new File([image.uint8Array], "lighthouse.png", { type: image.mediaType });
|
|
178
|
-
* const { file_url } = await base44.integrations.Core.UploadFile({ file });
|
|
179
|
-
* ```
|
|
180
148
|
*/
|
|
181
149
|
connection(options?: AiGatewayConnectionOptions): AiGatewayConnection;
|
|
182
150
|
}
|
|
@@ -59,17 +59,8 @@ export interface InvokeLLMParams {
|
|
|
59
59
|
* Parameters for the GenerateImage function.
|
|
60
60
|
*/
|
|
61
61
|
export interface GenerateImageParams {
|
|
62
|
-
/**
|
|
63
|
-
* Description of the image to generate. When you pass `existing_image_urls`,
|
|
64
|
-
* describe what to do with the reference images instead.
|
|
65
|
-
*/
|
|
62
|
+
/** Description of the image to generate. */
|
|
66
63
|
prompt: string;
|
|
67
|
-
/**
|
|
68
|
-
* URLs of images to use as references, for example to edit an existing
|
|
69
|
-
* image, match a style, or add visual context. Images that can't be read are
|
|
70
|
-
* skipped. If none of them can be read, the request fails.
|
|
71
|
-
*/
|
|
72
|
-
existing_image_urls?: string[];
|
|
73
64
|
}
|
|
74
65
|
export interface GenerateImageResult {
|
|
75
66
|
/** URL of the generated image. */
|
|
@@ -182,17 +173,12 @@ export interface CoreIntegrations {
|
|
|
182
173
|
*/
|
|
183
174
|
InvokeLLM(params: InvokeLLMParams): Promise<string | object>;
|
|
184
175
|
/**
|
|
185
|
-
* Create AI-generated images from text prompts
|
|
176
|
+
* Create AI-generated images from text prompts.
|
|
186
177
|
*
|
|
187
178
|
* Images are generated as PNG files at approximately 1024px on the shorter side. The
|
|
188
179
|
* exact dimensions vary by aspect ratio.
|
|
189
180
|
*
|
|
190
|
-
*
|
|
191
|
-
* with reference images. To choose the model, aspect ratio, resolution, or
|
|
192
|
-
* quality, use the [AI Gateway image endpoints](/developers/references/sdk/getting-started/ai-gateway-images)
|
|
193
|
-
* instead.
|
|
194
|
-
*
|
|
195
|
-
* Prompts that violate the AI provider's content policy are refused.
|
|
181
|
+
* Prompts that violate the AI provider's content policy will be refused.
|
|
196
182
|
*
|
|
197
183
|
* @param params - Parameters for image generation
|
|
198
184
|
* @returns Promise resolving to an object containing the URL of the generated PNG image.
|
|
@@ -205,15 +191,6 @@ export interface CoreIntegrations {
|
|
|
205
191
|
* });
|
|
206
192
|
* console.log(url); // https://...generated_image.png
|
|
207
193
|
* ```
|
|
208
|
-
*
|
|
209
|
-
* @example
|
|
210
|
-
* ```typescript
|
|
211
|
-
* // Edit an existing image
|
|
212
|
-
* const {url} = await base44.integrations.Core.GenerateImage({
|
|
213
|
-
* prompt: "Replace the background with a sunset beach",
|
|
214
|
-
* existing_image_urls: [productPhotoUrl]
|
|
215
|
-
* });
|
|
216
|
-
* ```
|
|
217
194
|
*/
|
|
218
195
|
GenerateImage(params: GenerateImageParams): Promise<GenerateImageResult>;
|
|
219
196
|
/**
|
|
@@ -11,9 +11,11 @@ function initializeSocket(config, handlers) {
|
|
|
11
11
|
const resolvedToken = (_a = config.token) !== null && _a !== void 0 ? _a : getAccessToken();
|
|
12
12
|
const query = {
|
|
13
13
|
app_id: config.appId,
|
|
14
|
-
token: resolvedToken,
|
|
15
14
|
};
|
|
16
|
-
if (
|
|
15
|
+
if (resolvedToken) {
|
|
16
|
+
query.token = resolvedToken;
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
17
19
|
query.anonymous_id = getAnalyticsSessionId();
|
|
18
20
|
}
|
|
19
21
|
const socket = io(config.serverUrl, {
|