@base44-preview/sdk 0.8.39-pr.231.0f61b59 → 0.8.39-pr.231.cbd75f8

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.
@@ -35,17 +35,17 @@ export interface AiGatewayModuleConfig {
35
35
  * setup with the underlying model provider required.
36
36
  *
37
37
  * Call `connection()` from a backend function rather than the browser. That's
38
- * where you can wire tools that read and write your app's own entities and
39
- * business logic without shipping that logic to the client. It also keeps the
40
- * gateway token out of the browser, where it could be stolen and used to
41
- * spend against your app's shared credit quota.
38
+ * where your instructions, tools, and business logic stay server-side, where
39
+ * users can't inspect or tamper with them, and where you can enforce your own
40
+ * auth checks, rate limits, or spend limits around the call. `token` is the
41
+ * caller's own session token, the same one the SDK already uses for every
42
+ * other call, so calling from the browser doesn't expose anything new.
42
43
  *
43
44
  * ## Models
44
45
  *
45
46
  * Build AI agents or call models directly from your app's backend functions.
46
47
  * Pass `'automatic'` to let Base44 choose a model, or pin a specific one such
47
- * as `'claude_sonnet_4_6'`, `'claude_opus_4_8'`, `'gpt_5_5'`, or
48
- * `'gemini_3_1_pro'`.
48
+ * as `'claude_sonnet_4_6'`, `'gpt_5_5'`, or `'gemini_3_1_pro'`.
49
49
  *
50
50
  * See the [`model` options on `InvokeLLM`](/developers/references/sdk/docs/type-aliases/integrations#invokellm)
51
51
  * for the current set of models you can use.
@@ -78,8 +78,10 @@ export interface AiGatewayModule {
78
78
  * @example
79
79
  * ```typescript
80
80
  * // Call a model directly with the OpenAI SDK, inside a backend function
81
+ * import { createClientFromRequest } from "@base44/sdk";
81
82
  * import OpenAI from "openai";
82
83
  *
84
+ * const base44 = createClientFromRequest(request);
83
85
  * const { baseURL, token } = base44.aiGateway.connection();
84
86
  * const openai = new OpenAI({ baseURL, apiKey: token });
85
87
  *
@@ -94,11 +96,13 @@ export interface AiGatewayModule {
94
96
  * @example
95
97
  * ```typescript
96
98
  * // Review a return request with a tool-using agent, inside a backend function
99
+ * import { createClientFromRequest } from "@base44/sdk";
97
100
  * import { ToolLoopAgent, tool, stepCountIs, hasToolCall } from "ai";
98
101
  * import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
99
102
  * import { z } from "zod";
100
103
  *
101
- * const request = await base44.entities.ReturnRequest.get(returnId);
104
+ * const base44 = createClientFromRequest(request);
105
+ * const returnRequest = await base44.entities.ReturnRequest.get(returnId);
102
106
  * const { baseURL, token } = base44.aiGateway.connection();
103
107
  * // Point any OpenAI-compatible client at `baseURL` with `apiKey: token`.
104
108
  * const models = createOpenAICompatible({ name: "base44", baseURL, apiKey: token });
@@ -113,7 +117,7 @@ export interface AiGatewayModule {
113
117
  * description: "This customer's past orders, optionally filtered by status",
114
118
  * inputSchema: z.object({ status: z.string().optional() }),
115
119
  * execute: ({ status }) => {
116
- * const query = { customer_email: request.customer_email };
120
+ * const query = { customer_email: returnRequest.customer_email };
117
121
  * if (status) query.status = status;
118
122
  * return base44.entities.Order.filter(query, "-created_date", 50);
119
123
  * },
@@ -128,7 +132,7 @@ export interface AiGatewayModule {
128
132
  * stopWhen: [stepCountIs(8), hasToolCall("submitVerdict")],
129
133
  * });
130
134
  *
131
- * await agent.generate({ prompt: `Review this return request: ${JSON.stringify(request)}` });
135
+ * await agent.generate({ prompt: `Review this return request: ${JSON.stringify(returnRequest)}` });
132
136
  * ```
133
137
  */
134
138
  connection(): AiGatewayConnection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.39-pr.231.0f61b59",
3
+ "version": "0.8.39-pr.231.cbd75f8",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",