@aigne/aigne-hub 0.1.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/CHANGELOG.md +20 -0
- package/LICENSE.md +93 -0
- package/README.md +125 -0
- package/lib/cjs/aigne-hub-model.d.ts +17 -0
- package/lib/cjs/aigne-hub-model.js +44 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +17 -0
- package/lib/cjs/package.json +3 -0
- package/lib/dts/aigne-hub-model.d.ts +17 -0
- package/lib/dts/index.d.ts +1 -0
- package/lib/esm/aigne-hub-model.d.ts +17 -0
- package/lib/esm/aigne-hub-model.js +40 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/package.json +3 -0
- package/package.json +50 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0](https://github.com/AIGNE-io/aigne-framework/compare/aigne-hub-v0.0.1...aigne-hub-v0.1.0) (2025-07-15)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **memory:** support did space memory adapter ([#229](https://github.com/AIGNE-io/aigne-framework/issues/229)) ([6f69b64](https://github.com/AIGNE-io/aigne-framework/commit/6f69b64e98b963db9d6ab5357306b445385eaa68))
|
|
9
|
+
* **model:** support aigne-hub model adapter ([#253](https://github.com/AIGNE-io/aigne-framework/issues/253)) ([4b33f8d](https://github.com/AIGNE-io/aigne-framework/commit/4b33f8d1a819f52357db81d502c56b55eaa0669f))
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
### Dependencies
|
|
13
|
+
|
|
14
|
+
* The following workspace dependencies were updated
|
|
15
|
+
* dependencies
|
|
16
|
+
* @aigne/core bumped to 1.34.0
|
|
17
|
+
* @aigne/transport bumped to 0.10.0
|
|
18
|
+
* devDependencies
|
|
19
|
+
* @aigne/openai bumped to 0.10.0
|
|
20
|
+
* @aigne/test-utils bumped to 0.5.8
|
package/LICENSE.md
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Elastic License 2.0
|
|
2
|
+
|
|
3
|
+
URL: https://www.elastic.co/licensing/elastic-license
|
|
4
|
+
|
|
5
|
+
## Acceptance
|
|
6
|
+
|
|
7
|
+
By using the software, you agree to all of the terms and conditions below.
|
|
8
|
+
|
|
9
|
+
## Copyright License
|
|
10
|
+
|
|
11
|
+
The licensor grants you a non-exclusive, royalty-free, worldwide,
|
|
12
|
+
non-sublicensable, non-transferable license to use, copy, distribute, make
|
|
13
|
+
available, and prepare derivative works of the software, in each case subject to
|
|
14
|
+
the limitations and conditions below.
|
|
15
|
+
|
|
16
|
+
## Limitations
|
|
17
|
+
|
|
18
|
+
You may not provide the software to third parties as a hosted or managed
|
|
19
|
+
service, where the service provides users with access to any substantial set of
|
|
20
|
+
the features or functionality of the software.
|
|
21
|
+
|
|
22
|
+
You may not move, change, disable, or circumvent the license key functionality
|
|
23
|
+
in the software, and you may not remove or obscure any functionality in the
|
|
24
|
+
software that is protected by the license key.
|
|
25
|
+
|
|
26
|
+
You may not alter, remove, or obscure any licensing, copyright, or other notices
|
|
27
|
+
of the licensor in the software. Any use of the licensor’s trademarks is subject
|
|
28
|
+
to applicable law.
|
|
29
|
+
|
|
30
|
+
## Patents
|
|
31
|
+
|
|
32
|
+
The licensor grants you a license, under any patent claims the licensor can
|
|
33
|
+
license, or becomes able to license, to make, have made, use, sell, offer for
|
|
34
|
+
sale, import and have imported the software, in each case subject to the
|
|
35
|
+
limitations and conditions in this license. This license does not cover any
|
|
36
|
+
patent claims that you cause to be infringed by modifications or additions to
|
|
37
|
+
the software. If you or your company make any written claim that the software
|
|
38
|
+
infringes or contributes to infringement of any patent, your patent license for
|
|
39
|
+
the software granted under these terms ends immediately. If your company makes
|
|
40
|
+
such a claim, your patent license ends immediately for work on behalf of your
|
|
41
|
+
company.
|
|
42
|
+
|
|
43
|
+
## Notices
|
|
44
|
+
|
|
45
|
+
You must ensure that anyone who gets a copy of any part of the software from you
|
|
46
|
+
also gets a copy of these terms.
|
|
47
|
+
|
|
48
|
+
If you modify the software, you must include in any modified copies of the
|
|
49
|
+
software prominent notices stating that you have modified the software.
|
|
50
|
+
|
|
51
|
+
## No Other Rights
|
|
52
|
+
|
|
53
|
+
These terms do not imply any licenses other than those expressly granted in
|
|
54
|
+
these terms.
|
|
55
|
+
|
|
56
|
+
## Termination
|
|
57
|
+
|
|
58
|
+
If you use the software in violation of these terms, such use is not licensed,
|
|
59
|
+
and your licenses will automatically terminate. If the licensor provides you
|
|
60
|
+
with a notice of your violation, and you cease all violation of this license no
|
|
61
|
+
later than 30 days after you receive that notice, your licenses will be
|
|
62
|
+
reinstated retroactively. However, if you violate these terms after such
|
|
63
|
+
reinstatement, any additional violation of these terms will cause your licenses
|
|
64
|
+
to terminate automatically and permanently.
|
|
65
|
+
|
|
66
|
+
## No Liability
|
|
67
|
+
|
|
68
|
+
*As far as the law allows, the software comes as is, without any warranty or
|
|
69
|
+
condition, and the licensor will not be liable to you for any damages arising
|
|
70
|
+
out of these terms or the use or nature of the software, under any kind of
|
|
71
|
+
legal claim.*
|
|
72
|
+
|
|
73
|
+
## Definitions
|
|
74
|
+
|
|
75
|
+
The **licensor** is the entity offering these terms, and the **software** is the
|
|
76
|
+
software the licensor makes available under these terms, including any portion
|
|
77
|
+
of it.
|
|
78
|
+
|
|
79
|
+
**you** refers to the individual or entity agreeing to these terms.
|
|
80
|
+
|
|
81
|
+
**your company** is any legal entity, sole proprietorship, or other kind of
|
|
82
|
+
organization that you work for, plus all organizations that have control over,
|
|
83
|
+
are under the control of, or are under common control with that
|
|
84
|
+
organization. **control** means ownership of substantially all the assets of an
|
|
85
|
+
entity, or the power to direct its management and policies by vote, contract, or
|
|
86
|
+
otherwise. Control can be direct or indirect.
|
|
87
|
+
|
|
88
|
+
**your licenses** are all the licenses granted to you for the software under
|
|
89
|
+
these terms.
|
|
90
|
+
|
|
91
|
+
**use** means anything you do with the software requiring one of your licenses.
|
|
92
|
+
|
|
93
|
+
**trademark** means trademarks, service marks, and similar rights.
|
package/README.md
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
# @aigne/aigne-hub
|
|
2
|
+
|
|
3
|
+
[](https://star-history.com/#AIGNE-io/aigne-framework)
|
|
4
|
+
[](https://github.com/AIGNE-io/aigne-framework/issues)
|
|
5
|
+
[](https://codecov.io/gh/AIGNE-io/aigne-framework)
|
|
6
|
+
[](https://www.npmjs.com/package/@aigne/aigne-hub)
|
|
7
|
+
[](https://github.com/AIGNE-io/aigne-framework/blob/main/LICENSE.md)
|
|
8
|
+
|
|
9
|
+
AIGNE SDK for accessing AI chat models via [AIGNE Hub](https://github.com/AIGNE-io/aigne-framework), a unified proxy layer for multiple LLM providers.
|
|
10
|
+
|
|
11
|
+
# Introduction
|
|
12
|
+
|
|
13
|
+
`@aigne/aigne-hub` connects your application to the AIGNE Hub service, a gateway that aggregates multiple LLM providers such as OpenAI, Anthropic, AWS Bedrock, Google, DeepSeek, Ollama, xAI, and OpenRouter. You can call any supported model simply by passing the appropriate `model` name.
|
|
14
|
+
|
|
15
|
+
It enables you to switch providers without changing your client-side logic.
|
|
16
|
+
|
|
17
|
+
## Supported Providers
|
|
18
|
+
|
|
19
|
+
The AIGNE Hub backend supports the following AI providers via a single, unified API:
|
|
20
|
+
|
|
21
|
+
```ts
|
|
22
|
+
type AIProvider = 'openai' | 'anthropic' | 'bedrock' | 'deepseek' | 'google' | 'ollama' | 'openRouter' | 'xai';
|
|
23
|
+
```
|
|
24
|
+
## Example models:
|
|
25
|
+
- openai/gpt-4o-mini
|
|
26
|
+
- anthropic/claude-3-sonnet
|
|
27
|
+
- bedrock/us.amazon.titan-text-lite-v1
|
|
28
|
+
- google/gemini-pro
|
|
29
|
+
- xai/grok-1
|
|
30
|
+
- openRouter/mistralai/mistral-7b-instruct
|
|
31
|
+
- ollama/llama3
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
- 🔌 Unified LLM Access: Route all requests through one endpoint
|
|
35
|
+
- 🧠 Multi-provider Support: Choose from any supported vendor via the model name
|
|
36
|
+
- 🔐 API Key Security: Use accessKey to manage authentication and authorization
|
|
37
|
+
- 💬 Chat Completions: Works with standard messages format ({ role, content })
|
|
38
|
+
- 🌊 Streaming Support: Enable streaming: true for real-time token-level responses
|
|
39
|
+
- 🧱 Framework Compatible: Seamless integration with the AIGNE Framework
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
### Using npm
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
npm install @aigne/aigne-hub @aigne/core
|
|
46
|
+
```
|
|
47
|
+
### Using yarn
|
|
48
|
+
```
|
|
49
|
+
yarn add @aigne/aigne-hub @aigne/core
|
|
50
|
+
```
|
|
51
|
+
### Using pnpm
|
|
52
|
+
```
|
|
53
|
+
pnpm add @aigne/aigne-hub @aigne/core
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Basic Usage
|
|
57
|
+
```typescript
|
|
58
|
+
import { AIGNEHubChatModel } from "@aigne/aigne-hub";
|
|
59
|
+
|
|
60
|
+
const model = new AIGNEHubChatModel({
|
|
61
|
+
url: "https://your-aigne-hub-instance/ai-kit/api/v2/chat",
|
|
62
|
+
accessKey: "your-access-key-id",
|
|
63
|
+
model: "openai/gpt-4o-mini",
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
const result = await model.invoke({
|
|
67
|
+
messages: [{ role: "user", content: "Hello, world!" }],
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
console.log(result);
|
|
71
|
+
/* Example Output:
|
|
72
|
+
{
|
|
73
|
+
text: "Hello! How can I help you today?",
|
|
74
|
+
model: "openai/gpt-4o-mini",
|
|
75
|
+
usage: {
|
|
76
|
+
inputTokens: 8,
|
|
77
|
+
outputTokens: 9
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
*/
|
|
81
|
+
```
|
|
82
|
+
## Streaming Usage
|
|
83
|
+
```typescript
|
|
84
|
+
import { AIGNEHubChatModel } from "@aigne/aigne-hub";
|
|
85
|
+
|
|
86
|
+
const model = new AIGNEHubChatModel({
|
|
87
|
+
url: "https://your-aigne-hub-instance/ai-kit/api/v2/chat",
|
|
88
|
+
accessKey: "your-access-key-id",
|
|
89
|
+
model: "openai/gpt-4o-mini",
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
const stream = await model.invoke(
|
|
93
|
+
{
|
|
94
|
+
messages: [{ role: "user", content: "Hello, who are you?" }],
|
|
95
|
+
},
|
|
96
|
+
{ streaming: true },
|
|
97
|
+
);
|
|
98
|
+
|
|
99
|
+
let fullText = "";
|
|
100
|
+
const json = {};
|
|
101
|
+
|
|
102
|
+
for await (const chunk of stream) {
|
|
103
|
+
if (isAgentResponseDelta(chunk)) {
|
|
104
|
+
const text = chunk.delta.text?.text;
|
|
105
|
+
if (text) fullText += text;
|
|
106
|
+
if (chunk.delta.json) Object.assign(json, chunk.delta.json);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
console.log(fullText); // Output: "Hello! How can I assist you today?"
|
|
111
|
+
console.log(json); // { model: "gpt-4o", usage: { inputTokens: 10, outputTokens: 9 } }
|
|
112
|
+
```
|
|
113
|
+
## Configuration Options
|
|
114
|
+
```typescript
|
|
115
|
+
interface ClientChatModelOptions {
|
|
116
|
+
url: string; // Your AIGNE Hub endpoint
|
|
117
|
+
accessKey: string; // API access key
|
|
118
|
+
model: string; // Model name with provider prefix (e.g. openai/gpt-4o-mini)
|
|
119
|
+
modelOptions?: object; // Optional model-specific parameters
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
## License
|
|
124
|
+
|
|
125
|
+
Elastic-2.0
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
2
|
+
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
|
+
import type { OpenAIChatModelOptions } from "@aigne/openai";
|
|
4
|
+
interface AIGNEHubChatModelOptions {
|
|
5
|
+
url?: string;
|
|
6
|
+
accessKey?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
modelOptions?: ChatModelOptions;
|
|
9
|
+
clientOptions?: OpenAIChatModelOptions["clientOptions"];
|
|
10
|
+
}
|
|
11
|
+
export declare class AIGNEHubChatModel extends ChatModel {
|
|
12
|
+
options: AIGNEHubChatModelOptions;
|
|
13
|
+
private client;
|
|
14
|
+
constructor(options: AIGNEHubChatModelOptions);
|
|
15
|
+
process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AIGNEHubChatModel = void 0;
|
|
4
|
+
const core_1 = require("@aigne/core");
|
|
5
|
+
const type_utils_js_1 = require("@aigne/core/utils/type-utils.js");
|
|
6
|
+
const base_client_js_1 = require("@aigne/transport/http-client/base-client.js");
|
|
7
|
+
const zod_1 = require("zod");
|
|
8
|
+
const DEFAULT_CHAT_MODEL = "openai/gpt-4o";
|
|
9
|
+
const DEFAULT_URL = "https://www.aikit.rocks/ai-kit/api/v2/chat";
|
|
10
|
+
const aigneHubChatModelOptionsSchema = zod_1.z.object({
|
|
11
|
+
url: zod_1.z.string().optional(),
|
|
12
|
+
accessKey: zod_1.z.string().optional(),
|
|
13
|
+
model: zod_1.z.string().optional(),
|
|
14
|
+
modelOptions: zod_1.z
|
|
15
|
+
.object({
|
|
16
|
+
model: zod_1.z.string().optional(),
|
|
17
|
+
temperature: zod_1.z.number().optional(),
|
|
18
|
+
topP: zod_1.z.number().optional(),
|
|
19
|
+
frequencyPenalty: zod_1.z.number().optional(),
|
|
20
|
+
presencePenalty: zod_1.z.number().optional(),
|
|
21
|
+
parallelToolCalls: zod_1.z.boolean().optional().default(true),
|
|
22
|
+
})
|
|
23
|
+
.optional(),
|
|
24
|
+
clientOptions: zod_1.z.object({}).optional(),
|
|
25
|
+
});
|
|
26
|
+
class AIGNEHubChatModel extends core_1.ChatModel {
|
|
27
|
+
options;
|
|
28
|
+
client;
|
|
29
|
+
constructor(options) {
|
|
30
|
+
(0, type_utils_js_1.checkArguments)("AIGNEHubChatModel", aigneHubChatModelOptionsSchema, options);
|
|
31
|
+
super();
|
|
32
|
+
this.options = options;
|
|
33
|
+
this.client = new base_client_js_1.BaseClient({
|
|
34
|
+
...options,
|
|
35
|
+
url: options.url ?? process.env.AIGNE_HUB_BASE_URL ?? DEFAULT_URL,
|
|
36
|
+
model: options.model ?? DEFAULT_CHAT_MODEL,
|
|
37
|
+
accessKey: options.accessKey ?? process.env.AIGNE_HUB_ACCESS_KEY,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
process(input, options) {
|
|
41
|
+
return this.client.__invoke(undefined, input, options);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.AIGNEHubChatModel = AIGNEHubChatModel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./aigne-hub-model.js";
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./aigne-hub-model.js"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
2
|
+
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
|
+
import type { OpenAIChatModelOptions } from "@aigne/openai";
|
|
4
|
+
interface AIGNEHubChatModelOptions {
|
|
5
|
+
url?: string;
|
|
6
|
+
accessKey?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
modelOptions?: ChatModelOptions;
|
|
9
|
+
clientOptions?: OpenAIChatModelOptions["clientOptions"];
|
|
10
|
+
}
|
|
11
|
+
export declare class AIGNEHubChatModel extends ChatModel {
|
|
12
|
+
options: AIGNEHubChatModelOptions;
|
|
13
|
+
private client;
|
|
14
|
+
constructor(options: AIGNEHubChatModelOptions);
|
|
15
|
+
process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./aigne-hub-model.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type AgentInvokeOptions, type AgentProcessResult, ChatModel, type ChatModelInput, type ChatModelOptions, type ChatModelOutput } from "@aigne/core";
|
|
2
|
+
import { type PromiseOrValue } from "@aigne/core/utils/type-utils.js";
|
|
3
|
+
import type { OpenAIChatModelOptions } from "@aigne/openai";
|
|
4
|
+
interface AIGNEHubChatModelOptions {
|
|
5
|
+
url?: string;
|
|
6
|
+
accessKey?: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
modelOptions?: ChatModelOptions;
|
|
9
|
+
clientOptions?: OpenAIChatModelOptions["clientOptions"];
|
|
10
|
+
}
|
|
11
|
+
export declare class AIGNEHubChatModel extends ChatModel {
|
|
12
|
+
options: AIGNEHubChatModelOptions;
|
|
13
|
+
private client;
|
|
14
|
+
constructor(options: AIGNEHubChatModelOptions);
|
|
15
|
+
process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
16
|
+
}
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { ChatModel, } from "@aigne/core";
|
|
2
|
+
import { checkArguments } from "@aigne/core/utils/type-utils.js";
|
|
3
|
+
import { BaseClient } from "@aigne/transport/http-client/base-client.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
const DEFAULT_CHAT_MODEL = "openai/gpt-4o";
|
|
6
|
+
const DEFAULT_URL = "https://www.aikit.rocks/ai-kit/api/v2/chat";
|
|
7
|
+
const aigneHubChatModelOptionsSchema = z.object({
|
|
8
|
+
url: z.string().optional(),
|
|
9
|
+
accessKey: z.string().optional(),
|
|
10
|
+
model: z.string().optional(),
|
|
11
|
+
modelOptions: z
|
|
12
|
+
.object({
|
|
13
|
+
model: z.string().optional(),
|
|
14
|
+
temperature: z.number().optional(),
|
|
15
|
+
topP: z.number().optional(),
|
|
16
|
+
frequencyPenalty: z.number().optional(),
|
|
17
|
+
presencePenalty: z.number().optional(),
|
|
18
|
+
parallelToolCalls: z.boolean().optional().default(true),
|
|
19
|
+
})
|
|
20
|
+
.optional(),
|
|
21
|
+
clientOptions: z.object({}).optional(),
|
|
22
|
+
});
|
|
23
|
+
export class AIGNEHubChatModel extends ChatModel {
|
|
24
|
+
options;
|
|
25
|
+
client;
|
|
26
|
+
constructor(options) {
|
|
27
|
+
checkArguments("AIGNEHubChatModel", aigneHubChatModelOptionsSchema, options);
|
|
28
|
+
super();
|
|
29
|
+
this.options = options;
|
|
30
|
+
this.client = new BaseClient({
|
|
31
|
+
...options,
|
|
32
|
+
url: options.url ?? process.env.AIGNE_HUB_BASE_URL ?? DEFAULT_URL,
|
|
33
|
+
model: options.model ?? DEFAULT_CHAT_MODEL,
|
|
34
|
+
accessKey: options.accessKey ?? process.env.AIGNE_HUB_ACCESS_KEY,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
process(input, options) {
|
|
38
|
+
return this.client.__invoke(undefined, input, options);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./aigne-hub-model.js";
|
package/lib/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./aigne-hub-model.js";
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@aigne/aigne-hub",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "AIGNE Hub SDK for integrating with Hub AI models",
|
|
5
|
+
"publishConfig": {
|
|
6
|
+
"access": "public"
|
|
7
|
+
},
|
|
8
|
+
"author": "Arcblock <blocklet@arcblock.io> https://github.com/blocklet",
|
|
9
|
+
"homepage": "https://github.com/AIGNE-io/aigne-framework",
|
|
10
|
+
"license": "Elastic-2.0",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/AIGNE-io/aigne-framework"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"lib/cjs",
|
|
17
|
+
"lib/dts",
|
|
18
|
+
"lib/esm",
|
|
19
|
+
"LICENSE",
|
|
20
|
+
"README.md",
|
|
21
|
+
"CHANGELOG.md"
|
|
22
|
+
],
|
|
23
|
+
"type": "module",
|
|
24
|
+
"main": "./lib/cjs/index.js",
|
|
25
|
+
"module": "./lib/esm/index.js",
|
|
26
|
+
"types": "./lib/dts/index.d.ts",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"zod": "^3.25.67",
|
|
29
|
+
"@aigne/core": "^1.34.0",
|
|
30
|
+
"@aigne/transport": "^0.10.0"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/bun": "^1.2.18",
|
|
34
|
+
"detect-port": "^2.1.0",
|
|
35
|
+
"hono": "^4.8.4",
|
|
36
|
+
"npm-run-all": "^4.1.5",
|
|
37
|
+
"rimraf": "^6.0.1",
|
|
38
|
+
"typescript": "^5.8.3",
|
|
39
|
+
"@aigne/openai": "^0.10.0",
|
|
40
|
+
"@aigne/test-utils": "^0.5.8"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"lint": "tsc --noEmit",
|
|
44
|
+
"build": "tsc --build scripts/tsconfig.build.json",
|
|
45
|
+
"clean": "rimraf lib test/coverage",
|
|
46
|
+
"test": "bun test",
|
|
47
|
+
"test:coverage": "bun test --coverage --coverage-reporter=lcov --coverage-reporter=text",
|
|
48
|
+
"postbuild": "node ../../scripts/post-build-lib.mjs"
|
|
49
|
+
}
|
|
50
|
+
}
|