@aippy/runtime 0.2.6-dev.0 → 0.2.7-dev.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/dist/ai/index.js CHANGED
@@ -1,20 +1,22 @@
1
- import { D as s, i as E, j as o, h as _, U as i, f as p, g as T, k as e, a as C, b as U, c as n, e as A, d as D, m as O, l as I, n as L, p as t } from "../errors-3xwlPAB-.js";
1
+ import { D as E, i, j as p, h as _, U as T, f as e, g as C, k as U, a as n, b as t, c as A, e as D, d as O, m as I, l as L, n as m, p as N } from "../errors-DWRVLkVz.js";
2
+ import "react";
3
+ import "../bridge-DdAH4txB.js";
2
4
  export {
3
- s as DEFAULT_BASE_URL,
4
- E as DEFAULT_CHAT_MODEL,
5
- o as DEFAULT_CHAT_SYSTEM,
5
+ E as DEFAULT_BASE_URL,
6
+ i as DEFAULT_CHAT_MODEL,
7
+ p as DEFAULT_CHAT_SYSTEM,
6
8
  _ as DEFAULT_UI_BASE_URL,
7
- i as UI_CHAT_ENDPOINT,
8
- p as UI_COMPLETION_ENDPOINT,
9
- T as UI_OBJECT_ENDPOINT,
10
- e as abortedError,
11
- C as aippy,
12
- U as aippyChatConfig,
13
- n as aippyCompletionConfig,
14
- A as aippyObjectBaseConfig,
15
- D as aippyObjectConfig,
16
- O as missingTokenError,
17
- I as networkError,
18
- L as normalizeError,
19
- t as parseError
9
+ T as UI_CHAT_ENDPOINT,
10
+ e as UI_COMPLETION_ENDPOINT,
11
+ C as UI_OBJECT_ENDPOINT,
12
+ U as abortedError,
13
+ n as aippy,
14
+ t as aippyChatConfig,
15
+ A as aippyCompletionConfig,
16
+ D as aippyObjectBaseConfig,
17
+ O as aippyObjectConfig,
18
+ I as missingTokenError,
19
+ L as networkError,
20
+ m as normalizeError,
21
+ N as parseError
20
22
  };
@@ -1,5 +1,5 @@
1
1
  import { OpenAICompatibleProvider } from '@ai-sdk/openai-compatible';
2
- import { AippyOpenAIConfig } from '../shared/config';
2
+ import { AippyOpenAIConfig } from '../shared';
3
3
  /**
4
4
  * The Aippy provider type - an OpenAI-compatible provider.
5
5
  */
@@ -25,25 +25,25 @@ export type AippyProvider = OpenAICompatibleProvider<string, string, string, str
25
25
  *
26
26
  * // Text generation
27
27
  * const text = await generateText({
28
- * model: provider('gpt-5'),
28
+ * model: provider('gpt-5-nano'),
29
29
  * prompt: 'Hello!',
30
30
  * });
31
31
  *
32
32
  * // Streaming
33
33
  * const stream = await streamText({
34
- * model: provider('gpt-5'),
34
+ * model: provider('gpt-5-nano'),
35
35
  * prompt: 'Tell me a story.',
36
36
  * });
37
37
  *
38
38
  * // Embeddings
39
39
  * const embedding = await embed({
40
- * model: provider.embedding('text-embedding-3-small'),
40
+ * model: provider.embeddingModel('text-embedding-3-small'),
41
41
  * value: 'Hello world',
42
42
  * });
43
43
  *
44
44
  * // Image generation
45
45
  * const image = await generateImage({
46
- * model: provider.imageModel('gpt-image-1.5'),
46
+ * model: provider.imageModel('gpt-image-1-mini'),
47
47
  * prompt: 'A cat',
48
48
  * });
49
49
  * ```
@@ -31,13 +31,17 @@ export interface AippyChatConfig extends AippyUIConfig {
31
31
  * If not provided, we use `${baseUrl}/chat`.
32
32
  */
33
33
  api?: string;
34
- /** Model identifier (defaults to 'gpt-5') */
34
+ /** Model identifier (defaults to 'gpt-5-nano') */
35
35
  model?: string;
36
36
  /** System prompt for the conversation (defaults to empty string) */
37
37
  system?: string;
38
38
  }
39
39
  /** Default model for chat */
40
- export declare const DEFAULT_CHAT_MODEL = "gpt-5";
40
+ export declare const DEFAULT_CHAT_MODEL = "gpt-5-nano";
41
+ /** Default model for image generation */
42
+ export declare const DEFAULT_IMAGE_MODEL = "gpt-image-1-mini";
43
+ /** Default model for embeddings */
44
+ export declare const DEFAULT_EMBEDDING_MODEL = "text-embedding-3-small";
41
45
  /** Default system prompt for chat */
42
46
  export declare const DEFAULT_CHAT_SYSTEM = "";
43
47
  /**
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shared fetch utilities for Aippy AI SDK.
3
+ * Used by both OpenAI-compatible (Core) and Data Stream Protocol (UI) paths.
4
+ */
5
+ /**
6
+ * Joins a base URL with a path segment.
7
+ * Uses native URL API for reliable URL resolution.
8
+ *
9
+ * @param baseUrl - The base URL (e.g., 'https://api.aippy.dev/api/aisdk/v1/ui/')
10
+ * @param path - The path segment to append (e.g., '/chat' or 'chat')
11
+ * @returns The joined URL string
12
+ *
13
+ * @example
14
+ * joinUrl('https://api.aippy.dev/api/aisdk/v1/ui/', '/chat')
15
+ * // => 'https://api.aippy.dev/api/aisdk/v1/ui/chat'
16
+ */
17
+ export declare function joinUrl(baseUrl: string, path: string): string;
18
+ /**
19
+ * Creates a fetch wrapper that injects Authorization header with a fresh token.
20
+ * Token is fetched asynchronously on every request to ensure it's always current.
21
+ *
22
+ * @returns A fetch function compatible with globalThis.fetch signature
23
+ *
24
+ * @example
25
+ * const authFetch = createAuthFetch();
26
+ * const response = await authFetch('https://api.example.com/endpoint', { method: 'POST' });
27
+ */
28
+ export declare function createAuthFetch(): typeof globalThis.fetch;
@@ -1,5 +1,6 @@
1
1
  /**
2
2
  * Shared utilities for Aippy AI SDK.
3
- * Re-exports config utilities used by both protocol paths.
3
+ * Re-exports config and fetch utilities used by both protocol paths.
4
4
  */
5
5
  export { DEFAULT_BASE_URL, DEFAULT_UI_BASE_URL, DEFAULT_CHAT_MODEL, DEFAULT_CHAT_SYSTEM, resolveOpenAIConfig, resolveUIConfig, type AippyOpenAIConfig, type AippyUIConfig, type AippyChatConfig, } from './config';
6
+ export { joinUrl, createAuthFetch } from './fetch';
@@ -1,4 +1,4 @@
1
- import { AippyUIConfig, AippyChatConfig } from '../shared/config';
1
+ import { AippyUIConfig, AippyChatConfig } from '../shared';
2
2
  import { UseCompletionOptions } from 'ai';
3
3
  import { AippyUseChatOptions, UseObjectOptions, UseObjectConfigWithSchema } from './types';
4
4
  /**
@@ -23,7 +23,7 @@ import { AippyUseChatOptions, UseObjectOptions, UseObjectConfigWithSchema } from
23
23
  * const { messages } = useChat(config);
24
24
  * ```
25
25
  */
26
- export declare function aippyChatConfig(config?: AippyChatConfig): Promise<AippyUseChatOptions>;
26
+ export declare function aippyChatConfig(config?: AippyChatConfig): AippyUseChatOptions;
27
27
  /**
28
28
  * Creates configuration for the useCompletion hook.
29
29
  *
@@ -39,7 +39,7 @@ export declare function aippyChatConfig(config?: AippyChatConfig): Promise<Aippy
39
39
  * const { completion, input, handleSubmit } = useCompletion(config);
40
40
  * ```
41
41
  */
42
- export declare function aippyCompletionConfig(config?: AippyUIConfig): Promise<UseCompletionOptions>;
42
+ export declare function aippyCompletionConfig(config?: AippyUIConfig): UseCompletionOptions;
43
43
  /**
44
44
  * Configuration options for aippyObjectConfig.
45
45
  */
@@ -23,7 +23,7 @@ function p(e) {
23
23
  }
24
24
  };
25
25
  }
26
- const r = "0.2.6-dev.0", a = {
26
+ const r = "0.2.7-dev.0", a = {
27
27
  version: r
28
28
  }, i = a.version, t = "@aippy/runtime";
29
29
  function c() {