@sqlrooms/ai-config 0.28.0-rc.0 → 0.28.1-rc.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 +81 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1 +1,81 @@
|
|
|
1
|
-
|
|
1
|
+
Zod schemas and default config helpers for SQLRooms AI slices.
|
|
2
|
+
|
|
3
|
+
Use this package to validate persisted AI state and to bootstrap AI/AI-settings configuration safely.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @sqlrooms/ai-config
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Exports
|
|
12
|
+
|
|
13
|
+
- `AiSliceConfig`
|
|
14
|
+
- `createDefaultAiConfig()`
|
|
15
|
+
- `AiSettingsSliceConfig`
|
|
16
|
+
- `AnalysisSessionSchema`, `AnalysisResultSchema`, `ErrorMessageSchema`
|
|
17
|
+
- `ToolUIPart`, `UIMessagePart` types
|
|
18
|
+
|
|
19
|
+
## Basic usage
|
|
20
|
+
|
|
21
|
+
### Validate and load AI session config
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import {AiSliceConfig, createDefaultAiConfig} from '@sqlrooms/ai-config';
|
|
25
|
+
|
|
26
|
+
const raw = localStorage.getItem('my-ai-config');
|
|
27
|
+
|
|
28
|
+
const aiConfig = raw
|
|
29
|
+
? AiSliceConfig.parse(JSON.parse(raw))
|
|
30
|
+
: createDefaultAiConfig();
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Validate provider/model settings config
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
import {AiSettingsSliceConfig} from '@sqlrooms/ai-config';
|
|
37
|
+
|
|
38
|
+
const rawSettings = {
|
|
39
|
+
providers: {
|
|
40
|
+
openai: {
|
|
41
|
+
baseUrl: 'https://api.openai.com/v1',
|
|
42
|
+
apiKey: '',
|
|
43
|
+
models: [{modelName: 'gpt-4.1'}],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
customModels: [],
|
|
47
|
+
modelParameters: {
|
|
48
|
+
maxSteps: 30,
|
|
49
|
+
additionalInstruction: '',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const aiSettings = AiSettingsSliceConfig.parse(rawSettings);
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Using with `persistSliceConfigs`
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
import {AiSettingsSliceConfig, AiSliceConfig} from '@sqlrooms/ai-config';
|
|
60
|
+
import {createRoomStore, persistSliceConfigs} from '@sqlrooms/room-shell';
|
|
61
|
+
|
|
62
|
+
const persistence = {
|
|
63
|
+
name: 'my-app-storage',
|
|
64
|
+
sliceConfigSchemas: {
|
|
65
|
+
ai: AiSliceConfig,
|
|
66
|
+
aiSettings: AiSettingsSliceConfig,
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
createRoomStore(
|
|
71
|
+
persistSliceConfigs(persistence, (set, get, store) => ({
|
|
72
|
+
// ...your slices here
|
|
73
|
+
})),
|
|
74
|
+
);
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Related packages
|
|
78
|
+
|
|
79
|
+
- `@sqlrooms/ai-core` for core AI slice logic
|
|
80
|
+
- `@sqlrooms/ai-settings` for provider/model settings UI + state
|
|
81
|
+
- `@sqlrooms/ai` for higher-level AI package integration
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sqlrooms/ai-config",
|
|
3
|
-
"version": "0.28.
|
|
3
|
+
"version": "0.28.1-rc.0",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"typecheck": "tsc --noEmit",
|
|
30
30
|
"typedoc": "typedoc"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "1e0dcae95d1ccdbcd1b32df1d647d0f794b94e5e"
|
|
33
33
|
}
|