@h-ai/ai 0.1.0-alpha.43 → 0.1.0-alpha.45
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 +10 -7
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -33,7 +33,7 @@ import { ai } from '@h-ai/ai'
|
|
|
33
33
|
const init = await ai.init({
|
|
34
34
|
llm: {
|
|
35
35
|
model: 'gpt-4o-mini',
|
|
36
|
-
apiKey: process.env.
|
|
36
|
+
apiKey: process.env.HAI_AI_LLM_APIKEY,
|
|
37
37
|
},
|
|
38
38
|
})
|
|
39
39
|
if (!init.success)
|
|
@@ -61,7 +61,7 @@ await vecdb.init({ type: 'lancedb', path: './ai-vec.db' })
|
|
|
61
61
|
const init = await ai.init({
|
|
62
62
|
llm: {
|
|
63
63
|
model: 'gpt-4o-mini',
|
|
64
|
-
apiKey: process.env.
|
|
64
|
+
apiKey: process.env.HAI_AI_LLM_APIKEY,
|
|
65
65
|
},
|
|
66
66
|
})
|
|
67
67
|
if (!init.success) {
|
|
@@ -89,7 +89,7 @@ import { ai } from '@h-ai/ai'
|
|
|
89
89
|
const storeProvider: AIStoreProvider = createMyStoreProvider()
|
|
90
90
|
|
|
91
91
|
await ai.init(
|
|
92
|
-
{ llm: { model: 'gpt-4o-mini', apiKey: process.env.
|
|
92
|
+
{ llm: { model: 'gpt-4o-mini', apiKey: process.env.HAI_AI_LLM_APIKEY } },
|
|
93
93
|
{ storeProvider },
|
|
94
94
|
)
|
|
95
95
|
|
|
@@ -216,7 +216,7 @@ if (setup.success) {
|
|
|
216
216
|
```ts
|
|
217
217
|
await ai.init({
|
|
218
218
|
llm: {
|
|
219
|
-
apiKey: process.env.
|
|
219
|
+
apiKey: process.env.HAI_AI_LLM_APIKEY,
|
|
220
220
|
},
|
|
221
221
|
audio: {
|
|
222
222
|
inheritLlmApiKey: true,
|
|
@@ -399,9 +399,9 @@ const manager = ai.context.createManager({
|
|
|
399
399
|
|
|
400
400
|
```yaml
|
|
401
401
|
llm:
|
|
402
|
-
apiKey:
|
|
403
|
-
baseUrl:
|
|
404
|
-
model:
|
|
402
|
+
apiKey: ''
|
|
403
|
+
baseUrl: https://api.openai.com/v1
|
|
404
|
+
model: gpt-4o-mini
|
|
405
405
|
api: chat # chat(默认)| responses | anthropic —— 底层 API 协议,对使用方透明
|
|
406
406
|
timeout: 60000
|
|
407
407
|
tempModelCacheTtl: 600000 # 临时模型客户端缓存 TTL(毫秒,默认 10 分钟)
|
|
@@ -440,6 +440,9 @@ memory:
|
|
|
440
440
|
writebackRelatedTopK: 20
|
|
441
441
|
```
|
|
442
442
|
|
|
443
|
+
通过 `core.config.load('ai', ...)` 加载时,约定环境变量优先于 YAML;
|
|
444
|
+
例如 `HAI_AI_LLM_APIKEY`、`HAI_AI_LLM_BASEURL`、`HAI_AI_LLM_MODEL`。
|
|
445
|
+
|
|
443
446
|
启用 mem0(真·嵌入式 mem0ai/oss 引擎):
|
|
444
447
|
|
|
445
448
|
```yaml
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@h-ai/ai",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.0-alpha.
|
|
4
|
+
"version": "0.1.0-alpha.45",
|
|
5
5
|
"description": "Hai Framework AI module (LLM, MCP, tools, and clients).",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"exports": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
"openai": "^6.17.0",
|
|
34
34
|
"ws": "^8.18.3",
|
|
35
35
|
"zod": "^4.4.3",
|
|
36
|
-
"@h-ai/api-contract": "0.1.0-alpha.
|
|
37
|
-
"@h-ai/
|
|
38
|
-
"@h-ai/
|
|
39
|
-
"@h-ai/
|
|
40
|
-
"@h-ai/vecdb": "0.1.0-alpha.
|
|
36
|
+
"@h-ai/api-contract": "0.1.0-alpha.45",
|
|
37
|
+
"@h-ai/core": "0.1.0-alpha.45",
|
|
38
|
+
"@h-ai/datapipe": "0.1.0-alpha.45",
|
|
39
|
+
"@h-ai/reldb": "0.1.0-alpha.45",
|
|
40
|
+
"@h-ai/vecdb": "0.1.0-alpha.45"
|
|
41
41
|
},
|
|
42
42
|
"optionalDependencies": {
|
|
43
43
|
"better-sqlite3": "^12.6.2"
|