@aigne/aigne-hub 0.10.0-beta → 0.10.0-beta.1
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/CHANGELOG.md +22 -0
- package/lib/cjs/aigne-hub-image-model.d.ts +12 -0
- package/lib/cjs/aigne-hub-image-model.js +5 -5
- package/lib/cjs/aigne-hub-model.d.ts +12 -0
- package/lib/cjs/aigne-hub-model.js +5 -5
- package/lib/cjs/index.d.ts +48 -0
- package/lib/cjs/index.js +13 -0
- package/lib/cjs/utils/constants.d.ts +1 -0
- package/lib/cjs/utils/constants.js +3 -1
- package/lib/cjs/utils/hub.d.ts +16 -0
- package/lib/cjs/utils/hub.js +35 -0
- package/lib/cjs/utils/type.d.ts +2 -3
- package/lib/dts/aigne-hub-image-model.d.ts +12 -0
- package/lib/dts/aigne-hub-model.d.ts +12 -0
- package/lib/dts/index.d.ts +48 -0
- package/lib/dts/utils/constants.d.ts +1 -0
- package/lib/dts/utils/hub.d.ts +16 -0
- package/lib/dts/utils/type.d.ts +2 -3
- package/lib/esm/aigne-hub-image-model.d.ts +12 -0
- package/lib/esm/aigne-hub-image-model.js +6 -6
- package/lib/esm/aigne-hub-model.d.ts +12 -0
- package/lib/esm/aigne-hub-model.js +6 -6
- package/lib/esm/index.d.ts +48 -0
- package/lib/esm/index.js +13 -0
- package/lib/esm/utils/constants.d.ts +1 -0
- package/lib/esm/utils/constants.js +1 -0
- package/lib/esm/utils/hub.d.ts +16 -0
- package/lib/esm/utils/hub.js +32 -0
- package/lib/esm/utils/type.d.ts +2 -3
- package/package.json +12 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.10.0-beta.1](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.10.0-beta...aigne-hub-v0.10.0-beta.1) (2025-09-23)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add models method to get available models for aigne hub model ([#532](https://github.com/AIGNE-io/aigne-framework/issues/532)) ([3248646](https://github.com/AIGNE-io/aigne-framework/commit/3248646d248aef5419273adc556bb1f13a7b2a02))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
* The following workspace dependencies were updated
|
|
14
|
+
* dependencies
|
|
15
|
+
* @aigne/deepseek bumped to 0.7.46-beta.1
|
|
16
|
+
* @aigne/doubao bumped to 1.1.0-beta.1
|
|
17
|
+
* @aigne/gemini bumped to 0.14.0-beta.1
|
|
18
|
+
* @aigne/ollama bumped to 0.7.46-beta.1
|
|
19
|
+
* @aigne/open-router bumped to 0.7.46-beta.1
|
|
20
|
+
* @aigne/openai bumped to 0.16.0-beta.1
|
|
21
|
+
* @aigne/poe bumped to 1.0.26-beta.1
|
|
22
|
+
* @aigne/transport bumped to 0.15.9-beta.1
|
|
23
|
+
* @aigne/xai bumped to 0.7.46-beta.1
|
|
24
|
+
|
|
3
25
|
## [0.10.0-beta](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.9.6...aigne-hub-v0.10.0-beta) (2025-09-22)
|
|
4
26
|
|
|
5
27
|
|
|
@@ -4,6 +4,18 @@ import { type AIGNEHubImageModelOptions } from "./utils/type.js";
|
|
|
4
4
|
export declare class AIGNEHubImageModel extends ImageModel {
|
|
5
5
|
options: AIGNEHubImageModelOptions;
|
|
6
6
|
constructor(options: AIGNEHubImageModelOptions);
|
|
7
|
+
models(): Promise<{
|
|
8
|
+
type: string;
|
|
9
|
+
model: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
input_credits_per_token: number;
|
|
12
|
+
output_credits_per_token: number;
|
|
13
|
+
providerDisplayName: string;
|
|
14
|
+
status?: {
|
|
15
|
+
available: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
18
|
+
}[]>;
|
|
7
19
|
protected _client?: Promise<BaseClient>;
|
|
8
20
|
get client(): Promise<BaseClient>;
|
|
9
21
|
private _credential?;
|
|
@@ -8,6 +8,7 @@ const base_client_js_1 = require("@aigne/transport/http-client/base-client.js");
|
|
|
8
8
|
const ufo_1 = require("ufo");
|
|
9
9
|
const blocklet_js_1 = require("./utils/blocklet.js");
|
|
10
10
|
const constants_js_1 = require("./utils/constants.js");
|
|
11
|
+
const hub_js_1 = require("./utils/hub.js");
|
|
11
12
|
const type_js_1 = require("./utils/type.js");
|
|
12
13
|
class AIGNEHubImageModel extends core_1.ImageModel {
|
|
13
14
|
options;
|
|
@@ -16,6 +17,9 @@ class AIGNEHubImageModel extends core_1.ImageModel {
|
|
|
16
17
|
super();
|
|
17
18
|
this.options = options;
|
|
18
19
|
}
|
|
20
|
+
async models() {
|
|
21
|
+
return (0, hub_js_1.getModels)({ baseURL: (await this.credential).url, type: "image" });
|
|
22
|
+
}
|
|
19
23
|
_client;
|
|
20
24
|
get client() {
|
|
21
25
|
this._client ??= this.credential.then(({ url, apiKey, model }) => {
|
|
@@ -26,11 +30,7 @@ class AIGNEHubImageModel extends core_1.ImageModel {
|
|
|
26
30
|
}
|
|
27
31
|
_credential;
|
|
28
32
|
get credential() {
|
|
29
|
-
this._credential ??= (0, blocklet_js_1.getAIGNEHubMountPoint)(this.options.url
|
|
30
|
-
this.options.baseURL ||
|
|
31
|
-
process.env.BLOCKLET_AIGNE_API_URL ||
|
|
32
|
-
process.env.AIGNE_HUB_API_URL ||
|
|
33
|
-
constants_js_1.AIGNE_HUB_URL, constants_js_1.AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
33
|
+
this._credential ??= (0, blocklet_js_1.getAIGNEHubMountPoint)(this.options.baseURL || (0, constants_js_1.aigneHubBaseUrl)(), constants_js_1.AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
34
34
|
const path = "/api/v2/image";
|
|
35
35
|
const rawCredential = process.env.BLOCKLET_AIGNE_API_CREDENTIAL;
|
|
36
36
|
let credentialOptions = {};
|
|
@@ -4,6 +4,18 @@ import { type AIGNEHubChatModelOptions } from "./utils/type.js";
|
|
|
4
4
|
export declare class AIGNEHubChatModel extends ChatModel {
|
|
5
5
|
options: AIGNEHubChatModelOptions;
|
|
6
6
|
constructor(options: AIGNEHubChatModelOptions);
|
|
7
|
+
models(): Promise<{
|
|
8
|
+
type: string;
|
|
9
|
+
model: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
input_credits_per_token: number;
|
|
12
|
+
output_credits_per_token: number;
|
|
13
|
+
providerDisplayName: string;
|
|
14
|
+
status?: {
|
|
15
|
+
available: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
18
|
+
}[]>;
|
|
7
19
|
protected _client?: Promise<BaseClient>;
|
|
8
20
|
get client(): Promise<BaseClient>;
|
|
9
21
|
private _credential?;
|
|
@@ -8,6 +8,7 @@ const base_client_js_1 = require("@aigne/transport/http-client/base-client.js");
|
|
|
8
8
|
const ufo_1 = require("ufo");
|
|
9
9
|
const blocklet_js_1 = require("./utils/blocklet.js");
|
|
10
10
|
const constants_js_1 = require("./utils/constants.js");
|
|
11
|
+
const hub_js_1 = require("./utils/hub.js");
|
|
11
12
|
const type_js_1 = require("./utils/type.js");
|
|
12
13
|
class AIGNEHubChatModel extends core_1.ChatModel {
|
|
13
14
|
options;
|
|
@@ -16,6 +17,9 @@ class AIGNEHubChatModel extends core_1.ChatModel {
|
|
|
16
17
|
super();
|
|
17
18
|
this.options = options;
|
|
18
19
|
}
|
|
20
|
+
async models() {
|
|
21
|
+
return (0, hub_js_1.getModels)({ baseURL: (await this.credential).url, type: "chat" });
|
|
22
|
+
}
|
|
19
23
|
_client;
|
|
20
24
|
get client() {
|
|
21
25
|
this._client ??= this.credential.then(({ url, apiKey, model }) => {
|
|
@@ -26,11 +30,7 @@ class AIGNEHubChatModel extends core_1.ChatModel {
|
|
|
26
30
|
}
|
|
27
31
|
_credential;
|
|
28
32
|
get credential() {
|
|
29
|
-
this._credential ??= (0, blocklet_js_1.getAIGNEHubMountPoint)(this.options.url
|
|
30
|
-
this.options.baseURL ||
|
|
31
|
-
process.env.BLOCKLET_AIGNE_API_URL ||
|
|
32
|
-
process.env.AIGNE_HUB_API_URL ||
|
|
33
|
-
constants_js_1.AIGNE_HUB_URL, constants_js_1.AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
33
|
+
this._credential ??= (0, blocklet_js_1.getAIGNEHubMountPoint)(this.options.baseURL || (0, constants_js_1.aigneHubBaseUrl)(), constants_js_1.AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
34
34
|
const path = "/api/v2/chat";
|
|
35
35
|
const rawCredential = process.env.BLOCKLET_AIGNE_API_CREDENTIAL;
|
|
36
36
|
let credentialOptions = {};
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -7,6 +7,30 @@ export * from "./utils/model.js";
|
|
|
7
7
|
export declare class AIGNEHubChatModel extends ChatModel {
|
|
8
8
|
options: AIGNEHubChatModelOptions;
|
|
9
9
|
static load(options: AIGNEHubChatModelOptions): Promise<AIGNEHubChatModel>;
|
|
10
|
+
static models(): Promise<{
|
|
11
|
+
type: string;
|
|
12
|
+
model: string;
|
|
13
|
+
provider: string;
|
|
14
|
+
input_credits_per_token: number;
|
|
15
|
+
output_credits_per_token: number;
|
|
16
|
+
providerDisplayName: string;
|
|
17
|
+
status?: {
|
|
18
|
+
available: boolean;
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
models(): Promise<{
|
|
23
|
+
type: string;
|
|
24
|
+
model: string;
|
|
25
|
+
provider: string;
|
|
26
|
+
input_credits_per_token: number;
|
|
27
|
+
output_credits_per_token: number;
|
|
28
|
+
providerDisplayName: string;
|
|
29
|
+
status?: {
|
|
30
|
+
available: boolean;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
}[]>;
|
|
10
34
|
constructor(options: AIGNEHubChatModelOptions);
|
|
11
35
|
protected client: ChatModel;
|
|
12
36
|
get credential(): import("@aigne/core/utils/type-utils.js").PromiseOrValue<{
|
|
@@ -19,6 +43,30 @@ export declare class AIGNEHubChatModel extends ChatModel {
|
|
|
19
43
|
export declare class AIGNEHubImageModel extends ImageModel {
|
|
20
44
|
options: AIGNEHubImageModelOptions;
|
|
21
45
|
static load(options: AIGNEHubImageModelOptions): Promise<AIGNEHubImageModel>;
|
|
46
|
+
static models(): Promise<{
|
|
47
|
+
type: string;
|
|
48
|
+
model: string;
|
|
49
|
+
provider: string;
|
|
50
|
+
input_credits_per_token: number;
|
|
51
|
+
output_credits_per_token: number;
|
|
52
|
+
providerDisplayName: string;
|
|
53
|
+
status?: {
|
|
54
|
+
available: boolean;
|
|
55
|
+
} | null | undefined;
|
|
56
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
57
|
+
}[]>;
|
|
58
|
+
models(): Promise<{
|
|
59
|
+
type: string;
|
|
60
|
+
model: string;
|
|
61
|
+
provider: string;
|
|
62
|
+
input_credits_per_token: number;
|
|
63
|
+
output_credits_per_token: number;
|
|
64
|
+
providerDisplayName: string;
|
|
65
|
+
status?: {
|
|
66
|
+
available: boolean;
|
|
67
|
+
} | null | undefined;
|
|
68
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
69
|
+
}[]>;
|
|
22
70
|
constructor(options: AIGNEHubImageModelOptions);
|
|
23
71
|
protected client: ImageModel;
|
|
24
72
|
get credential(): import("@aigne/core/utils/type-utils.js").PromiseOrValue<{
|
package/lib/cjs/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.AIGNEHubImageModel = exports.AIGNEHubChatModel = void 0;
|
|
18
18
|
const core_1 = require("@aigne/core");
|
|
19
|
+
const hub_js_1 = require("./utils/hub.js");
|
|
19
20
|
const model_js_1 = require("./utils/model.js");
|
|
20
21
|
__exportStar(require("./utils/blocklet.js"), exports);
|
|
21
22
|
__exportStar(require("./utils/constants.js"), exports);
|
|
@@ -25,6 +26,12 @@ class AIGNEHubChatModel extends core_1.ChatModel {
|
|
|
25
26
|
static async load(options) {
|
|
26
27
|
return new AIGNEHubChatModel(options);
|
|
27
28
|
}
|
|
29
|
+
static async models() {
|
|
30
|
+
return (0, hub_js_1.getModels)({ type: "chat" });
|
|
31
|
+
}
|
|
32
|
+
models() {
|
|
33
|
+
return (0, hub_js_1.getModels)({ type: "chat" });
|
|
34
|
+
}
|
|
28
35
|
constructor(options) {
|
|
29
36
|
let provider = process.env.BLOCKLET_AIGNE_API_PROVIDER;
|
|
30
37
|
if (!provider && options.model) {
|
|
@@ -59,6 +66,12 @@ class AIGNEHubImageModel extends core_1.ImageModel {
|
|
|
59
66
|
static async load(options) {
|
|
60
67
|
return new AIGNEHubImageModel(options);
|
|
61
68
|
}
|
|
69
|
+
static async models() {
|
|
70
|
+
return (0, hub_js_1.getModels)({ type: "image" });
|
|
71
|
+
}
|
|
72
|
+
models() {
|
|
73
|
+
return (0, hub_js_1.getModels)({ type: "image" });
|
|
74
|
+
}
|
|
62
75
|
constructor(options) {
|
|
63
76
|
let provider = process.env.BLOCKLET_AIGNE_API_PROVIDER;
|
|
64
77
|
if (!provider && options.model) {
|
|
@@ -2,3 +2,4 @@ export declare const AIGNE_HUB_URL = "https://hub.aigne.io/";
|
|
|
2
2
|
export declare const AIGNE_HUB_BLOCKLET_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
|
|
3
3
|
export declare const AIGNE_HUB_DEFAULT_MODEL = "openai/gpt-5-mini";
|
|
4
4
|
export declare const AIGNE_HUB_IMAGE_MODEL = "openai/gpt-image-1";
|
|
5
|
+
export declare const aigneHubBaseUrl: () => string;
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AIGNE_HUB_IMAGE_MODEL = exports.AIGNE_HUB_DEFAULT_MODEL = exports.AIGNE_HUB_BLOCKLET_DID = exports.AIGNE_HUB_URL = void 0;
|
|
3
|
+
exports.aigneHubBaseUrl = exports.AIGNE_HUB_IMAGE_MODEL = exports.AIGNE_HUB_DEFAULT_MODEL = exports.AIGNE_HUB_BLOCKLET_DID = exports.AIGNE_HUB_URL = void 0;
|
|
4
4
|
exports.AIGNE_HUB_URL = "https://hub.aigne.io/";
|
|
5
5
|
exports.AIGNE_HUB_BLOCKLET_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
|
|
6
6
|
exports.AIGNE_HUB_DEFAULT_MODEL = "openai/gpt-5-mini";
|
|
7
7
|
exports.AIGNE_HUB_IMAGE_MODEL = "openai/gpt-image-1";
|
|
8
|
+
const aigneHubBaseUrl = () => process.env.BLOCKLET_AIGNE_API_URL || process.env.AIGNE_HUB_API_URL || exports.AIGNE_HUB_URL;
|
|
9
|
+
exports.aigneHubBaseUrl = aigneHubBaseUrl;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GetModelsOptions {
|
|
2
|
+
baseURL?: string;
|
|
3
|
+
type?: "image" | "chat" | "embedding";
|
|
4
|
+
}
|
|
5
|
+
export declare function getModels(options: GetModelsOptions): Promise<{
|
|
6
|
+
type: string;
|
|
7
|
+
model: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
input_credits_per_token: number;
|
|
10
|
+
output_credits_per_token: number;
|
|
11
|
+
providerDisplayName: string;
|
|
12
|
+
status?: {
|
|
13
|
+
available: boolean;
|
|
14
|
+
} | null | undefined;
|
|
15
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
16
|
+
}[]>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getModels = getModels;
|
|
4
|
+
const ufo_1 = require("ufo");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const blocklet_js_1 = require("./blocklet.js");
|
|
7
|
+
const constants_js_1 = require("./constants.js");
|
|
8
|
+
const modelsSchema = zod_1.z.array(zod_1.z.object({
|
|
9
|
+
model: zod_1.z.string(),
|
|
10
|
+
type: zod_1.z.string(),
|
|
11
|
+
provider: zod_1.z.string(),
|
|
12
|
+
input_credits_per_token: zod_1.z.number(),
|
|
13
|
+
output_credits_per_token: zod_1.z.number(),
|
|
14
|
+
modelMetadata: zod_1.z.record(zod_1.z.unknown()).nullish(),
|
|
15
|
+
providerDisplayName: zod_1.z.string(),
|
|
16
|
+
status: zod_1.z
|
|
17
|
+
.object({
|
|
18
|
+
available: zod_1.z.boolean(),
|
|
19
|
+
})
|
|
20
|
+
.nullish(),
|
|
21
|
+
}));
|
|
22
|
+
async function getModels(options) {
|
|
23
|
+
const url = await (0, blocklet_js_1.getAIGNEHubMountPoint)(options.baseURL || (0, constants_js_1.aigneHubBaseUrl)(), constants_js_1.AIGNE_HUB_BLOCKLET_DID);
|
|
24
|
+
const response = await fetch((0, ufo_1.withQuery)((0, ufo_1.joinURL)(url, "/api/ai/models"), {
|
|
25
|
+
type: options.type,
|
|
26
|
+
}));
|
|
27
|
+
if (!response.ok) {
|
|
28
|
+
const text = await response.text().catch(() => "");
|
|
29
|
+
throw new Error(`Failed to fetch models: ${response.status} ${response.statusText} ${text}`);
|
|
30
|
+
}
|
|
31
|
+
const json = await response.json().catch((error) => {
|
|
32
|
+
throw new Error(`Failed to parse response as JSON from ${url}: ${error.message}`);
|
|
33
|
+
});
|
|
34
|
+
return modelsSchema.parse(json);
|
|
35
|
+
}
|
package/lib/cjs/utils/type.d.ts
CHANGED
|
@@ -29,9 +29,9 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
29
29
|
}>>;
|
|
30
30
|
clientOptions: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
model?: string | undefined;
|
|
32
33
|
url?: string | undefined;
|
|
33
34
|
apiKey?: string | undefined;
|
|
34
|
-
model?: string | undefined;
|
|
35
35
|
modelOptions?: {
|
|
36
36
|
parallelToolCalls: boolean;
|
|
37
37
|
model?: string | undefined;
|
|
@@ -42,9 +42,9 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
42
42
|
} | undefined;
|
|
43
43
|
clientOptions?: {} | undefined;
|
|
44
44
|
}, {
|
|
45
|
+
model?: string | undefined;
|
|
45
46
|
url?: string | undefined;
|
|
46
47
|
apiKey?: string | undefined;
|
|
47
|
-
model?: string | undefined;
|
|
48
48
|
modelOptions?: {
|
|
49
49
|
model?: string | undefined;
|
|
50
50
|
temperature?: number | undefined;
|
|
@@ -56,7 +56,6 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
56
56
|
clientOptions?: {} | undefined;
|
|
57
57
|
}>;
|
|
58
58
|
export interface AIGNEHubChatModelOptions extends ChatModelOptions {
|
|
59
|
-
url?: string;
|
|
60
59
|
baseURL?: string;
|
|
61
60
|
apiKey?: string;
|
|
62
61
|
clientOptions?: OpenAIChatModelOptions["clientOptions"] & {
|
|
@@ -4,6 +4,18 @@ import { type AIGNEHubImageModelOptions } from "./utils/type.js";
|
|
|
4
4
|
export declare class AIGNEHubImageModel extends ImageModel {
|
|
5
5
|
options: AIGNEHubImageModelOptions;
|
|
6
6
|
constructor(options: AIGNEHubImageModelOptions);
|
|
7
|
+
models(): Promise<{
|
|
8
|
+
type: string;
|
|
9
|
+
model: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
input_credits_per_token: number;
|
|
12
|
+
output_credits_per_token: number;
|
|
13
|
+
providerDisplayName: string;
|
|
14
|
+
status?: {
|
|
15
|
+
available: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
18
|
+
}[]>;
|
|
7
19
|
protected _client?: Promise<BaseClient>;
|
|
8
20
|
get client(): Promise<BaseClient>;
|
|
9
21
|
private _credential?;
|
|
@@ -4,6 +4,18 @@ import { type AIGNEHubChatModelOptions } from "./utils/type.js";
|
|
|
4
4
|
export declare class AIGNEHubChatModel extends ChatModel {
|
|
5
5
|
options: AIGNEHubChatModelOptions;
|
|
6
6
|
constructor(options: AIGNEHubChatModelOptions);
|
|
7
|
+
models(): Promise<{
|
|
8
|
+
type: string;
|
|
9
|
+
model: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
input_credits_per_token: number;
|
|
12
|
+
output_credits_per_token: number;
|
|
13
|
+
providerDisplayName: string;
|
|
14
|
+
status?: {
|
|
15
|
+
available: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
18
|
+
}[]>;
|
|
7
19
|
protected _client?: Promise<BaseClient>;
|
|
8
20
|
get client(): Promise<BaseClient>;
|
|
9
21
|
private _credential?;
|
package/lib/dts/index.d.ts
CHANGED
|
@@ -7,6 +7,30 @@ export * from "./utils/model.js";
|
|
|
7
7
|
export declare class AIGNEHubChatModel extends ChatModel {
|
|
8
8
|
options: AIGNEHubChatModelOptions;
|
|
9
9
|
static load(options: AIGNEHubChatModelOptions): Promise<AIGNEHubChatModel>;
|
|
10
|
+
static models(): Promise<{
|
|
11
|
+
type: string;
|
|
12
|
+
model: string;
|
|
13
|
+
provider: string;
|
|
14
|
+
input_credits_per_token: number;
|
|
15
|
+
output_credits_per_token: number;
|
|
16
|
+
providerDisplayName: string;
|
|
17
|
+
status?: {
|
|
18
|
+
available: boolean;
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
models(): Promise<{
|
|
23
|
+
type: string;
|
|
24
|
+
model: string;
|
|
25
|
+
provider: string;
|
|
26
|
+
input_credits_per_token: number;
|
|
27
|
+
output_credits_per_token: number;
|
|
28
|
+
providerDisplayName: string;
|
|
29
|
+
status?: {
|
|
30
|
+
available: boolean;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
}[]>;
|
|
10
34
|
constructor(options: AIGNEHubChatModelOptions);
|
|
11
35
|
protected client: ChatModel;
|
|
12
36
|
get credential(): import("@aigne/core/utils/type-utils.js").PromiseOrValue<{
|
|
@@ -19,6 +43,30 @@ export declare class AIGNEHubChatModel extends ChatModel {
|
|
|
19
43
|
export declare class AIGNEHubImageModel extends ImageModel {
|
|
20
44
|
options: AIGNEHubImageModelOptions;
|
|
21
45
|
static load(options: AIGNEHubImageModelOptions): Promise<AIGNEHubImageModel>;
|
|
46
|
+
static models(): Promise<{
|
|
47
|
+
type: string;
|
|
48
|
+
model: string;
|
|
49
|
+
provider: string;
|
|
50
|
+
input_credits_per_token: number;
|
|
51
|
+
output_credits_per_token: number;
|
|
52
|
+
providerDisplayName: string;
|
|
53
|
+
status?: {
|
|
54
|
+
available: boolean;
|
|
55
|
+
} | null | undefined;
|
|
56
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
57
|
+
}[]>;
|
|
58
|
+
models(): Promise<{
|
|
59
|
+
type: string;
|
|
60
|
+
model: string;
|
|
61
|
+
provider: string;
|
|
62
|
+
input_credits_per_token: number;
|
|
63
|
+
output_credits_per_token: number;
|
|
64
|
+
providerDisplayName: string;
|
|
65
|
+
status?: {
|
|
66
|
+
available: boolean;
|
|
67
|
+
} | null | undefined;
|
|
68
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
69
|
+
}[]>;
|
|
22
70
|
constructor(options: AIGNEHubImageModelOptions);
|
|
23
71
|
protected client: ImageModel;
|
|
24
72
|
get credential(): import("@aigne/core/utils/type-utils.js").PromiseOrValue<{
|
|
@@ -2,3 +2,4 @@ export declare const AIGNE_HUB_URL = "https://hub.aigne.io/";
|
|
|
2
2
|
export declare const AIGNE_HUB_BLOCKLET_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
|
|
3
3
|
export declare const AIGNE_HUB_DEFAULT_MODEL = "openai/gpt-5-mini";
|
|
4
4
|
export declare const AIGNE_HUB_IMAGE_MODEL = "openai/gpt-image-1";
|
|
5
|
+
export declare const aigneHubBaseUrl: () => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GetModelsOptions {
|
|
2
|
+
baseURL?: string;
|
|
3
|
+
type?: "image" | "chat" | "embedding";
|
|
4
|
+
}
|
|
5
|
+
export declare function getModels(options: GetModelsOptions): Promise<{
|
|
6
|
+
type: string;
|
|
7
|
+
model: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
input_credits_per_token: number;
|
|
10
|
+
output_credits_per_token: number;
|
|
11
|
+
providerDisplayName: string;
|
|
12
|
+
status?: {
|
|
13
|
+
available: boolean;
|
|
14
|
+
} | null | undefined;
|
|
15
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
16
|
+
}[]>;
|
package/lib/dts/utils/type.d.ts
CHANGED
|
@@ -29,9 +29,9 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
29
29
|
}>>;
|
|
30
30
|
clientOptions: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
model?: string | undefined;
|
|
32
33
|
url?: string | undefined;
|
|
33
34
|
apiKey?: string | undefined;
|
|
34
|
-
model?: string | undefined;
|
|
35
35
|
modelOptions?: {
|
|
36
36
|
parallelToolCalls: boolean;
|
|
37
37
|
model?: string | undefined;
|
|
@@ -42,9 +42,9 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
42
42
|
} | undefined;
|
|
43
43
|
clientOptions?: {} | undefined;
|
|
44
44
|
}, {
|
|
45
|
+
model?: string | undefined;
|
|
45
46
|
url?: string | undefined;
|
|
46
47
|
apiKey?: string | undefined;
|
|
47
|
-
model?: string | undefined;
|
|
48
48
|
modelOptions?: {
|
|
49
49
|
model?: string | undefined;
|
|
50
50
|
temperature?: number | undefined;
|
|
@@ -56,7 +56,6 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
56
56
|
clientOptions?: {} | undefined;
|
|
57
57
|
}>;
|
|
58
58
|
export interface AIGNEHubChatModelOptions extends ChatModelOptions {
|
|
59
|
-
url?: string;
|
|
60
59
|
baseURL?: string;
|
|
61
60
|
apiKey?: string;
|
|
62
61
|
clientOptions?: OpenAIChatModelOptions["clientOptions"] & {
|
|
@@ -4,6 +4,18 @@ import { type AIGNEHubImageModelOptions } from "./utils/type.js";
|
|
|
4
4
|
export declare class AIGNEHubImageModel extends ImageModel {
|
|
5
5
|
options: AIGNEHubImageModelOptions;
|
|
6
6
|
constructor(options: AIGNEHubImageModelOptions);
|
|
7
|
+
models(): Promise<{
|
|
8
|
+
type: string;
|
|
9
|
+
model: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
input_credits_per_token: number;
|
|
12
|
+
output_credits_per_token: number;
|
|
13
|
+
providerDisplayName: string;
|
|
14
|
+
status?: {
|
|
15
|
+
available: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
18
|
+
}[]>;
|
|
7
19
|
protected _client?: Promise<BaseClient>;
|
|
8
20
|
get client(): Promise<BaseClient>;
|
|
9
21
|
private _credential?;
|
|
@@ -4,7 +4,8 @@ import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
|
|
|
4
4
|
import { BaseClient, } from "@aigne/transport/http-client/base-client.js";
|
|
5
5
|
import { joinURL } from "ufo";
|
|
6
6
|
import { getAIGNEHubMountPoint } from "./utils/blocklet.js";
|
|
7
|
-
import { AIGNE_HUB_BLOCKLET_DID, AIGNE_HUB_IMAGE_MODEL,
|
|
7
|
+
import { AIGNE_HUB_BLOCKLET_DID, AIGNE_HUB_IMAGE_MODEL, aigneHubBaseUrl, } from "./utils/constants.js";
|
|
8
|
+
import { getModels } from "./utils/hub.js";
|
|
8
9
|
import { aigneHubModelOptionsSchema } from "./utils/type.js";
|
|
9
10
|
export class AIGNEHubImageModel extends ImageModel {
|
|
10
11
|
options;
|
|
@@ -13,6 +14,9 @@ export class AIGNEHubImageModel extends ImageModel {
|
|
|
13
14
|
super();
|
|
14
15
|
this.options = options;
|
|
15
16
|
}
|
|
17
|
+
async models() {
|
|
18
|
+
return getModels({ baseURL: (await this.credential).url, type: "image" });
|
|
19
|
+
}
|
|
16
20
|
_client;
|
|
17
21
|
get client() {
|
|
18
22
|
this._client ??= this.credential.then(({ url, apiKey, model }) => {
|
|
@@ -23,11 +27,7 @@ export class AIGNEHubImageModel extends ImageModel {
|
|
|
23
27
|
}
|
|
24
28
|
_credential;
|
|
25
29
|
get credential() {
|
|
26
|
-
this._credential ??= getAIGNEHubMountPoint(this.options.url
|
|
27
|
-
this.options.baseURL ||
|
|
28
|
-
process.env.BLOCKLET_AIGNE_API_URL ||
|
|
29
|
-
process.env.AIGNE_HUB_API_URL ||
|
|
30
|
-
AIGNE_HUB_URL, AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
30
|
+
this._credential ??= getAIGNEHubMountPoint(this.options.baseURL || aigneHubBaseUrl(), AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
31
31
|
const path = "/api/v2/image";
|
|
32
32
|
const rawCredential = process.env.BLOCKLET_AIGNE_API_CREDENTIAL;
|
|
33
33
|
let credentialOptions = {};
|
|
@@ -4,6 +4,18 @@ import { type AIGNEHubChatModelOptions } from "./utils/type.js";
|
|
|
4
4
|
export declare class AIGNEHubChatModel extends ChatModel {
|
|
5
5
|
options: AIGNEHubChatModelOptions;
|
|
6
6
|
constructor(options: AIGNEHubChatModelOptions);
|
|
7
|
+
models(): Promise<{
|
|
8
|
+
type: string;
|
|
9
|
+
model: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
input_credits_per_token: number;
|
|
12
|
+
output_credits_per_token: number;
|
|
13
|
+
providerDisplayName: string;
|
|
14
|
+
status?: {
|
|
15
|
+
available: boolean;
|
|
16
|
+
} | null | undefined;
|
|
17
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
18
|
+
}[]>;
|
|
7
19
|
protected _client?: Promise<BaseClient>;
|
|
8
20
|
get client(): Promise<BaseClient>;
|
|
9
21
|
private _credential?;
|
|
@@ -4,7 +4,8 @@ import { nodejs } from "@aigne/platform-helpers/nodejs/index.js";
|
|
|
4
4
|
import { BaseClient, } from "@aigne/transport/http-client/base-client.js";
|
|
5
5
|
import { joinURL } from "ufo";
|
|
6
6
|
import { getAIGNEHubMountPoint } from "./utils/blocklet.js";
|
|
7
|
-
import { AIGNE_HUB_BLOCKLET_DID, AIGNE_HUB_DEFAULT_MODEL,
|
|
7
|
+
import { AIGNE_HUB_BLOCKLET_DID, AIGNE_HUB_DEFAULT_MODEL, aigneHubBaseUrl, } from "./utils/constants.js";
|
|
8
|
+
import { getModels } from "./utils/hub.js";
|
|
8
9
|
import { aigneHubModelOptionsSchema } from "./utils/type.js";
|
|
9
10
|
export class AIGNEHubChatModel extends ChatModel {
|
|
10
11
|
options;
|
|
@@ -13,6 +14,9 @@ export class AIGNEHubChatModel extends ChatModel {
|
|
|
13
14
|
super();
|
|
14
15
|
this.options = options;
|
|
15
16
|
}
|
|
17
|
+
async models() {
|
|
18
|
+
return getModels({ baseURL: (await this.credential).url, type: "chat" });
|
|
19
|
+
}
|
|
16
20
|
_client;
|
|
17
21
|
get client() {
|
|
18
22
|
this._client ??= this.credential.then(({ url, apiKey, model }) => {
|
|
@@ -23,11 +27,7 @@ export class AIGNEHubChatModel extends ChatModel {
|
|
|
23
27
|
}
|
|
24
28
|
_credential;
|
|
25
29
|
get credential() {
|
|
26
|
-
this._credential ??= getAIGNEHubMountPoint(this.options.url
|
|
27
|
-
this.options.baseURL ||
|
|
28
|
-
process.env.BLOCKLET_AIGNE_API_URL ||
|
|
29
|
-
process.env.AIGNE_HUB_API_URL ||
|
|
30
|
-
AIGNE_HUB_URL, AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
30
|
+
this._credential ??= getAIGNEHubMountPoint(this.options.baseURL || aigneHubBaseUrl(), AIGNE_HUB_BLOCKLET_DID).then((url) => {
|
|
31
31
|
const path = "/api/v2/chat";
|
|
32
32
|
const rawCredential = process.env.BLOCKLET_AIGNE_API_CREDENTIAL;
|
|
33
33
|
let credentialOptions = {};
|
package/lib/esm/index.d.ts
CHANGED
|
@@ -7,6 +7,30 @@ export * from "./utils/model.js";
|
|
|
7
7
|
export declare class AIGNEHubChatModel extends ChatModel {
|
|
8
8
|
options: AIGNEHubChatModelOptions;
|
|
9
9
|
static load(options: AIGNEHubChatModelOptions): Promise<AIGNEHubChatModel>;
|
|
10
|
+
static models(): Promise<{
|
|
11
|
+
type: string;
|
|
12
|
+
model: string;
|
|
13
|
+
provider: string;
|
|
14
|
+
input_credits_per_token: number;
|
|
15
|
+
output_credits_per_token: number;
|
|
16
|
+
providerDisplayName: string;
|
|
17
|
+
status?: {
|
|
18
|
+
available: boolean;
|
|
19
|
+
} | null | undefined;
|
|
20
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
21
|
+
}[]>;
|
|
22
|
+
models(): Promise<{
|
|
23
|
+
type: string;
|
|
24
|
+
model: string;
|
|
25
|
+
provider: string;
|
|
26
|
+
input_credits_per_token: number;
|
|
27
|
+
output_credits_per_token: number;
|
|
28
|
+
providerDisplayName: string;
|
|
29
|
+
status?: {
|
|
30
|
+
available: boolean;
|
|
31
|
+
} | null | undefined;
|
|
32
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
33
|
+
}[]>;
|
|
10
34
|
constructor(options: AIGNEHubChatModelOptions);
|
|
11
35
|
protected client: ChatModel;
|
|
12
36
|
get credential(): import("@aigne/core/utils/type-utils.js").PromiseOrValue<{
|
|
@@ -19,6 +43,30 @@ export declare class AIGNEHubChatModel extends ChatModel {
|
|
|
19
43
|
export declare class AIGNEHubImageModel extends ImageModel {
|
|
20
44
|
options: AIGNEHubImageModelOptions;
|
|
21
45
|
static load(options: AIGNEHubImageModelOptions): Promise<AIGNEHubImageModel>;
|
|
46
|
+
static models(): Promise<{
|
|
47
|
+
type: string;
|
|
48
|
+
model: string;
|
|
49
|
+
provider: string;
|
|
50
|
+
input_credits_per_token: number;
|
|
51
|
+
output_credits_per_token: number;
|
|
52
|
+
providerDisplayName: string;
|
|
53
|
+
status?: {
|
|
54
|
+
available: boolean;
|
|
55
|
+
} | null | undefined;
|
|
56
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
57
|
+
}[]>;
|
|
58
|
+
models(): Promise<{
|
|
59
|
+
type: string;
|
|
60
|
+
model: string;
|
|
61
|
+
provider: string;
|
|
62
|
+
input_credits_per_token: number;
|
|
63
|
+
output_credits_per_token: number;
|
|
64
|
+
providerDisplayName: string;
|
|
65
|
+
status?: {
|
|
66
|
+
available: boolean;
|
|
67
|
+
} | null | undefined;
|
|
68
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
69
|
+
}[]>;
|
|
22
70
|
constructor(options: AIGNEHubImageModelOptions);
|
|
23
71
|
protected client: ImageModel;
|
|
24
72
|
get credential(): import("@aigne/core/utils/type-utils.js").PromiseOrValue<{
|
package/lib/esm/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ChatModel, ImageModel, } from "@aigne/core";
|
|
2
|
+
import { getModels } from "./utils/hub.js";
|
|
2
3
|
import { findImageModel, findModel, parseModel } from "./utils/model.js";
|
|
3
4
|
export * from "./utils/blocklet.js";
|
|
4
5
|
export * from "./utils/constants.js";
|
|
@@ -8,6 +9,12 @@ export class AIGNEHubChatModel extends ChatModel {
|
|
|
8
9
|
static async load(options) {
|
|
9
10
|
return new AIGNEHubChatModel(options);
|
|
10
11
|
}
|
|
12
|
+
static async models() {
|
|
13
|
+
return getModels({ type: "chat" });
|
|
14
|
+
}
|
|
15
|
+
models() {
|
|
16
|
+
return getModels({ type: "chat" });
|
|
17
|
+
}
|
|
11
18
|
constructor(options) {
|
|
12
19
|
let provider = process.env.BLOCKLET_AIGNE_API_PROVIDER;
|
|
13
20
|
if (!provider && options.model) {
|
|
@@ -41,6 +48,12 @@ export class AIGNEHubImageModel extends ImageModel {
|
|
|
41
48
|
static async load(options) {
|
|
42
49
|
return new AIGNEHubImageModel(options);
|
|
43
50
|
}
|
|
51
|
+
static async models() {
|
|
52
|
+
return getModels({ type: "image" });
|
|
53
|
+
}
|
|
54
|
+
models() {
|
|
55
|
+
return getModels({ type: "image" });
|
|
56
|
+
}
|
|
44
57
|
constructor(options) {
|
|
45
58
|
let provider = process.env.BLOCKLET_AIGNE_API_PROVIDER;
|
|
46
59
|
if (!provider && options.model) {
|
|
@@ -2,3 +2,4 @@ export declare const AIGNE_HUB_URL = "https://hub.aigne.io/";
|
|
|
2
2
|
export declare const AIGNE_HUB_BLOCKLET_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
|
|
3
3
|
export declare const AIGNE_HUB_DEFAULT_MODEL = "openai/gpt-5-mini";
|
|
4
4
|
export declare const AIGNE_HUB_IMAGE_MODEL = "openai/gpt-image-1";
|
|
5
|
+
export declare const aigneHubBaseUrl: () => string;
|
|
@@ -2,3 +2,4 @@ export const AIGNE_HUB_URL = "https://hub.aigne.io/";
|
|
|
2
2
|
export const AIGNE_HUB_BLOCKLET_DID = "z8ia3xzq2tMq8CRHfaXj1BTYJyYnEcHbqP8cJ";
|
|
3
3
|
export const AIGNE_HUB_DEFAULT_MODEL = "openai/gpt-5-mini";
|
|
4
4
|
export const AIGNE_HUB_IMAGE_MODEL = "openai/gpt-image-1";
|
|
5
|
+
export const aigneHubBaseUrl = () => process.env.BLOCKLET_AIGNE_API_URL || process.env.AIGNE_HUB_API_URL || AIGNE_HUB_URL;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface GetModelsOptions {
|
|
2
|
+
baseURL?: string;
|
|
3
|
+
type?: "image" | "chat" | "embedding";
|
|
4
|
+
}
|
|
5
|
+
export declare function getModels(options: GetModelsOptions): Promise<{
|
|
6
|
+
type: string;
|
|
7
|
+
model: string;
|
|
8
|
+
provider: string;
|
|
9
|
+
input_credits_per_token: number;
|
|
10
|
+
output_credits_per_token: number;
|
|
11
|
+
providerDisplayName: string;
|
|
12
|
+
status?: {
|
|
13
|
+
available: boolean;
|
|
14
|
+
} | null | undefined;
|
|
15
|
+
modelMetadata?: Record<string, unknown> | null | undefined;
|
|
16
|
+
}[]>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { joinURL, withQuery } from "ufo";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getAIGNEHubMountPoint } from "./blocklet.js";
|
|
4
|
+
import { AIGNE_HUB_BLOCKLET_DID, aigneHubBaseUrl } from "./constants.js";
|
|
5
|
+
const modelsSchema = z.array(z.object({
|
|
6
|
+
model: z.string(),
|
|
7
|
+
type: z.string(),
|
|
8
|
+
provider: z.string(),
|
|
9
|
+
input_credits_per_token: z.number(),
|
|
10
|
+
output_credits_per_token: z.number(),
|
|
11
|
+
modelMetadata: z.record(z.unknown()).nullish(),
|
|
12
|
+
providerDisplayName: z.string(),
|
|
13
|
+
status: z
|
|
14
|
+
.object({
|
|
15
|
+
available: z.boolean(),
|
|
16
|
+
})
|
|
17
|
+
.nullish(),
|
|
18
|
+
}));
|
|
19
|
+
export async function getModels(options) {
|
|
20
|
+
const url = await getAIGNEHubMountPoint(options.baseURL || aigneHubBaseUrl(), AIGNE_HUB_BLOCKLET_DID);
|
|
21
|
+
const response = await fetch(withQuery(joinURL(url, "/api/ai/models"), {
|
|
22
|
+
type: options.type,
|
|
23
|
+
}));
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
const text = await response.text().catch(() => "");
|
|
26
|
+
throw new Error(`Failed to fetch models: ${response.status} ${response.statusText} ${text}`);
|
|
27
|
+
}
|
|
28
|
+
const json = await response.json().catch((error) => {
|
|
29
|
+
throw new Error(`Failed to parse response as JSON from ${url}: ${error.message}`);
|
|
30
|
+
});
|
|
31
|
+
return modelsSchema.parse(json);
|
|
32
|
+
}
|
package/lib/esm/utils/type.d.ts
CHANGED
|
@@ -29,9 +29,9 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
29
29
|
}>>;
|
|
30
30
|
clientOptions: z.ZodOptional<z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>>;
|
|
31
31
|
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
model?: string | undefined;
|
|
32
33
|
url?: string | undefined;
|
|
33
34
|
apiKey?: string | undefined;
|
|
34
|
-
model?: string | undefined;
|
|
35
35
|
modelOptions?: {
|
|
36
36
|
parallelToolCalls: boolean;
|
|
37
37
|
model?: string | undefined;
|
|
@@ -42,9 +42,9 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
42
42
|
} | undefined;
|
|
43
43
|
clientOptions?: {} | undefined;
|
|
44
44
|
}, {
|
|
45
|
+
model?: string | undefined;
|
|
45
46
|
url?: string | undefined;
|
|
46
47
|
apiKey?: string | undefined;
|
|
47
|
-
model?: string | undefined;
|
|
48
48
|
modelOptions?: {
|
|
49
49
|
model?: string | undefined;
|
|
50
50
|
temperature?: number | undefined;
|
|
@@ -56,7 +56,6 @@ export declare const aigneHubModelOptionsSchema: z.ZodObject<{
|
|
|
56
56
|
clientOptions?: {} | undefined;
|
|
57
57
|
}>;
|
|
58
58
|
export interface AIGNEHubChatModelOptions extends ChatModelOptions {
|
|
59
|
-
url?: string;
|
|
60
59
|
baseURL?: string;
|
|
61
60
|
apiKey?: string;
|
|
62
61
|
clientOptions?: OpenAIChatModelOptions["clientOptions"] & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aigne/aigne-hub",
|
|
3
|
-
"version": "0.10.0-beta",
|
|
3
|
+
"version": "0.10.0-beta.1",
|
|
4
4
|
"description": "AIGNE Hub SDK for integrating with Hub AI models",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -40,19 +40,19 @@
|
|
|
40
40
|
"ufo": "^1.6.1",
|
|
41
41
|
"zod": "^3.25.67",
|
|
42
42
|
"@aigne/anthropic": "^0.13.5-beta",
|
|
43
|
-
"@aigne/core": "^1.61.0-beta",
|
|
44
43
|
"@aigne/bedrock": "^0.10.5-beta",
|
|
45
|
-
"@aigne/deepseek": "^0.7.46-beta",
|
|
46
|
-
"@aigne/doubao": "^1.1.0-beta",
|
|
47
|
-
"@aigne/
|
|
48
|
-
"@aigne/
|
|
49
|
-
"@aigne/
|
|
50
|
-
"@aigne/
|
|
51
|
-
"@aigne/
|
|
44
|
+
"@aigne/deepseek": "^0.7.46-beta.1",
|
|
45
|
+
"@aigne/doubao": "^1.1.0-beta.1",
|
|
46
|
+
"@aigne/core": "^1.61.0-beta",
|
|
47
|
+
"@aigne/gemini": "^0.14.0-beta.1",
|
|
48
|
+
"@aigne/ollama": "^0.7.46-beta.1",
|
|
49
|
+
"@aigne/open-router": "^0.7.46-beta.1",
|
|
50
|
+
"@aigne/openai": "^0.16.0-beta.1",
|
|
52
51
|
"@aigne/platform-helpers": "^0.6.3-beta",
|
|
53
|
-
"@aigne/
|
|
54
|
-
"@aigne/
|
|
55
|
-
"@aigne/transport": "^0.15.9-beta"
|
|
52
|
+
"@aigne/ideogram": "^0.4.0-beta",
|
|
53
|
+
"@aigne/poe": "^1.0.26-beta.1",
|
|
54
|
+
"@aigne/transport": "^0.15.9-beta.1",
|
|
55
|
+
"@aigne/xai": "^0.7.46-beta.1"
|
|
56
56
|
},
|
|
57
57
|
"devDependencies": {
|
|
58
58
|
"@types/bun": "^1.2.22",
|