@superblocksteam/sdk-api 2.0.103 → 2.0.104-next.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.
Files changed (106) hide show
  1. package/README.md +58 -299
  2. package/dist/api/definition.js +1 -1
  3. package/dist/api/definition.js.map +1 -1
  4. package/dist/api/index.d.ts +0 -2
  5. package/dist/api/index.d.ts.map +1 -1
  6. package/dist/api/index.js +0 -2
  7. package/dist/api/index.js.map +1 -1
  8. package/dist/errors.d.ts +0 -44
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/errors.js +0 -32
  11. package/dist/errors.js.map +1 -1
  12. package/dist/index.d.ts +5 -5
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +5 -9
  15. package/dist/index.js.map +1 -1
  16. package/dist/integrations/anthropic/types.d.ts +3 -22
  17. package/dist/integrations/anthropic/types.d.ts.map +1 -1
  18. package/dist/integrations/base/index.d.ts +1 -1
  19. package/dist/integrations/base/index.d.ts.map +1 -1
  20. package/dist/integrations/base/rest-api-integration-client.d.ts +4 -48
  21. package/dist/integrations/base/rest-api-integration-client.d.ts.map +1 -1
  22. package/dist/integrations/base/rest-api-integration-client.js +2 -110
  23. package/dist/integrations/base/rest-api-integration-client.js.map +1 -1
  24. package/dist/integrations/base/types.d.ts +1 -67
  25. package/dist/integrations/base/types.d.ts.map +1 -1
  26. package/dist/integrations/index.d.ts +1 -1
  27. package/dist/integrations/index.d.ts.map +1 -1
  28. package/dist/integrations/index.js.map +1 -1
  29. package/dist/integrations/openai_v2/types.d.ts +4 -22
  30. package/dist/integrations/openai_v2/types.d.ts.map +1 -1
  31. package/dist/integrations/registry.d.ts +0 -16
  32. package/dist/integrations/registry.d.ts.map +1 -1
  33. package/dist/integrations/registry.js +38 -38
  34. package/dist/integrations/registry.js.map +1 -1
  35. package/dist/integrations/registry.test.js +1 -3
  36. package/dist/integrations/registry.test.js.map +1 -1
  37. package/dist/integrations/restapiintegration/types.d.ts +2 -2
  38. package/dist/integrations/restapiintegration/types.d.ts.map +1 -1
  39. package/dist/integrations/snowflakecortex/client.d.ts +1 -2
  40. package/dist/integrations/snowflakecortex/client.d.ts.map +1 -1
  41. package/dist/integrations/snowflakecortex/client.js +1 -2
  42. package/dist/integrations/snowflakecortex/client.js.map +1 -1
  43. package/dist/integrations/snowflakecortex/types.d.ts +3 -4
  44. package/dist/integrations/snowflakecortex/types.d.ts.map +1 -1
  45. package/dist/runtime/index.d.ts +0 -3
  46. package/dist/runtime/index.d.ts.map +1 -1
  47. package/dist/runtime/index.js +1 -6
  48. package/dist/runtime/index.js.map +1 -1
  49. package/package.json +1 -1
  50. package/src/api/definition.ts +1 -1
  51. package/src/api/index.ts +0 -4
  52. package/src/errors.ts +0 -48
  53. package/src/index.ts +2 -28
  54. package/src/integrations/anthropic/README.md +5 -101
  55. package/src/integrations/anthropic/types.ts +3 -29
  56. package/src/integrations/base/index.ts +0 -2
  57. package/src/integrations/base/rest-api-integration-client.ts +4 -153
  58. package/src/integrations/base/types.ts +3 -74
  59. package/src/integrations/cohere/README.md +11 -11
  60. package/src/integrations/fireworks/README.md +43 -17
  61. package/src/integrations/googleanalytics/README.md +2 -2
  62. package/src/integrations/googledrive/README.md +2 -2
  63. package/src/integrations/groq/README.md +41 -34
  64. package/src/integrations/gsheets/README.md +2 -2
  65. package/src/integrations/index.ts +0 -1
  66. package/src/integrations/launchdarkly/README.md +2 -2
  67. package/src/integrations/mistral/README.md +39 -13
  68. package/src/integrations/openai_v2/README.md +44 -116
  69. package/src/integrations/openai_v2/types.ts +4 -29
  70. package/src/integrations/pagerduty/README.md +2 -2
  71. package/src/integrations/perplexity/README.md +2 -1
  72. package/src/integrations/registry.test.ts +1 -3
  73. package/src/integrations/registry.ts +38 -127
  74. package/src/integrations/restapiintegration/README.md +4 -43
  75. package/src/integrations/restapiintegration/types.ts +2 -8
  76. package/src/integrations/sendgrid/README.md +2 -2
  77. package/src/integrations/snowflakecortex/README.md +4 -53
  78. package/src/integrations/snowflakecortex/client.ts +2 -3
  79. package/src/integrations/snowflakecortex/types.ts +3 -11
  80. package/src/integrations/stabilityai/README.md +2 -2
  81. package/src/runtime/index.ts +1 -23
  82. package/dist/api/streaming.d.ts +0 -229
  83. package/dist/api/streaming.d.ts.map +0 -1
  84. package/dist/api/streaming.js +0 -107
  85. package/dist/api/streaming.js.map +0 -1
  86. package/dist/api/streaming.test.d.ts +0 -5
  87. package/dist/api/streaming.test.d.ts.map +0 -1
  88. package/dist/api/streaming.test.js +0 -364
  89. package/dist/api/streaming.test.js.map +0 -1
  90. package/dist/runtime/execute.d.ts +0 -128
  91. package/dist/runtime/execute.d.ts.map +0 -1
  92. package/dist/runtime/execute.js +0 -84
  93. package/dist/runtime/execute.js.map +0 -1
  94. package/dist/runtime/streaming-context.d.ts +0 -49
  95. package/dist/runtime/streaming-context.d.ts.map +0 -1
  96. package/dist/runtime/streaming-context.js +0 -71
  97. package/dist/runtime/streaming-context.js.map +0 -1
  98. package/dist/runtime/streaming-executor.d.ts +0 -159
  99. package/dist/runtime/streaming-executor.d.ts.map +0 -1
  100. package/dist/runtime/streaming-executor.js +0 -229
  101. package/dist/runtime/streaming-executor.js.map +0 -1
  102. package/src/api/streaming.test.ts +0 -433
  103. package/src/api/streaming.ts +0 -303
  104. package/src/runtime/execute.ts +0 -221
  105. package/src/runtime/streaming-context.ts +0 -164
  106. package/src/runtime/streaming-executor.ts +0 -367
@@ -3,16 +3,12 @@
3
3
  */
4
4
 
5
5
  import type { BaseIntegrationClient } from "../../types.js";
6
- import type {
7
- SupportsApiRequest,
8
- SupportsStreamingApiRequest,
9
- } from "../base/index.js";
6
+ import type { SupportsApiRequest } from "../base/index.js";
10
7
 
11
8
  /**
12
9
  * Anthropic client for Claude AI model interactions.
13
10
  *
14
- * Provides the generic apiRequest() method for any Anthropic API endpoint,
15
- * and streamApiRequest() for streaming responses.
11
+ * Provides the generic apiRequest() method for any Anthropic API endpoint.
16
12
  * Use this to interact with Anthropic's messages API and other endpoints.
17
13
  *
18
14
  * @example
@@ -58,31 +54,9 @@ import type {
58
54
  * }
59
55
  * );
60
56
  *
61
- * // Or use streaming for real-time responses
62
- * const stream = anthropic.streamApiRequest(
63
- * {
64
- * method: 'POST',
65
- * path: '/v1/messages',
66
- * body: {
67
- * model: 'claude-3-5-sonnet-20241022',
68
- * max_tokens: 1024,
69
- * stream: true,
70
- * messages: [{ role: 'user', content: 'Hello!' }],
71
- * },
72
- * },
73
- * { chunk: StreamEventSchema }
74
- * );
75
- *
76
- * for await (const event of stream) {
77
- * // Handle streaming events
78
- * }
79
57
  * ```
80
58
  */
81
59
  export interface AnthropicClient
82
- extends
83
- BaseIntegrationClient,
84
- SupportsApiRequest,
85
- SupportsStreamingApiRequest {
60
+ extends BaseIntegrationClient, SupportsApiRequest {
86
61
  // apiRequest() method inherited from SupportsApiRequest
87
- // streamApiRequest() method inherited from SupportsStreamingApiRequest
88
62
  }
@@ -9,6 +9,4 @@ export type {
9
9
  ApiRequestOptions,
10
10
  ApiRequestSchema,
11
11
  SupportsApiRequest,
12
- StreamApiRequestSchema,
13
- SupportsStreamingApiRequest,
14
12
  } from "./types.js";
@@ -10,22 +10,13 @@ import type { z } from "zod";
10
10
  import type { Property } from "@superblocksteam/types/dist/src/common/v1/plugin_pb";
11
11
  import type { Plugin as RestApiIntegrationPlugin } from "@superblocksteam/types/dist/src/plugins/restapiintegration/v1/plugin_pb";
12
12
 
13
- import {
14
- RestApiValidationError,
15
- StreamChunkValidationError,
16
- } from "../../errors.js";
17
- import type {
18
- QueryExecutor,
19
- StreamingQueryExecutor,
20
- TraceMetadata,
21
- } from "../registry.js";
13
+ import { RestApiValidationError } from "../../errors.js";
14
+ import type { QueryExecutor, TraceMetadata } from "../registry.js";
22
15
  import type { IntegrationConfig, IntegrationClientImpl } from "../types.js";
23
16
  import type {
24
17
  ApiRequestOptions,
25
18
  ApiRequestSchema,
26
19
  SupportsApiRequest,
27
- StreamApiRequestSchema,
28
- SupportsStreamingApiRequest,
29
20
  } from "./types.js";
30
21
 
31
22
  export type RestApiRequest = PartialMessage<RestApiIntegrationPlugin>;
@@ -35,31 +26,21 @@ export type RestApiRequest = PartialMessage<RestApiIntegrationPlugin>;
35
26
  *
36
27
  * All OpenAPI-based integration clients extend this class to inherit
37
28
  * the generic apiRequest() method with runtime schema validation.
38
- * Also supports streaming API requests when a streaming executor is provided.
39
29
  */
40
30
  export abstract class RestApiIntegrationClient
41
- implements
42
- IntegrationClientImpl,
43
- SupportsApiRequest,
44
- SupportsStreamingApiRequest
31
+ implements IntegrationClientImpl, SupportsApiRequest
45
32
  {
46
33
  readonly name: string;
47
34
  readonly pluginId: string;
48
35
  readonly config: IntegrationConfig;
49
36
 
50
37
  protected readonly executeQuery: QueryExecutor;
51
- protected readonly executeStreamingQuery?: StreamingQueryExecutor;
52
38
 
53
- constructor(
54
- config: IntegrationConfig,
55
- executeQuery: QueryExecutor,
56
- executeStreamingQuery?: StreamingQueryExecutor,
57
- ) {
39
+ constructor(config: IntegrationConfig, executeQuery: QueryExecutor) {
58
40
  this.name = config.name;
59
41
  this.pluginId = config.pluginId;
60
42
  this.config = config;
61
43
  this.executeQuery = executeQuery;
62
- this.executeStreamingQuery = executeStreamingQuery;
63
44
  }
64
45
 
65
46
  /**
@@ -148,134 +129,4 @@ export abstract class RestApiIntegrationClient
148
129
 
149
130
  return responseParseResult.data;
150
131
  }
151
-
152
- /**
153
- * Execute a streaming API request with type-safe chunk validation.
154
- *
155
- * Returns an AsyncIterable that yields validated chunks as they arrive.
156
- * Each chunk is validated against the provided schema before being yielded.
157
- *
158
- * @param options - Request configuration including method, path, params, and body
159
- * @param schema - Zod schemas for request body and chunk validation
160
- * @param metadata - Optional trace metadata for observability (label, description)
161
- * @returns AsyncIterable yielding validated chunks
162
- *
163
- * @example
164
- * ```typescript
165
- * const ChunkSchema = z.object({
166
- * id: z.string(),
167
- * choices: z.array(z.object({
168
- * delta: z.object({
169
- * content: z.string().optional(),
170
- * }),
171
- * })),
172
- * });
173
- *
174
- * const stream = client.streamApiRequest(
175
- * {
176
- * method: 'POST',
177
- * path: '/v1/chat/completions',
178
- * body: {
179
- * model: 'gpt-4',
180
- * stream: true,
181
- * messages: [{ role: 'user', content: 'Hello!' }],
182
- * },
183
- * },
184
- * { chunk: ChunkSchema },
185
- * { label: 'openai.chatCompletions', description: 'Stream chat completion' }
186
- * );
187
- *
188
- * for await (const chunk of stream) {
189
- * console.log(chunk.choices[0]?.delta?.content);
190
- * }
191
- * ```
192
- */
193
- async *streamApiRequest<TBody, TChunk>(
194
- options: ApiRequestOptions<TBody>,
195
- schema: StreamApiRequestSchema<TBody, TChunk>,
196
- metadata?: TraceMetadata,
197
- ): AsyncIterable<TChunk> {
198
- // Validate that streaming is supported
199
- if (!this.executeStreamingQuery) {
200
- throw new Error(
201
- `Streaming is not supported for integration "${this.name}". ` +
202
- "The orchestrator must provide a streaming query executor.",
203
- );
204
- }
205
-
206
- // Validate request body against schema if both are present.
207
- // Body schema is optional — if not provided, the body is sent unvalidated.
208
- if (options.body !== undefined && schema?.body) {
209
- const bodyParseResult = schema.body.safeParse(options.body);
210
- if (!bodyParseResult.success) {
211
- throw new RestApiValidationError(
212
- `Request body validation failed: ${bodyParseResult.error.message}`,
213
- {
214
- zodError: bodyParseResult.error,
215
- data: options.body,
216
- },
217
- );
218
- }
219
- }
220
-
221
- // Convert headers to Property array
222
- const headers: PartialMessage<Property>[] = [];
223
- if (options.headers) {
224
- for (const [key, value] of Object.entries(options.headers)) {
225
- headers.push(this.createParam(key, value));
226
- }
227
- }
228
-
229
- // Convert query params to Property array
230
- const params: PartialMessage<Property>[] = [];
231
- if (options.params) {
232
- for (const [key, value] of Object.entries(options.params)) {
233
- params.push(this.createParam(key, value));
234
- }
235
- }
236
-
237
- // Build the request using raw HTTP mode with streaming response
238
- // Note: responseType must be "raw" for streaming - the orchestrator's
239
- // Stream block expects SSE responses and only works with "raw" type.
240
- const request: RestApiRequest = {
241
- openApiAction: "genericHttpRequest",
242
- httpMethod: options.method.toUpperCase(),
243
- urlPath: options.path,
244
- headers,
245
- params,
246
- responseType: "raw",
247
- };
248
-
249
- // Add body if provided
250
- if (options.body !== undefined) {
251
- request.body = JSON.stringify(options.body);
252
- request.bodyType = "jsonBody";
253
- }
254
-
255
- // Execute the streaming request
256
- const stream = this.executeStreamingQuery(
257
- request as Record<string, unknown>,
258
- metadata,
259
- );
260
-
261
- // Validate and yield each chunk
262
- let chunkIndex = 0;
263
- for await (const rawChunk of stream) {
264
- const parseResult = schema.chunk.safeParse(rawChunk);
265
-
266
- if (!parseResult.success) {
267
- throw new StreamChunkValidationError(
268
- `Chunk validation failed at index ${chunkIndex}: ${parseResult.error.message}`,
269
- {
270
- chunkIndex,
271
- chunk: rawChunk,
272
- zodError: parseResult.error,
273
- },
274
- );
275
- }
276
-
277
- yield parseResult.data;
278
- chunkIndex++;
279
- }
280
- }
281
132
  }
@@ -6,6 +6,9 @@ import type { z } from "zod";
6
6
 
7
7
  import type { TraceMetadata } from "../registry.js";
8
8
 
9
+ // Re-export for backwards compatibility
10
+ export type { TraceMetadata };
11
+
9
12
  /**
10
13
  * Options for making a generic REST API request.
11
14
  */
@@ -101,77 +104,3 @@ export interface SupportsApiRequest {
101
104
  metadata?: TraceMetadata,
102
105
  ): Promise<TResponse>;
103
106
  }
104
-
105
- /**
106
- * Schema configuration for streaming API request validation.
107
- */
108
- export interface StreamApiRequestSchema<TBody = unknown, TChunk = unknown> {
109
- /**
110
- * Optional Zod schema for request body validation.
111
- * Required if body is provided in options.
112
- */
113
- body?: z.ZodSchema<TBody>;
114
-
115
- /**
116
- * Zod schema for validating each streamed chunk.
117
- *
118
- * Every chunk received from the stream is validated against this schema.
119
- * Validation errors will terminate the stream.
120
- */
121
- chunk: z.ZodSchema<TChunk>;
122
- }
123
-
124
- /**
125
- * Interface for integration clients that support streaming API requests.
126
- *
127
- * Streaming API requests return an AsyncIterable of validated chunks,
128
- * enabling real-time data streaming from LLMs and other sources.
129
- */
130
- export interface SupportsStreamingApiRequest {
131
- /**
132
- * Execute a streaming API request with type-safe chunk validation.
133
- *
134
- * Returns an AsyncIterable that yields validated chunks as they arrive.
135
- * Each chunk is validated against the provided schema before being yielded.
136
- *
137
- * @param options - Request configuration including method, path, params, and body
138
- * @param schema - Zod schemas for request body and chunk validation (chunk schema REQUIRED)
139
- * @param metadata - Optional trace metadata for observability (label, description)
140
- * @returns AsyncIterable yielding validated chunks
141
- *
142
- * @example
143
- * ```typescript
144
- * const ChunkSchema = z.object({
145
- * id: z.string(),
146
- * choices: z.array(z.object({
147
- * delta: z.object({
148
- * content: z.string().optional(),
149
- * }),
150
- * })),
151
- * });
152
- *
153
- * const stream = client.streamApiRequest(
154
- * {
155
- * method: 'POST',
156
- * path: '/v1/chat/completions',
157
- * body: {
158
- * model: 'gpt-4',
159
- * stream: true,
160
- * messages: [{ role: 'user', content: 'Hello!' }],
161
- * },
162
- * },
163
- * { chunk: ChunkSchema },
164
- * { label: 'openai.chatCompletions', description: 'Stream chat completion' }
165
- * );
166
- *
167
- * for await (const chunk of stream) {
168
- * console.log(chunk.choices[0]?.delta?.content);
169
- * }
170
- * ```
171
- */
172
- streamApiRequest<TBody, TChunk>(
173
- options: ApiRequestOptions<TBody>,
174
- schema: StreamApiRequestSchema<TBody, TChunk>,
175
- metadata?: TraceMetadata,
176
- ): AsyncIterable<TChunk>;
177
- }
@@ -52,7 +52,7 @@ export default api({
52
52
  const result = await ctx.integrations.cohere.apiRequest(
53
53
  {
54
54
  method: "POST",
55
- path: "/v1/chat",
55
+ path: "/chat",
56
56
  body: {
57
57
  model: "command-r-plus",
58
58
  message: message,
@@ -81,7 +81,7 @@ const EmbedResponseSchema = z.object({
81
81
  const result = await ctx.integrations.cohere.apiRequest(
82
82
  {
83
83
  method: "POST",
84
- path: "/v1/embed",
84
+ path: "/embed",
85
85
  body: {
86
86
  model: "embed-english-v3.0",
87
87
  texts: ["Hello world", "How are you?"],
@@ -115,7 +115,7 @@ const ClassifyResponseSchema = z.object({
115
115
  const result = await ctx.integrations.cohere.apiRequest(
116
116
  {
117
117
  method: "POST",
118
- path: "/v1/classify",
118
+ path: "/classify",
119
119
  body: {
120
120
  model: "embed-english-v3.0",
121
121
  inputs: ["This product is amazing!", "Terrible experience, never again"],
@@ -159,7 +159,7 @@ const documents = [
159
159
  const result = await ctx.integrations.cohere.apiRequest(
160
160
  {
161
161
  method: "POST",
162
- path: "/v1/rerank",
162
+ path: "/rerank",
163
163
  body: {
164
164
  model: "rerank-english-v3.0",
165
165
  query: "What is the capital of the United States?",
@@ -193,7 +193,7 @@ const GenerateResponseSchema = z.object({
193
193
  const result = await ctx.integrations.cohere.apiRequest(
194
194
  {
195
195
  method: "POST",
196
- path: "/v1/generate",
196
+ path: "/generate",
197
197
  body: {
198
198
  model: "command",
199
199
  prompt: "Write a creative story about",
@@ -220,7 +220,7 @@ await cohere.embed({ ... });
220
220
 
221
221
  // CORRECT - Use apiRequest
222
222
  await ctx.integrations.cohere.apiRequest(
223
- { method: "POST", path: "/v1/chat", body: { ... } },
223
+ { method: "POST", path: "/chat", body: { ... } },
224
224
  { response: ChatResponseSchema }
225
225
  );
226
226
  ```
@@ -234,7 +234,7 @@ When creating embeddings, specify the correct `input_type`:
234
234
  const docEmbeddings = await ctx.integrations.cohere.apiRequest(
235
235
  {
236
236
  method: "POST",
237
- path: "/v1/embed",
237
+ path: "/embed",
238
238
  body: {
239
239
  texts: documents,
240
240
  input_type: "search_document", // For documents
@@ -247,7 +247,7 @@ const docEmbeddings = await ctx.integrations.cohere.apiRequest(
247
247
  const queryEmbedding = await ctx.integrations.cohere.apiRequest(
248
248
  {
249
249
  method: "POST",
250
- path: "/v1/embed",
250
+ path: "/embed",
251
251
  body: {
252
252
  texts: [query],
253
253
  input_type: "search_query", // For queries
@@ -266,7 +266,7 @@ The classify endpoint requires labeled examples:
266
266
  const result = await ctx.integrations.cohere.apiRequest(
267
267
  {
268
268
  method: "POST",
269
- path: "/v1/classify",
269
+ path: "/classify",
270
270
  body: {
271
271
  inputs: ["Great product!"],
272
272
  // Missing examples!
@@ -279,7 +279,7 @@ const result = await ctx.integrations.cohere.apiRequest(
279
279
  const result = await ctx.integrations.cohere.apiRequest(
280
280
  {
281
281
  method: "POST",
282
- path: "/v1/classify",
282
+ path: "/classify",
283
283
  body: {
284
284
  inputs: ["Great product!"],
285
285
  examples: [
@@ -299,7 +299,7 @@ import { RestApiValidationError } from "@superblocksteam/sdk-api";
299
299
 
300
300
  try {
301
301
  const result = await ctx.integrations.cohere.apiRequest(
302
- { method: "POST", path: "/v1/chat", body: { ... } },
302
+ { method: "POST", path: "/chat", body: { ... } },
303
303
  { response: ChatResponseSchema }
304
304
  );
305
305
  } catch (error) {
@@ -10,7 +10,9 @@ Interact with Fireworks AI's fast inference platform for LLM chat completions an
10
10
 
11
11
  ## Usage
12
12
 
13
- ### Chat Completion
13
+ ### Step 1: List Available Models
14
+
15
+ Model availability varies by account. Before making requests, validate which models are deployed on your account:
14
16
 
15
17
  ```typescript
16
18
  import { api, z, fireworks } from "@superblocksteam/sdk-api";
@@ -18,6 +20,30 @@ import { api, z, fireworks } from "@superblocksteam/sdk-api";
18
20
  // Integration ID from the integrations panel
19
21
  const PROD_FIREWORKS = "a1b2c3d4-5678-90ab-cdef-fireworks001";
20
22
 
23
+ const ModelsResponseSchema = z.object({
24
+ data: z.array(
25
+ z.object({
26
+ id: z.string(),
27
+ object: z.string(),
28
+ }),
29
+ ),
30
+ });
31
+
32
+ const models = await ctx.integrations.fireworks.apiRequest(
33
+ {
34
+ method: "GET",
35
+ path: "/v1/models",
36
+ },
37
+ { response: ModelsResponseSchema },
38
+ );
39
+
40
+ // Use a model ID from the response in subsequent requests
41
+ const availableModelId = models.data[0]?.id;
42
+ ```
43
+
44
+ ### Chat Completion
45
+
46
+ ```typescript
21
47
  const ChatCompletionResponseSchema = z.object({
22
48
  id: z.string(),
23
49
  object: z.string(),
@@ -55,7 +81,7 @@ export default api({
55
81
  const result = await ctx.integrations.fireworks.apiRequest(
56
82
  {
57
83
  method: "POST",
58
- path: "/inference/v1/chat/completions",
84
+ path: "/v1/chat/completions",
59
85
  body: {
60
86
  model: "accounts/fireworks/models/llama-v3p1-70b-instruct",
61
87
  messages: [{ role: "user", content: prompt }],
@@ -76,7 +102,7 @@ export default api({
76
102
  const llama70b = await ctx.integrations.fireworks.apiRequest(
77
103
  {
78
104
  method: "POST",
79
- path: "/inference/v1/chat/completions",
105
+ path: "/v1/chat/completions",
80
106
  body: {
81
107
  model: "accounts/fireworks/models/llama-v3p1-70b-instruct",
82
108
  messages: [{ role: "user", content: "Complex task..." }],
@@ -89,7 +115,7 @@ const llama70b = await ctx.integrations.fireworks.apiRequest(
89
115
  const llama8b = await ctx.integrations.fireworks.apiRequest(
90
116
  {
91
117
  method: "POST",
92
- path: "/inference/v1/chat/completions",
118
+ path: "/v1/chat/completions",
93
119
  body: {
94
120
  model: "accounts/fireworks/models/llama-v3p1-8b-instruct",
95
121
  messages: [{ role: "user", content: "Simple task..." }],
@@ -102,7 +128,7 @@ const llama8b = await ctx.integrations.fireworks.apiRequest(
102
128
  const mixtral = await ctx.integrations.fireworks.apiRequest(
103
129
  {
104
130
  method: "POST",
105
- path: "/inference/v1/chat/completions",
131
+ path: "/v1/chat/completions",
106
132
  body: {
107
133
  model: "accounts/fireworks/models/mixtral-8x7b-instruct",
108
134
  messages: [{ role: "user", content: "..." }],
@@ -115,7 +141,7 @@ const mixtral = await ctx.integrations.fireworks.apiRequest(
115
141
  const qwen = await ctx.integrations.fireworks.apiRequest(
116
142
  {
117
143
  method: "POST",
118
- path: "/inference/v1/chat/completions",
144
+ path: "/v1/chat/completions",
119
145
  body: {
120
146
  model: "accounts/fireworks/models/qwen2p5-coder-32b-instruct",
121
147
  messages: [{ role: "user", content: "Write code..." }],
@@ -147,7 +173,7 @@ const EmbeddingsResponseSchema = z.object({
147
173
  const result = await ctx.integrations.fireworks.apiRequest(
148
174
  {
149
175
  method: "POST",
150
- path: "/inference/v1/embeddings",
176
+ path: "/v1/embeddings",
151
177
  body: {
152
178
  model: "accounts/fireworks/models/nomic-embed-text-v1.5",
153
179
  input: ["Hello world", "How are you?"],
@@ -188,7 +214,7 @@ const FunctionCallResponseSchema = z.object({
188
214
  const result = await ctx.integrations.fireworks.apiRequest(
189
215
  {
190
216
  method: "POST",
191
- path: "/inference/v1/chat/completions",
217
+ path: "/v1/chat/completions",
192
218
  body: {
193
219
  model: "accounts/fireworks/models/firefunction-v2",
194
220
  messages: [{ role: "user", content: "What's the weather in Paris?" }],
@@ -220,7 +246,7 @@ const result = await ctx.integrations.fireworks.apiRequest(
220
246
  const result = await ctx.integrations.fireworks.apiRequest(
221
247
  {
222
248
  method: "POST",
223
- path: "/inference/v1/chat/completions",
249
+ path: "/v1/chat/completions",
224
250
  body: {
225
251
  model: "accounts/fireworks/models/llama-v3p1-70b-instruct",
226
252
  messages: [{ role: "user", content: "List 3 colors in JSON format" }],
@@ -239,7 +265,7 @@ const data = JSON.parse(result.choices[0]?.message.content ?? "{}");
239
265
  const result = await ctx.integrations.fireworks.apiRequest(
240
266
  {
241
267
  method: "POST",
242
- path: "/inference/v1/chat/completions",
268
+ path: "/v1/chat/completions",
243
269
  body: {
244
270
  model: "accounts/fireworks/models/llama-v3p1-70b-instruct",
245
271
  messages: [{ role: "user", content: "Generate user data" }],
@@ -276,7 +302,7 @@ await fireworks.complete({ ... });
276
302
 
277
303
  // CORRECT - Use apiRequest
278
304
  await ctx.integrations.fireworks.apiRequest(
279
- { method: "POST", path: "/inference/v1/chat/completions", body: { ... } },
305
+ { method: "POST", path: "/v1/chat/completions", body: { ... } },
280
306
  { response: ChatCompletionResponseSchema }
281
307
  );
282
308
  ```
@@ -301,18 +327,18 @@ const body = {
301
327
 
302
328
  ### API Path
303
329
 
304
- Fireworks uses `/inference/v1/` prefix:
330
+ The integration's base URL already includes `https://api.fireworks.ai/inference`, so paths should start with `/v1/`:
305
331
 
306
332
  ```typescript
307
- // WRONG - Missing inference prefix
333
+ // WRONG - Duplicates the /inference prefix (base URL already includes it)
308
334
  await ctx.integrations.fireworks.apiRequest(
309
- { method: "POST", path: "/v1/chat/completions", body: { ... } },
335
+ { method: "POST", path: "/inference/v1/chat/completions", body: { ... } },
310
336
  { response: schema }
311
337
  );
312
338
 
313
- // CORRECT - Include inference prefix
339
+ // CORRECT - Start with /v1/ (the integration prepends /inference automatically)
314
340
  await ctx.integrations.fireworks.apiRequest(
315
- { method: "POST", path: "/inference/v1/chat/completions", body: { ... } },
341
+ { method: "POST", path: "/v1/chat/completions", body: { ... } },
316
342
  { response: schema }
317
343
  );
318
344
  ```
@@ -347,7 +373,7 @@ import { RestApiValidationError } from "@superblocksteam/sdk-api";
347
373
 
348
374
  try {
349
375
  const result = await ctx.integrations.fireworks.apiRequest(
350
- { method: "POST", path: "/inference/v1/chat/completions", body: { ... } },
376
+ { method: "POST", path: "/v1/chat/completions", body: { ... } },
351
377
  { response: ChatCompletionResponseSchema }
352
378
  );
353
379
  } catch (error) {
@@ -13,7 +13,7 @@ Run reports, get real-time data, and interact with Google Analytics 4 properties
13
13
  ### Run a Report
14
14
 
15
15
  ```typescript
16
- import { api, z, googleanalytics } from "@superblocksteam/sdk-api";
16
+ import { api, z, googleAnalytics } from "@superblocksteam/sdk-api";
17
17
 
18
18
  // Integration ID from the integrations panel
19
19
  const PROD_GA4 = "a1b2c3d4-5678-90ab-cdef-ga4000000001";
@@ -46,7 +46,7 @@ const ReportResponseSchema = z.object({
46
46
 
47
47
  export default api({
48
48
  integrations: {
49
- ga: googleanalytics(PROD_GA4),
49
+ ga: googleAnalytics(PROD_GA4),
50
50
  },
51
51
  name: "GoogleAnalyticsExample",
52
52
  input: z.object({
@@ -13,7 +13,7 @@ Upload, download, and manage files in Google Drive.
13
13
  ### List Files
14
14
 
15
15
  ```typescript
16
- import { api, z, googledrive } from "@superblocksteam/sdk-api";
16
+ import { api, z, googleDrive } from "@superblocksteam/sdk-api";
17
17
 
18
18
  // Integration ID from the integrations panel
19
19
  const PROD_DRIVE = "a1b2c3d4-5678-90ab-cdef-gdrive000001";
@@ -45,7 +45,7 @@ const ListFilesResponseSchema = z.object({
45
45
 
46
46
  export default api({
47
47
  integrations: {
48
- drive: googledrive(PROD_DRIVE),
48
+ drive: googleDrive(PROD_DRIVE),
49
49
  },
50
50
  name: "GoogleDriveExample",
51
51
  input: z.object({