@base44-preview/sdk 0.8.37-pr.226.49a8ffd → 0.8.37-pr.226.6c62736

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.
@@ -47,41 +47,26 @@ export interface AiGatewayModule {
47
47
  *
48
48
  * @example
49
49
  * ```typescript
50
- * import { ToolLoopAgent, tool, stepCountIs, hasToolCall } from "ai";
51
- * import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
52
- * import { z } from "zod";
50
+ * // Inside a backend function: hand the connection to any OpenAI-compatible client
51
+ * import { createClientFromRequest } from 'npm:@base44/sdk';
53
52
  *
54
- * const request = await base44.entities.ReturnRequest.get(returnId);
55
- * const { baseURL, token } = base44.aiGateway.connection();
56
- * // Point any OpenAI-compatible client at `baseURL` with `apiKey: token`.
57
- * const models = createOpenAICompatible({ name: "base44", baseURL, apiKey: token });
53
+ * Deno.serve(async (req) => {
54
+ * const base44 = createClientFromRequest(req);
55
+ * const { baseURL, token } = base44.aiGateway.connection();
58
56
  *
59
- * const agent = new ToolLoopAgent({
60
- * model: models("automatic"),
61
- * instructions:
62
- * "Decide whether this return looks fine or needs the owner's attention. " +
63
- * "Check the customer's past orders, then submit your verdict.",
64
- * tools: {
65
- * searchOrders: tool({
66
- * description: "This customer's past orders, optionally filtered by status",
67
- * inputSchema: z.object({ status: z.string().optional() }),
68
- * execute: ({ status }) => {
69
- * const query = { customer_email: request.customer_email };
70
- * if (status) query.status = status;
71
- * return base44.entities.Order.filter(query, "-created_date", 50);
72
- * },
57
+ * // Point any OpenAI-compatible client at `baseURL` with `apiKey: token`.
58
+ * // Shown here with a raw request to the Chat Completions endpoint:
59
+ * const res = await fetch(`${baseURL}/chat/completions`, {
60
+ * method: 'POST',
61
+ * headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
62
+ * body: JSON.stringify({
63
+ * model: 'claude_sonnet_4_6',
64
+ * messages: [{ role: 'user', content: 'Hello!' }],
73
65
  * }),
74
- * submitVerdict: tool({
75
- * description: "Record the final verdict",
76
- * inputSchema: z.object({ decision: z.enum(["approved", "flagged"]), reason: z.string() }),
77
- * execute: ({ decision, reason }) =>
78
- * base44.entities.ReturnRequest.update(returnId, { status: decision, review_note: reason }),
79
- * }),
80
- * },
81
- * stopWhen: [stepCountIs(8), hasToolCall("submitVerdict")],
66
+ * });
67
+ * const data = await res.json();
68
+ * return Response.json({ text: data.choices[0].message.content });
82
69
  * });
83
- *
84
- * await agent.generate({ prompt: `Review this return request: ${JSON.stringify(request)}` });
85
70
  * ```
86
71
  */
87
72
  connection(): AiGatewayConnection;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44-preview/sdk",
3
- "version": "0.8.37-pr.226.49a8ffd",
3
+ "version": "0.8.37-pr.226.6c62736",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",