@aigne/aigne-hub 0.4.8 → 0.4.9

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/cjs/blocklet-aigne-hub-model.js +4 -3
  3. package/lib/cjs/cli-aigne-hub-model.js +1 -1
  4. package/lib/cjs/index.d.ts +5 -1
  5. package/lib/cjs/index.js +8 -3
  6. package/lib/cjs/util/constants.d.ts +13 -0
  7. package/lib/cjs/util/constants.js +29 -0
  8. package/lib/cjs/util/credential.d.ts +24 -0
  9. package/lib/cjs/util/credential.js +223 -0
  10. package/lib/cjs/util/crypto.d.ts +4 -0
  11. package/lib/cjs/util/crypto.js +19 -0
  12. package/lib/cjs/util/model.d.ts +12 -0
  13. package/lib/cjs/util/model.js +201 -0
  14. package/lib/cjs/util/type.d.ts +58 -0
  15. package/lib/cjs/util/type.js +2 -0
  16. package/lib/dts/index.d.ts +5 -1
  17. package/lib/dts/util/constants.d.ts +13 -0
  18. package/lib/dts/util/credential.d.ts +24 -0
  19. package/lib/dts/util/crypto.d.ts +4 -0
  20. package/lib/dts/util/model.d.ts +12 -0
  21. package/lib/dts/util/type.d.ts +58 -0
  22. package/lib/esm/blocklet-aigne-hub-model.js +2 -1
  23. package/lib/esm/cli-aigne-hub-model.js +1 -1
  24. package/lib/esm/index.d.ts +5 -1
  25. package/lib/esm/index.js +7 -2
  26. package/lib/esm/util/constants.d.ts +13 -0
  27. package/lib/esm/util/constants.js +15 -0
  28. package/lib/esm/util/credential.d.ts +24 -0
  29. package/lib/esm/util/credential.js +211 -0
  30. package/lib/esm/util/crypto.d.ts +4 -0
  31. package/lib/esm/util/crypto.js +9 -0
  32. package/lib/esm/util/model.d.ts +12 -0
  33. package/lib/esm/{constants.js → util/model.js} +91 -18
  34. package/lib/esm/util/type.d.ts +58 -0
  35. package/lib/esm/util/type.js +1 -0
  36. package/package.json +22 -15
  37. package/lib/cjs/constants.d.ts +0 -28
  38. package/lib/cjs/constants.js +0 -123
  39. package/lib/dts/constants.d.ts +0 -28
  40. package/lib/esm/constants.d.ts +0 -28
@@ -8,11 +8,13 @@ import { OpenAIChatModel } from "@aigne/openai";
8
8
  import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
9
9
  import { XAIChatModel } from "@aigne/xai";
10
10
  import { NodeHttpHandler, streamCollector } from "@smithy/node-http-handler";
11
+ import boxen from "boxen";
12
+ import chalk from "chalk";
11
13
  import { HttpsProxyAgent } from "https-proxy-agent";
12
- import { joinURL } from "ufo";
13
- import { CliAIGNEHubChatModel } from "./cli-aigne-hub-model.js";
14
- const AIGNE_HUB_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
15
- export const AIGNE_HUB_URL = "https://hub.aigne.io/";
14
+ import { AIGNEHubChatModel } from "../index.js";
15
+ import { AGENT_HUB_PROVIDER, DEFAULT_AIGNE_HUB_PROVIDER_MODEL, DEFAULT_MODEL_PROVIDER, } from "./constants.js";
16
+ import { loadCredential } from "./credential.js";
17
+ const { MODEL_PROVIDER, MODEL_NAME } = nodejs.env;
16
18
  export function availableModels() {
17
19
  const proxy = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"]
18
20
  .map((i) => process.env[i])
@@ -72,9 +74,9 @@ export function availableModels() {
72
74
  create: (params) => new XAIChatModel({ ...params, clientOptions }),
73
75
  },
74
76
  {
75
- name: CliAIGNEHubChatModel.name,
77
+ name: AIGNEHubChatModel.name,
76
78
  apiKeyEnvName: "AIGNE_HUB_API_KEY",
77
- create: (params) => new CliAIGNEHubChatModel({ ...params, clientOptions }),
79
+ create: (params) => new AIGNEHubChatModel({ ...params, clientOptions }),
78
80
  },
79
81
  ];
80
82
  }
@@ -86,9 +88,85 @@ export function findModel(models, provider) {
86
88
  return m.name.some((n) => n.toLowerCase().includes(provider.toLowerCase()));
87
89
  });
88
90
  }
89
- const { MODEL_PROVIDER, MODEL_NAME } = nodejs.env;
90
- const DEFAULT_MODEL_PROVIDER = "openai";
91
- export async function loadModel(model, modelOptions, credential) {
91
+ export const parseModelOption = (model) => {
92
+ const { provider, name } = (model || process.env.MODEL)?.match(/(?<provider>[^:]*)(:(?<name>(\S+)))?/)?.groups ?? {};
93
+ return { provider, name };
94
+ };
95
+ export const formatModelName = async (model, inquirerPrompt) => {
96
+ const models = availableModels();
97
+ if (!model)
98
+ return DEFAULT_AIGNE_HUB_PROVIDER_MODEL;
99
+ const { provider, name } = parseModelOption(model);
100
+ if (!provider) {
101
+ return DEFAULT_AIGNE_HUB_PROVIDER_MODEL;
102
+ }
103
+ const providerName = provider.replace(/-/g, "");
104
+ if (providerName.includes(AGENT_HUB_PROVIDER)) {
105
+ return model;
106
+ }
107
+ const m = findModel(models, providerName);
108
+ if (!m)
109
+ throw new Error(`Unsupported model: ${provider} ${name}`);
110
+ const apiKeyEnvName = Array.isArray(m.apiKeyEnvName) ? m.apiKeyEnvName : [m.apiKeyEnvName];
111
+ if (apiKeyEnvName.some((name) => name && process.env[name])) {
112
+ return model;
113
+ }
114
+ const result = await inquirerPrompt({
115
+ type: "list",
116
+ name: "useAigneHub",
117
+ message: `Seems no API Key configured for ${provider}/${name}, select your preferred way to continue:`,
118
+ choices: [
119
+ {
120
+ name: `Connect to AIGNE Hub to use ${name} (Recommended since free credits available)`,
121
+ value: true,
122
+ },
123
+ {
124
+ name: `Exit and bring my owner API Key by set ${apiKeyEnvName.join(", ")}`,
125
+ value: false,
126
+ },
127
+ ],
128
+ default: true,
129
+ });
130
+ if (!result.useAigneHub) {
131
+ console.log(chalk.yellow(`You can use command "export ${apiKeyEnvName[0]}=xxx" to set API Key in your shell. Or you can set environment variables in .env file.`));
132
+ process.exit(0);
133
+ }
134
+ return `${AGENT_HUB_PROVIDER}:${provider}/${name}`;
135
+ };
136
+ export function maskApiKey(apiKey) {
137
+ if (!apiKey || apiKey.length <= 8)
138
+ return apiKey;
139
+ const start = apiKey.slice(0, 4);
140
+ const end = apiKey.slice(-4);
141
+ return `${start}${"*".repeat(8)}${end}`;
142
+ }
143
+ function printChatModelInfoBox({ provider, model, credential, m, }) {
144
+ const lines = [
145
+ `${chalk.cyan("Provider")}: ${chalk.green(provider)}`,
146
+ `${chalk.cyan("Model")}: ${chalk.green(model)}`,
147
+ ];
148
+ if (provider.includes(AGENT_HUB_PROVIDER)) {
149
+ lines.push(`${chalk.cyan("API URL")}: ${chalk.green(credential?.url || "N/A")}`, `${chalk.cyan("API Key")}: ${chalk.green(maskApiKey(credential?.apiKey))}`);
150
+ }
151
+ else {
152
+ const apiKeyEnvName = Array.isArray(m.apiKeyEnvName) ? m.apiKeyEnvName : [m.apiKeyEnvName];
153
+ const envKeyName = apiKeyEnvName.find((name) => name && process.env[name]);
154
+ if (envKeyName) {
155
+ lines.push(`${chalk.cyan("API Key")}: ${chalk.green(maskApiKey(process.env[envKeyName]))}`);
156
+ }
157
+ else {
158
+ lines.push(`${chalk.cyan("API Key")}: ${chalk.yellow("Not found")}`);
159
+ }
160
+ }
161
+ console.log("\n");
162
+ console.log(boxen(lines.join("\n"), {
163
+ padding: 1,
164
+ borderStyle: "classic",
165
+ borderColor: "cyan",
166
+ }));
167
+ console.log("\n");
168
+ }
169
+ export async function loadModel(model, modelOptions, options) {
92
170
  const params = {
93
171
  model: MODEL_NAME ?? model?.name ?? undefined,
94
172
  temperature: model?.temperature ?? undefined,
@@ -97,20 +175,15 @@ export async function loadModel(model, modelOptions, credential) {
97
175
  presencePenalty: model?.presencePenalty ?? undefined,
98
176
  };
99
177
  const provider = (MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER).replace(/-/g, "");
100
- const m = findModel(availableModels(), provider);
178
+ const models = availableModels();
179
+ const m = findModel(models, provider);
101
180
  if (!m)
102
181
  throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
182
+ const credential = await loadCredential({ ...options, model: `${provider}:${params.model}` });
183
+ printChatModelInfoBox({ provider, model: params.model || "", credential, m });
103
184
  return m.create({
104
185
  ...(credential || {}),
105
186
  model: params.model,
106
187
  modelOptions: { ...params, ...modelOptions },
107
188
  });
108
189
  }
109
- export async function getAIGNEHubMountPoint(url) {
110
- const { origin } = new URL(url);
111
- const BLOCKLET_JSON_PATH = "__blocklet__.js?type=json";
112
- const blockletInfo = await fetch(joinURL(origin, BLOCKLET_JSON_PATH));
113
- const blocklet = await blockletInfo.json();
114
- const aigneHubMount = (blocklet?.componentMountPoints || []).find((m) => m.did === AIGNE_HUB_DID);
115
- return joinURL(origin, aigneHubMount?.mountPoint || "");
116
- }
@@ -0,0 +1,58 @@
1
+ import type { ChatModel, ChatModelOptions } from "@aigne/core/agents/chat-model.js";
2
+ export type Model = {
3
+ provider?: string | null;
4
+ name?: string | null;
5
+ temperature?: number | null;
6
+ topP?: number | null;
7
+ frequencyPenalty?: number | null;
8
+ presencePenalty?: number | null;
9
+ } | undefined;
10
+ type InquirerPromptFn = (prompt: {
11
+ type: string;
12
+ name: string;
13
+ message: string;
14
+ choices: {
15
+ name: string;
16
+ value: any;
17
+ }[];
18
+ default: any;
19
+ }) => Promise<any>;
20
+ export type LoadCredentialOptions = {
21
+ model?: string;
22
+ aigneHubUrl?: string;
23
+ inquirerPromptFn?: InquirerPromptFn;
24
+ };
25
+ export interface LoadableModel {
26
+ name: string | string[];
27
+ apiKeyEnvName?: string | string[];
28
+ create: (options: {
29
+ model?: string;
30
+ modelOptions?: ChatModelOptions;
31
+ apiKey?: string;
32
+ url?: string;
33
+ }) => ChatModel;
34
+ }
35
+ export type FetchResult = {
36
+ accessKeyId: string;
37
+ accessKeySecret: string;
38
+ };
39
+ export type BaseWrapSpinner = (_: string, waiting: () => Promise<FetchResult>) => Promise<FetchResult>;
40
+ export interface CreateConnectOptions {
41
+ connectUrl: string;
42
+ openPage?: (url: string) => void;
43
+ fetchInterval?: number;
44
+ retry?: number;
45
+ source?: string;
46
+ connectAction?: string;
47
+ appName?: string;
48
+ appLogo?: string;
49
+ wrapSpinner?: BaseWrapSpinner;
50
+ prettyUrl?: (url: string) => string;
51
+ closeOnSuccess?: boolean;
52
+ intervalFetchConfig?: (options: {
53
+ sessionId: string;
54
+ fetchInterval: number;
55
+ fetchTimeout: number;
56
+ }) => Promise<FetchResult>;
57
+ }
58
+ export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aigne/aigne-hub",
3
- "version": "0.4.8",
3
+ "version": "0.4.9",
4
4
  "description": "AIGNE Hub SDK for integrating with Hub AI models",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -40,23 +40,30 @@
40
40
  }
41
41
  },
42
42
  "dependencies": {
43
+ "@ocap/mcrypto": "^1.21.0",
43
44
  "@smithy/node-http-handler": "^4.1.0",
45
+ "boxen": "^8.0.1",
46
+ "chalk": "^5.4.1",
44
47
  "https-proxy-agent": "^7.0.6",
48
+ "inquirer": "^12.7.0",
49
+ "open": "^10.2.0",
45
50
  "openai": "^5.8.3",
51
+ "p-wait-for": "^5.0.2",
46
52
  "ufo": "^1.6.1",
53
+ "yaml": "^2.8.0",
47
54
  "zod": "^3.25.67",
48
- "@aigne/anthropic": "^0.10.13",
49
- "@aigne/bedrock": "^0.8.17",
50
- "@aigne/core": "^1.48.0",
51
- "@aigne/deepseek": "^0.7.17",
52
- "@aigne/default-memory": "^1.0.17",
53
- "@aigne/ollama": "^0.7.17",
54
- "@aigne/open-router": "^0.7.17",
55
- "@aigne/gemini": "^0.8.17",
56
- "@aigne/openai": "^0.10.17",
57
- "@aigne/xai": "^0.7.17",
58
- "@aigne/transport": "^0.12.5",
59
- "@aigne/platform-helpers": "^0.6.0"
55
+ "@aigne/anthropic": "^0.11.0",
56
+ "@aigne/core": "^1.49.0",
57
+ "@aigne/bedrock": "^0.9.0",
58
+ "@aigne/deepseek": "^0.7.18",
59
+ "@aigne/default-memory": "^1.1.0",
60
+ "@aigne/gemini": "^0.9.0",
61
+ "@aigne/openai": "^0.11.0",
62
+ "@aigne/ollama": "^0.7.18",
63
+ "@aigne/open-router": "^0.7.18",
64
+ "@aigne/platform-helpers": "^0.6.1",
65
+ "@aigne/transport": "^0.13.0",
66
+ "@aigne/xai": "^0.7.18"
60
67
  },
61
68
  "devDependencies": {
62
69
  "@types/bun": "^1.2.18",
@@ -65,8 +72,8 @@
65
72
  "npm-run-all": "^4.1.5",
66
73
  "rimraf": "^6.0.1",
67
74
  "typescript": "^5.8.3",
68
- "@aigne/openai": "^0.10.17",
69
- "@aigne/test-utils": "^0.5.25"
75
+ "@aigne/test-utils": "^0.5.26",
76
+ "@aigne/openai": "^0.11.0"
70
77
  },
71
78
  "scripts": {
72
79
  "lint": "tsc --noEmit",
@@ -1,28 +0,0 @@
1
- import type { ChatModel, ChatModelOptions } from "@aigne/core/agents/chat-model.js";
2
- export declare const AIGNE_HUB_URL = "https://hub.aigne.io/";
3
- export declare function availableModels(): LoadableModel[];
4
- export interface LoadableModel {
5
- name: string | string[];
6
- apiKeyEnvName?: string | string[];
7
- create: (options: {
8
- model?: string;
9
- modelOptions?: ChatModelOptions;
10
- apiKey?: string;
11
- url?: string;
12
- }) => ChatModel;
13
- }
14
- export declare function findModel(models: LoadableModel[], provider: string): LoadableModel | undefined;
15
- type Model = {
16
- provider?: string | null;
17
- name?: string | null;
18
- temperature?: number | null;
19
- topP?: number | null;
20
- frequencyPenalty?: number | null;
21
- presencePenalty?: number | null;
22
- } | undefined;
23
- export declare function loadModel(model?: Model, modelOptions?: ChatModelOptions, credential?: {
24
- apiKey?: string;
25
- url?: string;
26
- }): Promise<ChatModel | undefined>;
27
- export declare function getAIGNEHubMountPoint(url: string): Promise<string>;
28
- export {};
@@ -1,123 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AIGNE_HUB_URL = void 0;
4
- exports.availableModels = availableModels;
5
- exports.findModel = findModel;
6
- exports.loadModel = loadModel;
7
- exports.getAIGNEHubMountPoint = getAIGNEHubMountPoint;
8
- const anthropic_1 = require("@aigne/anthropic");
9
- const bedrock_1 = require("@aigne/bedrock");
10
- const deepseek_1 = require("@aigne/deepseek");
11
- const gemini_1 = require("@aigne/gemini");
12
- const ollama_1 = require("@aigne/ollama");
13
- const open_router_1 = require("@aigne/open-router");
14
- const openai_1 = require("@aigne/openai");
15
- const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
16
- const xai_1 = require("@aigne/xai");
17
- const node_http_handler_1 = require("@smithy/node-http-handler");
18
- const https_proxy_agent_1 = require("https-proxy-agent");
19
- const ufo_1 = require("ufo");
20
- const cli_aigne_hub_model_js_1 = require("./cli-aigne-hub-model.js");
21
- const AIGNE_HUB_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
22
- exports.AIGNE_HUB_URL = "https://hub.aigne.io/";
23
- function availableModels() {
24
- const proxy = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"]
25
- .map((i) => process.env[i])
26
- .filter(Boolean)[0];
27
- const httpAgent = proxy ? new https_proxy_agent_1.HttpsProxyAgent(proxy) : undefined;
28
- const clientOptions = {
29
- fetchOptions: {
30
- // @ts-ignore
31
- agent: httpAgent,
32
- },
33
- };
34
- return [
35
- {
36
- name: openai_1.OpenAIChatModel.name,
37
- apiKeyEnvName: "OPENAI_API_KEY",
38
- create: (params) => new openai_1.OpenAIChatModel({ ...params, clientOptions }),
39
- },
40
- {
41
- name: anthropic_1.AnthropicChatModel.name,
42
- apiKeyEnvName: "ANTHROPIC_API_KEY",
43
- create: (params) => new anthropic_1.AnthropicChatModel({ ...params, clientOptions }),
44
- },
45
- {
46
- name: bedrock_1.BedrockChatModel.name,
47
- apiKeyEnvName: "AWS_ACCESS_KEY_ID",
48
- create: (params) => new bedrock_1.BedrockChatModel({
49
- ...params,
50
- clientOptions: {
51
- requestHandler: node_http_handler_1.NodeHttpHandler.create({ httpAgent, httpsAgent: httpAgent }),
52
- streamCollector: node_http_handler_1.streamCollector,
53
- },
54
- }),
55
- },
56
- {
57
- name: deepseek_1.DeepSeekChatModel.name,
58
- apiKeyEnvName: "DEEPSEEK_API_KEY",
59
- create: (params) => new deepseek_1.DeepSeekChatModel({ ...params, clientOptions }),
60
- },
61
- {
62
- name: [gemini_1.GeminiChatModel.name, "google"],
63
- apiKeyEnvName: ["GEMINI_API_KEY", "GOOGLE_API_KEY"],
64
- create: (params) => new gemini_1.GeminiChatModel({ ...params, clientOptions }),
65
- },
66
- {
67
- name: ollama_1.OllamaChatModel.name,
68
- apiKeyEnvName: "OLLAMA_API_KEY",
69
- create: (params) => new ollama_1.OllamaChatModel({ ...params, clientOptions }),
70
- },
71
- {
72
- name: open_router_1.OpenRouterChatModel.name,
73
- apiKeyEnvName: "OPEN_ROUTER_API_KEY",
74
- create: (params) => new open_router_1.OpenRouterChatModel({ ...params, clientOptions }),
75
- },
76
- {
77
- name: xai_1.XAIChatModel.name,
78
- apiKeyEnvName: "XAI_API_KEY",
79
- create: (params) => new xai_1.XAIChatModel({ ...params, clientOptions }),
80
- },
81
- {
82
- name: cli_aigne_hub_model_js_1.CliAIGNEHubChatModel.name,
83
- apiKeyEnvName: "AIGNE_HUB_API_KEY",
84
- create: (params) => new cli_aigne_hub_model_js_1.CliAIGNEHubChatModel({ ...params, clientOptions }),
85
- },
86
- ];
87
- }
88
- function findModel(models, provider) {
89
- return models.find((m) => {
90
- if (typeof m.name === "string") {
91
- return m.name.toLowerCase().includes(provider.toLowerCase());
92
- }
93
- return m.name.some((n) => n.toLowerCase().includes(provider.toLowerCase()));
94
- });
95
- }
96
- const { MODEL_PROVIDER, MODEL_NAME } = index_js_1.nodejs.env;
97
- const DEFAULT_MODEL_PROVIDER = "openai";
98
- async function loadModel(model, modelOptions, credential) {
99
- const params = {
100
- model: MODEL_NAME ?? model?.name ?? undefined,
101
- temperature: model?.temperature ?? undefined,
102
- topP: model?.topP ?? undefined,
103
- frequencyPenalty: model?.frequencyPenalty ?? undefined,
104
- presencePenalty: model?.presencePenalty ?? undefined,
105
- };
106
- const provider = (MODEL_PROVIDER ?? model?.provider ?? DEFAULT_MODEL_PROVIDER).replace(/-/g, "");
107
- const m = findModel(availableModels(), provider);
108
- if (!m)
109
- throw new Error(`Unsupported model: ${model?.provider} ${model?.name}`);
110
- return m.create({
111
- ...(credential || {}),
112
- model: params.model,
113
- modelOptions: { ...params, ...modelOptions },
114
- });
115
- }
116
- async function getAIGNEHubMountPoint(url) {
117
- const { origin } = new URL(url);
118
- const BLOCKLET_JSON_PATH = "__blocklet__.js?type=json";
119
- const blockletInfo = await fetch((0, ufo_1.joinURL)(origin, BLOCKLET_JSON_PATH));
120
- const blocklet = await blockletInfo.json();
121
- const aigneHubMount = (blocklet?.componentMountPoints || []).find((m) => m.did === AIGNE_HUB_DID);
122
- return (0, ufo_1.joinURL)(origin, aigneHubMount?.mountPoint || "");
123
- }
@@ -1,28 +0,0 @@
1
- import type { ChatModel, ChatModelOptions } from "@aigne/core/agents/chat-model.js";
2
- export declare const AIGNE_HUB_URL = "https://hub.aigne.io/";
3
- export declare function availableModels(): LoadableModel[];
4
- export interface LoadableModel {
5
- name: string | string[];
6
- apiKeyEnvName?: string | string[];
7
- create: (options: {
8
- model?: string;
9
- modelOptions?: ChatModelOptions;
10
- apiKey?: string;
11
- url?: string;
12
- }) => ChatModel;
13
- }
14
- export declare function findModel(models: LoadableModel[], provider: string): LoadableModel | undefined;
15
- type Model = {
16
- provider?: string | null;
17
- name?: string | null;
18
- temperature?: number | null;
19
- topP?: number | null;
20
- frequencyPenalty?: number | null;
21
- presencePenalty?: number | null;
22
- } | undefined;
23
- export declare function loadModel(model?: Model, modelOptions?: ChatModelOptions, credential?: {
24
- apiKey?: string;
25
- url?: string;
26
- }): Promise<ChatModel | undefined>;
27
- export declare function getAIGNEHubMountPoint(url: string): Promise<string>;
28
- export {};
@@ -1,28 +0,0 @@
1
- import type { ChatModel, ChatModelOptions } from "@aigne/core/agents/chat-model.js";
2
- export declare const AIGNE_HUB_URL = "https://hub.aigne.io/";
3
- export declare function availableModels(): LoadableModel[];
4
- export interface LoadableModel {
5
- name: string | string[];
6
- apiKeyEnvName?: string | string[];
7
- create: (options: {
8
- model?: string;
9
- modelOptions?: ChatModelOptions;
10
- apiKey?: string;
11
- url?: string;
12
- }) => ChatModel;
13
- }
14
- export declare function findModel(models: LoadableModel[], provider: string): LoadableModel | undefined;
15
- type Model = {
16
- provider?: string | null;
17
- name?: string | null;
18
- temperature?: number | null;
19
- topP?: number | null;
20
- frequencyPenalty?: number | null;
21
- presencePenalty?: number | null;
22
- } | undefined;
23
- export declare function loadModel(model?: Model, modelOptions?: ChatModelOptions, credential?: {
24
- apiKey?: string;
25
- url?: string;
26
- }): Promise<ChatModel | undefined>;
27
- export declare function getAIGNEHubMountPoint(url: string): Promise<string>;
28
- export {};