@blinkdotnew/sdk 0.3.0 → 0.4.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.
package/README.md CHANGED
@@ -75,7 +75,7 @@ This SDK powers every Blink-generated app with:
75
75
 
76
76
  - **🔐 Authentication**: JWT-based auth with automatic token management
77
77
  - **🗄️ Database**: PostgREST-compatible CRUD operations with advanced filtering
78
- - **🤖 AI**: Text generation, object generation, image creation, speech synthesis, and transcription
78
+ - **🤖 AI**: Text generation with web search, object generation, image creation, speech synthesis, and transcription
79
79
  - **📄 Data**: Extract text content from documents, spreadsheets, and more
80
80
  - **📁 Storage**: File upload, download, and management
81
81
  - **🌐 Universal**: Works on client-side and server-side
@@ -184,6 +184,19 @@ const { text } = await blink.ai.generateText({
184
184
  maxTokens: 150
185
185
  })
186
186
 
187
+ // Web search (OpenAI only) - get real-time information
188
+ const { text, sources } = await blink.ai.generateText({
189
+ prompt: 'Who is the current US president?',
190
+ search: true // Returns current info + source URLs
191
+ })
192
+
193
+ // Multi-step reasoning - for complex analysis
194
+ const { text } = await blink.ai.generateText({
195
+ prompt: 'Research and analyze tech trends',
196
+ search: true,
197
+ maxSteps: 5 // Default: 25 when tools used
198
+ })
199
+
187
200
  // Text generation with image content
188
201
  const { text } = await blink.ai.generateText({
189
202
  messages: [
@@ -247,6 +260,12 @@ await blink.ai.streamText(
247
260
  { prompt: 'Write a story...' },
248
261
  (chunk) => console.log(chunk)
249
262
  )
263
+
264
+ // Streaming with web search
265
+ await blink.ai.streamText(
266
+ { prompt: 'Latest AI news', search: true },
267
+ (chunk) => console.log(chunk)
268
+ )
250
269
  ```
251
270
 
252
271
  ### Data Operations
package/dist/index.d.mts CHANGED
@@ -320,7 +320,7 @@ declare class BlinkAIImpl implements BlinkAI {
320
320
  * @param options - An object containing either:
321
321
  * - `prompt`: a simple string prompt
322
322
  * - OR `messages`: an array of chat messages for conversation
323
- * - Plus optional model, maxTokens, temperature, signal parameters
323
+ * - Plus optional model, search, maxSteps, experimental_continueSteps, maxTokens, temperature, signal parameters
324
324
  *
325
325
  * @example
326
326
  * ```ts
@@ -371,6 +371,22 @@ declare class BlinkAIImpl implements BlinkAI {
371
371
  * maxTokens: 150,
372
372
  * temperature: 0.7
373
373
  * });
374
+ *
375
+ * // With web search (OpenAI models only)
376
+ * const { text, sources } = await blink.ai.generateText({
377
+ * prompt: "What are the latest developments in AI?",
378
+ * model: "gpt-4o-mini",
379
+ * search: true // Enables web search
380
+ * });
381
+ *
382
+ * // With advanced multi-step configuration
383
+ * const { text } = await blink.ai.generateText({
384
+ * prompt: "Research and analyze recent tech trends",
385
+ * model: "gpt-4o",
386
+ * search: true,
387
+ * maxSteps: 10, // Allow up to 10 reasoning steps
388
+ * experimental_continueSteps: true // Enable continued reasoning
389
+ * });
374
390
  * ```
375
391
  *
376
392
  * @returns Promise<TextGenerationResponse> - Object containing:
@@ -382,7 +398,7 @@ declare class BlinkAIImpl implements BlinkAI {
382
398
  /**
383
399
  * Streams text generation with real-time updates as the AI generates content.
384
400
  *
385
- * @param options - Same as generateText: either `prompt` or `messages` with optional parameters
401
+ * @param options - Same as generateText: either `prompt` or `messages` with optional parameters including search, maxSteps, experimental_continueSteps
386
402
  * @param onChunk - Callback function that receives each text chunk as it's generated
387
403
  *
388
404
  * @example
package/dist/index.d.ts CHANGED
@@ -320,7 +320,7 @@ declare class BlinkAIImpl implements BlinkAI {
320
320
  * @param options - An object containing either:
321
321
  * - `prompt`: a simple string prompt
322
322
  * - OR `messages`: an array of chat messages for conversation
323
- * - Plus optional model, maxTokens, temperature, signal parameters
323
+ * - Plus optional model, search, maxSteps, experimental_continueSteps, maxTokens, temperature, signal parameters
324
324
  *
325
325
  * @example
326
326
  * ```ts
@@ -371,6 +371,22 @@ declare class BlinkAIImpl implements BlinkAI {
371
371
  * maxTokens: 150,
372
372
  * temperature: 0.7
373
373
  * });
374
+ *
375
+ * // With web search (OpenAI models only)
376
+ * const { text, sources } = await blink.ai.generateText({
377
+ * prompt: "What are the latest developments in AI?",
378
+ * model: "gpt-4o-mini",
379
+ * search: true // Enables web search
380
+ * });
381
+ *
382
+ * // With advanced multi-step configuration
383
+ * const { text } = await blink.ai.generateText({
384
+ * prompt: "Research and analyze recent tech trends",
385
+ * model: "gpt-4o",
386
+ * search: true,
387
+ * maxSteps: 10, // Allow up to 10 reasoning steps
388
+ * experimental_continueSteps: true // Enable continued reasoning
389
+ * });
374
390
  * ```
375
391
  *
376
392
  * @returns Promise<TextGenerationResponse> - Object containing:
@@ -382,7 +398,7 @@ declare class BlinkAIImpl implements BlinkAI {
382
398
  /**
383
399
  * Streams text generation with real-time updates as the AI generates content.
384
400
  *
385
- * @param options - Same as generateText: either `prompt` or `messages` with optional parameters
401
+ * @param options - Same as generateText: either `prompt` or `messages` with optional parameters including search, maxSteps, experimental_continueSteps
386
402
  * @param onChunk - Callback function that receives each text chunk as it's generated
387
403
  *
388
404
  * @example
package/dist/index.js CHANGED
@@ -1707,7 +1707,7 @@ var BlinkAIImpl = class {
1707
1707
  * @param options - An object containing either:
1708
1708
  * - `prompt`: a simple string prompt
1709
1709
  * - OR `messages`: an array of chat messages for conversation
1710
- * - Plus optional model, maxTokens, temperature, signal parameters
1710
+ * - Plus optional model, search, maxSteps, experimental_continueSteps, maxTokens, temperature, signal parameters
1711
1711
  *
1712
1712
  * @example
1713
1713
  * ```ts
@@ -1758,6 +1758,22 @@ var BlinkAIImpl = class {
1758
1758
  * maxTokens: 150,
1759
1759
  * temperature: 0.7
1760
1760
  * });
1761
+ *
1762
+ * // With web search (OpenAI models only)
1763
+ * const { text, sources } = await blink.ai.generateText({
1764
+ * prompt: "What are the latest developments in AI?",
1765
+ * model: "gpt-4o-mini",
1766
+ * search: true // Enables web search
1767
+ * });
1768
+ *
1769
+ * // With advanced multi-step configuration
1770
+ * const { text } = await blink.ai.generateText({
1771
+ * prompt: "Research and analyze recent tech trends",
1772
+ * model: "gpt-4o",
1773
+ * search: true,
1774
+ * maxSteps: 10, // Allow up to 10 reasoning steps
1775
+ * experimental_continueSteps: true // Enable continued reasoning
1776
+ * });
1761
1777
  * ```
1762
1778
  *
1763
1779
  * @returns Promise<TextGenerationResponse> - Object containing:
@@ -1779,6 +1795,9 @@ var BlinkAIImpl = class {
1779
1795
  const requestBody = {
1780
1796
  model: options.model,
1781
1797
  stream: false,
1798
+ search: options.search,
1799
+ maxSteps: options.maxSteps,
1800
+ experimental_continueSteps: options.experimental_continueSteps,
1782
1801
  maxTokens: options.maxTokens,
1783
1802
  temperature: options.temperature,
1784
1803
  signal: options.signal
@@ -1814,7 +1833,7 @@ var BlinkAIImpl = class {
1814
1833
  /**
1815
1834
  * Streams text generation with real-time updates as the AI generates content.
1816
1835
  *
1817
- * @param options - Same as generateText: either `prompt` or `messages` with optional parameters
1836
+ * @param options - Same as generateText: either `prompt` or `messages` with optional parameters including search, maxSteps, experimental_continueSteps
1818
1837
  * @param onChunk - Callback function that receives each text chunk as it's generated
1819
1838
  *
1820
1839
  * @example
@@ -1857,6 +1876,9 @@ var BlinkAIImpl = class {
1857
1876
  {
1858
1877
  model: options.model,
1859
1878
  messages: options.messages,
1879
+ search: options.search,
1880
+ maxSteps: options.maxSteps,
1881
+ experimental_continueSteps: options.experimental_continueSteps,
1860
1882
  maxTokens: options.maxTokens,
1861
1883
  temperature: options.temperature,
1862
1884
  signal: options.signal