@core-ai/omnifact 0.10.3
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/LICENSE +21 -0
- package/README.md +40 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +23 -0
- package/package.json +58 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Omnifact (https://omnifact.ai)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @core-ai/omnifact
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@core-ai/omnifact)
|
|
4
|
+
|
|
5
|
+
Omnifact provider package for `@core-ai/core-ai`. Connects to the Omnifact API Gateway, an OpenAI-compatible endpoint for chat completions.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @core-ai/core-ai @core-ai/omnifact zod
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { generate } from '@core-ai/core-ai';
|
|
17
|
+
import { createOmnifact } from '@core-ai/omnifact';
|
|
18
|
+
|
|
19
|
+
const omnifact = createOmnifact({
|
|
20
|
+
apiKey: process.env.OMNIFACT_API_KEY,
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// Use an id from GET /v1/gateway/models (eu/ prefix for EU-hosted models).
|
|
24
|
+
const model = omnifact.chatModel('eu/gpt-5-mini');
|
|
25
|
+
|
|
26
|
+
const result = await generate({
|
|
27
|
+
model,
|
|
28
|
+
messages: [{ role: 'user', content: 'Hello!' }],
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
console.log(result.content);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
By default, requests go to `https://connect.omnifact.ai/v1/gateway`. Set `baseURL` to use a custom gateway URL.
|
|
35
|
+
|
|
36
|
+
Use your Omnifact organization API key as the `apiKey`.
|
|
37
|
+
|
|
38
|
+
## Model IDs
|
|
39
|
+
|
|
40
|
+
Pass the exact `id` from `GET /v1/gateway/models`. EU-hosted models (Azure, Vertex, Mistral, etc.) use the `eu/` prefix, for example `eu/gpt-5-mini`. Direct non-EU providers use the plain type id, for example `gpt-5-mini`.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ChatModel } from '@core-ai/core-ai';
|
|
2
|
+
|
|
3
|
+
type OmnifactProviderOptions = {
|
|
4
|
+
apiKey?: string;
|
|
5
|
+
baseURL?: string;
|
|
6
|
+
};
|
|
7
|
+
type OmnifactProvider = {
|
|
8
|
+
chatModel(modelId: string): ChatModel;
|
|
9
|
+
};
|
|
10
|
+
declare function createOmnifact(options?: OmnifactProviderOptions): OmnifactProvider;
|
|
11
|
+
|
|
12
|
+
declare const DEFAULT_BASE_URL = "https://connect.omnifact.ai/v1/gateway";
|
|
13
|
+
|
|
14
|
+
export { DEFAULT_BASE_URL, type OmnifactProvider, type OmnifactProviderOptions, createOmnifact };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/provider.ts
|
|
2
|
+
import { createOpenAICompatChatProvider } from "@core-ai/openai/compat";
|
|
3
|
+
|
|
4
|
+
// src/constants.ts
|
|
5
|
+
var DEFAULT_BASE_URL = "https://connect.omnifact.ai/v1/gateway";
|
|
6
|
+
|
|
7
|
+
// src/provider.ts
|
|
8
|
+
function createOmnifact(options = {}) {
|
|
9
|
+
if (!options.apiKey) {
|
|
10
|
+
throw new Error("createOmnifact: apiKey is required.");
|
|
11
|
+
}
|
|
12
|
+
return createOpenAICompatChatProvider(
|
|
13
|
+
{
|
|
14
|
+
apiKey: options.apiKey,
|
|
15
|
+
baseURL: options.baseURL ?? DEFAULT_BASE_URL
|
|
16
|
+
},
|
|
17
|
+
"omnifact"
|
|
18
|
+
);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
DEFAULT_BASE_URL,
|
|
22
|
+
createOmnifact
|
|
23
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@core-ai/omnifact",
|
|
3
|
+
"version": "0.10.3",
|
|
4
|
+
"description": "Omnifact provider package for @core-ai/core-ai",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Omnifact (https://omnifact.ai)",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/agdevhq/core-ai.git",
|
|
10
|
+
"directory": "packages/omnifact"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"llm",
|
|
14
|
+
"ai",
|
|
15
|
+
"omnifact",
|
|
16
|
+
"provider",
|
|
17
|
+
"sdk"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"import": "./dist/index.js"
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist",
|
|
30
|
+
"README.md",
|
|
31
|
+
"LICENSE"
|
|
32
|
+
],
|
|
33
|
+
"publishConfig": {
|
|
34
|
+
"access": "public",
|
|
35
|
+
"provenance": true
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsup",
|
|
39
|
+
"lint": "eslint src/ --max-warnings 0",
|
|
40
|
+
"check-types": "tsc --noEmit",
|
|
41
|
+
"test": "vitest run",
|
|
42
|
+
"test:watch": "vitest"
|
|
43
|
+
},
|
|
44
|
+
"dependencies": {
|
|
45
|
+
"@core-ai/core-ai": "^0.10.3",
|
|
46
|
+
"@core-ai/openai": "^0.10.3"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"zod": "^4.0.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@core-ai/eslint-config": "*",
|
|
53
|
+
"@core-ai/testing": "*",
|
|
54
|
+
"@core-ai/typescript-config": "*",
|
|
55
|
+
"typescript": "^5.7.3",
|
|
56
|
+
"vitest": "^3.2.4"
|
|
57
|
+
}
|
|
58
|
+
}
|