@aippy/runtime 0.2.5-dev.1 → 0.2.6
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 +0 -34
- package/dist/core/index.js +14 -15
- package/dist/device/index.js +256 -263
- package/dist/device/sensors.d.ts +8 -56
- package/dist/index/index.js +47 -93
- package/dist/index.d.ts +0 -2
- package/dist/leaderboard/index.js +22 -18
- package/dist/leaderboard/types.d.ts +2 -0
- package/dist/{runtime-CmoG3v2m.js → runtime-DjBdOttl.js} +76 -55
- package/package.json +36 -48
- package/dist/ai/errors.d.ts +0 -21
- package/dist/ai/index.d.ts +0 -45
- package/dist/ai/index.js +0 -20
- package/dist/ai/openai/index.d.ts +0 -11
- package/dist/ai/openai/provider.d.ts +0 -51
- package/dist/ai/shared/config.d.ts +0 -50
- package/dist/ai/shared/index.d.ts +0 -5
- package/dist/ai/ui/config.d.ts +0 -81
- package/dist/ai/ui/endpoints.d.ts +0 -16
- package/dist/ai/ui/index.d.ts +0 -15
- package/dist/ai/ui/types.d.ts +0 -46
- package/dist/ai.d.ts +0 -2
- package/dist/bridge-DdAH4txB.js +0 -222
- package/dist/core/native-bridge.d.ts +0 -9
- package/dist/errors-CDEBaBxB.js +0 -26
- package/dist/errors-D29z-Qus.js +0 -148
- package/dist/native-bridge-JAmH-zTN.js +0 -6
- package/dist/user/api.d.ts +0 -9
- package/dist/user/bridge.d.ts +0 -80
- package/dist/user/config.d.ts +0 -21
- package/dist/user/hooks.d.ts +0 -38
- package/dist/user/index.d.ts +0 -11
- package/dist/user/index.js +0 -28
- package/dist/user/types.d.ts +0 -111
- package/dist/user/userSessionInfo.d.ts +0 -6
- package/dist/user.d.ts +0 -2
- package/dist/userSessionInfo-CBk9ywXi.js +0 -186
package/package.json
CHANGED
|
@@ -1,48 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aippy/runtime",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Aippy Runtime SDK - Runtime SDK for Aippy projects",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
7
|
-
"main": "./dist/index
|
|
8
|
-
"module": "./dist/index
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
|
-
"import": "./dist/index
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts"
|
|
14
14
|
},
|
|
15
15
|
"./core": {
|
|
16
16
|
"import": "./dist/core/index.js",
|
|
17
|
-
"types": "./dist/core.d.ts"
|
|
17
|
+
"types": "./dist/core/index.d.ts"
|
|
18
18
|
},
|
|
19
19
|
"./device": {
|
|
20
20
|
"import": "./dist/device/index.js",
|
|
21
|
-
"types": "./dist/device.d.ts"
|
|
21
|
+
"types": "./dist/device/index.d.ts"
|
|
22
22
|
},
|
|
23
23
|
"./utils": {
|
|
24
24
|
"import": "./dist/utils/index.js",
|
|
25
|
-
"types": "./dist/utils.d.ts"
|
|
25
|
+
"types": "./dist/utils/index.d.ts"
|
|
26
26
|
},
|
|
27
27
|
"./tweaks": {
|
|
28
28
|
"import": "./dist/tweaks/index.js",
|
|
29
|
-
"types": "./dist/tweaks.d.ts"
|
|
29
|
+
"types": "./dist/tweaks/index.d.ts"
|
|
30
30
|
},
|
|
31
31
|
"./audio": {
|
|
32
32
|
"import": "./dist/audio/index.js",
|
|
33
|
-
"types": "./dist/audio.d.ts"
|
|
33
|
+
"types": "./dist/audio/index.d.ts"
|
|
34
34
|
},
|
|
35
35
|
"./leaderboard": {
|
|
36
36
|
"import": "./dist/leaderboard/index.js",
|
|
37
|
-
"types": "./dist/leaderboard.d.ts"
|
|
38
|
-
},
|
|
39
|
-
"./ai": {
|
|
40
|
-
"import": "./dist/ai/index.js",
|
|
41
|
-
"types": "./dist/ai.d.ts"
|
|
42
|
-
},
|
|
43
|
-
"./user": {
|
|
44
|
-
"import": "./dist/user/index.js",
|
|
45
|
-
"types": "./dist/user/index.d.ts"
|
|
37
|
+
"types": "./dist/leaderboard/index.d.ts"
|
|
46
38
|
}
|
|
47
39
|
},
|
|
48
40
|
"files": [
|
|
@@ -52,6 +44,30 @@
|
|
|
52
44
|
"publishConfig": {
|
|
53
45
|
"access": "public"
|
|
54
46
|
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"dev": "vite build --watch",
|
|
49
|
+
"build": "vite build && find dist -name '*.d.ts.map' -delete",
|
|
50
|
+
"type-check": "tsc --noEmit",
|
|
51
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
52
|
+
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
53
|
+
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
54
|
+
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
55
|
+
"clean": "rm -rf dist",
|
|
56
|
+
"prepublishOnly": "pnpm run clean && pnpm run type-check && pnpm run build",
|
|
57
|
+
"publish:patch": "pnpm prepublishOnly && pnpm version patch && pnpm publish --no-git-checks",
|
|
58
|
+
"publish:minor": "pnpm prepublishOnly && pnpm version minor && pnpm publish --no-git-checks",
|
|
59
|
+
"publish:major": "pnpm prepublishOnly && pnpm version major && pnpm publish --no-git-checks",
|
|
60
|
+
"publish:alpha": "pnpm prepublishOnly && pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
61
|
+
"publish:beta": "pnpm prepublishOnly && pnpm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
62
|
+
"publish:rc": "pnpm prepublishOnly && pnpm version prerelease --preid=rc && pnpm publish --tag rc --no-git-checks",
|
|
63
|
+
"publish:dev": "pnpm prepublishOnly && pnpm version prerelease --preid=dev && pnpm publish --tag dev --no-git-checks",
|
|
64
|
+
"audit": "pnpm audit --audit-level moderate",
|
|
65
|
+
"audit:fix": "pnpm audit --fix",
|
|
66
|
+
"security:check": "pnpm audit && pnpm outdated",
|
|
67
|
+
"prerelease": "pnpm run audit && pnpm run type-check && pnpm run lint && pnpm run build",
|
|
68
|
+
"release:dry": "npm publish --dry-run",
|
|
69
|
+
"test:build": "node -e \"require('./dist/index.js')\""
|
|
70
|
+
},
|
|
55
71
|
"keywords": [
|
|
56
72
|
"aippy",
|
|
57
73
|
"runtime",
|
|
@@ -78,12 +94,9 @@
|
|
|
78
94
|
"react": "^19.1.1",
|
|
79
95
|
"typescript": "^5.9.2",
|
|
80
96
|
"vite": "^7.1.7",
|
|
81
|
-
"vite-plugin-dts": "^4.5.4"
|
|
82
|
-
"zod": "^3.25.76"
|
|
97
|
+
"vite-plugin-dts": "^4.5.4"
|
|
83
98
|
},
|
|
84
99
|
"dependencies": {
|
|
85
|
-
"@ai-sdk/openai-compatible": "^2.0.4",
|
|
86
|
-
"ai": "^6.0.14",
|
|
87
100
|
"ua-parser-js": "^2.0.5"
|
|
88
101
|
},
|
|
89
102
|
"peerDependencies": {
|
|
@@ -93,30 +106,5 @@
|
|
|
93
106
|
"engines": {
|
|
94
107
|
"node": ">=20.0.0",
|
|
95
108
|
"pnpm": ">=10.0.0"
|
|
96
|
-
},
|
|
97
|
-
"scripts": {
|
|
98
|
-
"dev": "vite build --watch",
|
|
99
|
-
"build": "vite build && find dist -name '*.d.ts.map' -delete",
|
|
100
|
-
"type-check": "tsc --noEmit",
|
|
101
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
102
|
-
"lint:fix": "eslint src --ext .ts,.tsx --fix",
|
|
103
|
-
"format": "prettier --write \"src/**/*.{ts,tsx,json,md}\"",
|
|
104
|
-
"format:check": "prettier --check \"src/**/*.{ts,tsx,json,md}\"",
|
|
105
|
-
"clean": "rm -rf dist",
|
|
106
|
-
"publish:patch": "pnpm prepublishOnly && pnpm version patch && pnpm publish --no-git-checks",
|
|
107
|
-
"publish:minor": "pnpm prepublishOnly && pnpm version minor && pnpm publish --no-git-checks",
|
|
108
|
-
"publish:major": "pnpm prepublishOnly && pnpm version major && pnpm publish --no-git-checks",
|
|
109
|
-
"publish:alpha": "pnpm prepublishOnly && pnpm version prerelease --preid=alpha && pnpm publish --tag alpha --no-git-checks",
|
|
110
|
-
"publish:beta": "pnpm prepublishOnly && pnpm version prerelease --preid=beta && pnpm publish --tag beta --no-git-checks",
|
|
111
|
-
"publish:rc": "pnpm prepublishOnly && pnpm version prerelease --preid=rc && pnpm publish --tag rc --no-git-checks",
|
|
112
|
-
"publish:dev": "pnpm prepublishOnly && pnpm version prerelease --preid=dev && pnpm publish --tag dev --no-git-checks",
|
|
113
|
-
"audit": "pnpm audit --audit-level moderate",
|
|
114
|
-
"audit:fix": "pnpm audit --fix",
|
|
115
|
-
"security:check": "pnpm audit && pnpm outdated",
|
|
116
|
-
"prerelease": "pnpm run audit && pnpm run type-check && pnpm run lint && pnpm run build",
|
|
117
|
-
"release:dry": "npm publish --dry-run",
|
|
118
|
-
"test": "pnpm run build && node --test tests/*.test.mjs",
|
|
119
|
-
"test:file": "pnpm run build && node --test",
|
|
120
|
-
"test:build": "node -c dist/index.js"
|
|
121
109
|
}
|
|
122
|
-
}
|
|
110
|
+
}
|
package/dist/ai/errors.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AISDKError } from 'ai';
|
|
2
|
-
/**
|
|
3
|
-
* Normalizes a backend error response into an AISDKError.
|
|
4
|
-
*/
|
|
5
|
-
export declare function normalizeError(response: Response, body?: unknown): AISDKError;
|
|
6
|
-
/**
|
|
7
|
-
* Creates an error for missing user token.
|
|
8
|
-
*/
|
|
9
|
-
export declare function missingTokenError(): AISDKError;
|
|
10
|
-
/**
|
|
11
|
-
* Creates an error for aborted requests.
|
|
12
|
-
*/
|
|
13
|
-
export declare function abortedError(): AISDKError;
|
|
14
|
-
/**
|
|
15
|
-
* Creates an error for network failures.
|
|
16
|
-
*/
|
|
17
|
-
export declare function networkError(cause?: unknown): AISDKError;
|
|
18
|
-
/**
|
|
19
|
-
* Creates an error for parse failures.
|
|
20
|
-
*/
|
|
21
|
-
export declare function parseError(message: string): AISDKError;
|
package/dist/ai/index.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @aippy/runtime/ai - AI module for Aippy Runtime SDK
|
|
3
|
-
*
|
|
4
|
-
* This module provides two integration paths with Vercel AI SDK:
|
|
5
|
-
*
|
|
6
|
-
* ## Path 1: OpenAI-Compatible Provider (AI SDK Core)
|
|
7
|
-
*
|
|
8
|
-
* Use `aippy()` provider with AI SDK Core functions:
|
|
9
|
-
* - generateText / streamText
|
|
10
|
-
* - generateObject / streamObject
|
|
11
|
-
* - embed / embedMany
|
|
12
|
-
* - generateImage
|
|
13
|
-
*
|
|
14
|
-
* ```ts
|
|
15
|
-
* import { streamText } from 'ai';
|
|
16
|
-
* import { aippy } from '@aippy/runtime/ai';
|
|
17
|
-
*
|
|
18
|
-
* const provider = aippy();
|
|
19
|
-
* const result = await streamText({
|
|
20
|
-
* model: provider('gpt-5'),
|
|
21
|
-
* prompt: 'Hello!',
|
|
22
|
-
* });
|
|
23
|
-
* ```
|
|
24
|
-
*
|
|
25
|
-
* ## Path 2: Data Stream Protocol (AI SDK UI / @ai-sdk/react)
|
|
26
|
-
*
|
|
27
|
-
* Use config builders with @ai-sdk/react hooks:
|
|
28
|
-
* - useChat → aippyChatConfig()
|
|
29
|
-
* - useCompletion → aippyCompletionConfig()
|
|
30
|
-
* - useObject → aippyObjectConfig()
|
|
31
|
-
*
|
|
32
|
-
* ```tsx
|
|
33
|
-
* import { useChat } from '@ai-sdk/react';
|
|
34
|
-
* import { aippyChatConfig } from '@aippy/runtime/ai';
|
|
35
|
-
*
|
|
36
|
-
* const { messages, handleSubmit } = useChat(aippyChatConfig());
|
|
37
|
-
* ```
|
|
38
|
-
*
|
|
39
|
-
* @module
|
|
40
|
-
*/
|
|
41
|
-
export { aippy, type AippyProvider } from './openai';
|
|
42
|
-
export type { AippyOpenAIConfig } from './openai';
|
|
43
|
-
export { aippyChatConfig, aippyCompletionConfig, aippyObjectConfig, aippyObjectBaseConfig, type AippyObjectConfigOptions, type AippyUseChatOptions, type UseObjectOptions, type UseObjectConfigWithSchema, type AippyUIConfig, type AippyChatConfig, UI_CHAT_ENDPOINT, UI_COMPLETION_ENDPOINT, UI_OBJECT_ENDPOINT, } from './ui';
|
|
44
|
-
export { DEFAULT_BASE_URL, DEFAULT_UI_BASE_URL, DEFAULT_CHAT_MODEL, DEFAULT_CHAT_SYSTEM, } from './shared';
|
|
45
|
-
export { normalizeError, missingTokenError, abortedError, networkError, parseError, } from './errors';
|
package/dist/ai/index.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
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-D29z-Qus.js";
|
|
2
|
-
export {
|
|
3
|
-
s as DEFAULT_BASE_URL,
|
|
4
|
-
E as DEFAULT_CHAT_MODEL,
|
|
5
|
-
o as DEFAULT_CHAT_SYSTEM,
|
|
6
|
-
_ 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
|
|
20
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenAI-compatible module for Aippy AI SDK.
|
|
3
|
-
*
|
|
4
|
-
* Provides the `aippy()` provider factory for use with AI SDK Core functions:
|
|
5
|
-
* - generateText / streamText
|
|
6
|
-
* - generateObject / streamObject
|
|
7
|
-
* - embed / embedMany
|
|
8
|
-
* - generateImage
|
|
9
|
-
*/
|
|
10
|
-
export { aippy, type AippyProvider } from './provider';
|
|
11
|
-
export type { AippyOpenAIConfig } from '../shared/config';
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { OpenAICompatibleProvider } from '@ai-sdk/openai-compatible';
|
|
2
|
-
import { AippyOpenAIConfig } from '../shared/config';
|
|
3
|
-
/**
|
|
4
|
-
* The Aippy provider type - an OpenAI-compatible provider.
|
|
5
|
-
*/
|
|
6
|
-
export type AippyProvider = OpenAICompatibleProvider<string, string, string, string>;
|
|
7
|
-
/**
|
|
8
|
-
* Creates an Aippy AI provider that routes requests through the backend proxy.
|
|
9
|
-
*
|
|
10
|
-
* This provider is for use with AI SDK Core functions:
|
|
11
|
-
* - `generateText` / `streamText` - Text generation
|
|
12
|
-
* - `generateObject` / `streamObject` - Structured object generation
|
|
13
|
-
* - `embed` / `embedMany` - Text embeddings
|
|
14
|
-
* - `generateImage` - Image generation
|
|
15
|
-
*
|
|
16
|
-
* @param config - Optional configuration to override defaults
|
|
17
|
-
* @returns An AI SDK Core compatible provider
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* import { generateText, streamText, embed, generateImage } from 'ai';
|
|
22
|
-
* import { aippy } from '@aippy/runtime/ai';
|
|
23
|
-
*
|
|
24
|
-
* const provider = aippy();
|
|
25
|
-
*
|
|
26
|
-
* // Text generation
|
|
27
|
-
* const text = await generateText({
|
|
28
|
-
* model: provider('gpt-5'),
|
|
29
|
-
* prompt: 'Hello!',
|
|
30
|
-
* });
|
|
31
|
-
*
|
|
32
|
-
* // Streaming
|
|
33
|
-
* const stream = await streamText({
|
|
34
|
-
* model: provider('gpt-5'),
|
|
35
|
-
* prompt: 'Tell me a story.',
|
|
36
|
-
* });
|
|
37
|
-
*
|
|
38
|
-
* // Embeddings
|
|
39
|
-
* const embedding = await embed({
|
|
40
|
-
* model: provider.embedding('text-embedding-3-small'),
|
|
41
|
-
* value: 'Hello world',
|
|
42
|
-
* });
|
|
43
|
-
*
|
|
44
|
-
* // Image generation
|
|
45
|
-
* const image = await generateImage({
|
|
46
|
-
* model: provider.imageModel('gpt-image-1.5'),
|
|
47
|
-
* prompt: 'A cat',
|
|
48
|
-
* });
|
|
49
|
-
* ```
|
|
50
|
-
*/
|
|
51
|
-
export declare function aippy(config?: AippyOpenAIConfig): AippyProvider;
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared configuration for Aippy AI SDK.
|
|
3
|
-
* Used by both OpenAI-compatible (Core) and Data Stream Protocol (UI) paths.
|
|
4
|
-
*/
|
|
5
|
-
/** Default backend base URL for OpenAI-compatible endpoints */
|
|
6
|
-
export declare const DEFAULT_BASE_URL: string;
|
|
7
|
-
/** Default backend base URL for UI (Data Stream Protocol) endpoints */
|
|
8
|
-
export declare const DEFAULT_UI_BASE_URL: string;
|
|
9
|
-
/**
|
|
10
|
-
* Configuration for OpenAI-compatible provider (AI SDK Core).
|
|
11
|
-
*/
|
|
12
|
-
export interface AippyOpenAIConfig {
|
|
13
|
-
/** Backend proxy URL for OpenAI-compatible endpoints (defaults to DEFAULT_BASE_URL) */
|
|
14
|
-
baseUrl?: string;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Configuration for Data Stream Protocol endpoints (AI SDK UI).
|
|
18
|
-
*/
|
|
19
|
-
export interface AippyUIConfig {
|
|
20
|
-
/** Backend proxy URL for UI endpoints (defaults to DEFAULT_UI_BASE_URL) */
|
|
21
|
-
baseUrl?: string;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Configuration for useChat hook with model and system prompt.
|
|
25
|
-
*/
|
|
26
|
-
export interface AippyChatConfig extends AippyUIConfig {
|
|
27
|
-
/**
|
|
28
|
-
* Optional API endpoint override for useChat.
|
|
29
|
-
* Useful for local dev proxies (e.g. Vite) to avoid cross-origin streaming.
|
|
30
|
-
*
|
|
31
|
-
* If not provided, we use `${baseUrl}/chat`.
|
|
32
|
-
*/
|
|
33
|
-
api?: string;
|
|
34
|
-
/** Model identifier (defaults to 'gpt-5') */
|
|
35
|
-
model?: string;
|
|
36
|
-
/** System prompt for the conversation (defaults to empty string) */
|
|
37
|
-
system?: string;
|
|
38
|
-
}
|
|
39
|
-
/** Default model for chat */
|
|
40
|
-
export declare const DEFAULT_CHAT_MODEL = "gpt-5";
|
|
41
|
-
/** Default system prompt for chat */
|
|
42
|
-
export declare const DEFAULT_CHAT_SYSTEM = "";
|
|
43
|
-
/**
|
|
44
|
-
* Resolves OpenAI-compatible configuration with defaults.
|
|
45
|
-
*/
|
|
46
|
-
export declare function resolveOpenAIConfig(config?: AippyOpenAIConfig): Required<AippyOpenAIConfig>;
|
|
47
|
-
/**
|
|
48
|
-
* Resolves UI (Data Stream Protocol) configuration with defaults.
|
|
49
|
-
*/
|
|
50
|
-
export declare function resolveUIConfig(config?: AippyUIConfig): Required<AippyUIConfig>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared utilities for Aippy AI SDK.
|
|
3
|
-
* Re-exports config utilities used by both protocol paths.
|
|
4
|
-
*/
|
|
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';
|
package/dist/ai/ui/config.d.ts
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { AippyUIConfig, AippyChatConfig } from '../shared/config';
|
|
2
|
-
import { UseCompletionOptions } from 'ai';
|
|
3
|
-
import { AippyUseChatOptions, UseObjectOptions, UseObjectConfigWithSchema } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Creates configuration for the useChat hook.
|
|
6
|
-
*
|
|
7
|
-
* @param config - Optional configuration to override defaults
|
|
8
|
-
* @returns Promise resolving to configuration object to spread into useChat()
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```tsx
|
|
12
|
-
* import { useChat } from '@ai-sdk/react';
|
|
13
|
-
* import { aippyChatConfig } from '@aippy/runtime/ai';
|
|
14
|
-
*
|
|
15
|
-
* const chatConfig = await aippyChatConfig();
|
|
16
|
-
* const { messages, input, handleSubmit } = useChat(chatConfig);
|
|
17
|
-
*
|
|
18
|
-
* // With custom model and system prompt
|
|
19
|
-
* const config = await aippyChatConfig({
|
|
20
|
-
* model: 'claude-3',
|
|
21
|
-
* system: 'You are a helpful assistant.',
|
|
22
|
-
* });
|
|
23
|
-
* const { messages } = useChat(config);
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
26
|
-
export declare function aippyChatConfig(config?: AippyChatConfig): Promise<AippyUseChatOptions>;
|
|
27
|
-
/**
|
|
28
|
-
* Creates configuration for the useCompletion hook.
|
|
29
|
-
*
|
|
30
|
-
* @param config - Optional configuration to override defaults
|
|
31
|
-
* @returns Promise resolving to configuration object to spread into useCompletion()
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```tsx
|
|
35
|
-
* import { useCompletion } from '@ai-sdk/react';
|
|
36
|
-
* import { aippyCompletionConfig } from '@aippy/runtime/ai';
|
|
37
|
-
*
|
|
38
|
-
* const config = await aippyCompletionConfig();
|
|
39
|
-
* const { completion, input, handleSubmit } = useCompletion(config);
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
export declare function aippyCompletionConfig(config?: AippyUIConfig): Promise<UseCompletionOptions>;
|
|
43
|
-
/**
|
|
44
|
-
* Configuration options for aippyObjectConfig.
|
|
45
|
-
*/
|
|
46
|
-
export interface AippyObjectConfigOptions extends AippyUIConfig {
|
|
47
|
-
/**
|
|
48
|
-
* Schema identifier registered on the backend.
|
|
49
|
-
* Required for useObject to work with the Aippy backend.
|
|
50
|
-
*/
|
|
51
|
-
schemaId: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Creates configuration for the useObject hook.
|
|
55
|
-
*
|
|
56
|
-
* Note: Unlike useChat/useCompletion, useObject requires a schema.
|
|
57
|
-
* With the Aippy backend, we use schemaId to reference a pre-registered
|
|
58
|
-
* schema on the server (instead of passing the schema directly).
|
|
59
|
-
*
|
|
60
|
-
* @param options - Configuration including required schemaId
|
|
61
|
-
* @returns Promise resolving to configuration object to spread into useObject()
|
|
62
|
-
*
|
|
63
|
-
* @example
|
|
64
|
-
* ```tsx
|
|
65
|
-
* import { useObject } from '@ai-sdk/react';
|
|
66
|
-
* import { aippyObjectConfig } from '@aippy/runtime/ai';
|
|
67
|
-
*
|
|
68
|
-
* // The schemaId must match a schema registered on your backend
|
|
69
|
-
* const config = await aippyObjectConfig({ schemaId: 'user-profile' });
|
|
70
|
-
* const { object, submit } = useObject(config);
|
|
71
|
-
* ```
|
|
72
|
-
*/
|
|
73
|
-
export declare function aippyObjectConfig(options: AippyObjectConfigOptions): Promise<UseObjectConfigWithSchema>;
|
|
74
|
-
/**
|
|
75
|
-
* Creates base configuration for useObject without schemaId.
|
|
76
|
-
* Use this when you want to pass schemaId separately.
|
|
77
|
-
*
|
|
78
|
-
* @param config - Optional configuration to override defaults
|
|
79
|
-
* @returns Promise resolving to base configuration object (api + headers only)
|
|
80
|
-
*/
|
|
81
|
-
export declare function aippyObjectBaseConfig(config?: AippyUIConfig): Promise<UseObjectOptions>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* UI endpoint path constants for Data Stream Protocol.
|
|
3
|
-
*
|
|
4
|
-
* These endpoints are served by the Aippy backend and return
|
|
5
|
-
* responses in AI SDK Data Stream Protocol format.
|
|
6
|
-
*
|
|
7
|
-
* Required response headers from backend:
|
|
8
|
-
* - Content-Type: text/event-stream
|
|
9
|
-
* - x-vercel-ai-ui-message-stream: v1
|
|
10
|
-
*/
|
|
11
|
-
/** Endpoint for useChat hook */
|
|
12
|
-
export declare const UI_CHAT_ENDPOINT = "/chat";
|
|
13
|
-
/** Endpoint for useCompletion hook */
|
|
14
|
-
export declare const UI_COMPLETION_ENDPOINT = "/completion";
|
|
15
|
-
/** Endpoint for useObject hook */
|
|
16
|
-
export declare const UI_OBJECT_ENDPOINT = "/object";
|
package/dist/ai/ui/index.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI SDK UI module for Aippy AI SDK.
|
|
3
|
-
*
|
|
4
|
-
* Provides configuration builders for @ai-sdk/react hooks:
|
|
5
|
-
* - useChat → aippyChatConfig()
|
|
6
|
-
* - useCompletion → aippyCompletionConfig()
|
|
7
|
-
* - useObject → aippyObjectConfig()
|
|
8
|
-
*
|
|
9
|
-
* These hooks communicate with the Aippy backend using
|
|
10
|
-
* AI SDK Data Stream Protocol (SSE with x-vercel-ai-ui-message-stream: v1).
|
|
11
|
-
*/
|
|
12
|
-
export { aippyChatConfig, aippyCompletionConfig, aippyObjectConfig, aippyObjectBaseConfig, type AippyObjectConfigOptions, } from './config';
|
|
13
|
-
export type { AippyUseChatOptions, UseObjectOptions, UseObjectConfigWithSchema, } from './types';
|
|
14
|
-
export { UI_CHAT_ENDPOINT, UI_COMPLETION_ENDPOINT, UI_OBJECT_ENDPOINT, } from './endpoints';
|
|
15
|
-
export type { AippyUIConfig, AippyChatConfig } from '../shared/config';
|
package/dist/ai/ui/types.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { ChatTransport, UIMessage } from 'ai';
|
|
2
|
-
/**
|
|
3
|
-
* Body parameters for useChat requests (internal use).
|
|
4
|
-
*/
|
|
5
|
-
interface UseChatBody {
|
|
6
|
-
/** Model identifier (e.g., 'gpt-5', 'claude-3') */
|
|
7
|
-
model: string;
|
|
8
|
-
/** System prompt for the conversation */
|
|
9
|
-
system: string;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Configuration options for useChat hook with Aippy transport.
|
|
13
|
-
*
|
|
14
|
-
* This is a minimal wrapper around ChatTransport for type safety.
|
|
15
|
-
* Users can also directly use ChatTransport from 'ai' package.
|
|
16
|
-
*/
|
|
17
|
-
export interface AippyUseChatOptions<UI_MESSAGE extends UIMessage = UIMessage> {
|
|
18
|
-
/** Transport for custom API communication */
|
|
19
|
-
transport: ChatTransport<UI_MESSAGE>;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Base configuration for useObject hook.
|
|
23
|
-
*
|
|
24
|
-
* Similar to UseCompletionOptions but for useObject hook.
|
|
25
|
-
* We define this separately since useObject is from @ai-sdk/react, not 'ai'.
|
|
26
|
-
*/
|
|
27
|
-
export interface UseObjectOptions {
|
|
28
|
-
/** API endpoint URL */
|
|
29
|
-
api: string;
|
|
30
|
-
/** Headers to include in requests */
|
|
31
|
-
headers: Record<string, string>;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Extended configuration for useObject with schemaId.
|
|
35
|
-
*
|
|
36
|
-
* This is Aippy-specific: we use schemaId to reference a pre-registered
|
|
37
|
-
* schema on the backend instead of passing the schema directly.
|
|
38
|
-
*/
|
|
39
|
-
export interface UseObjectConfigWithSchema extends UseObjectOptions {
|
|
40
|
-
/**
|
|
41
|
-
* Schema identifier registered on the backend.
|
|
42
|
-
* This will be included in the request body.
|
|
43
|
-
*/
|
|
44
|
-
schemaId: string;
|
|
45
|
-
}
|
|
46
|
-
export type { UseChatBody };
|
package/dist/ai.d.ts
DELETED