@modelence/ai 0.1.0-dev.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/README.md ADDED
@@ -0,0 +1,28 @@
1
+ # @modelence/ai
2
+
3
+ AI engine for Modelence applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @modelence/ai
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import { getOpenAIConfig } from '@modelence/ai';
15
+
16
+ const config = getOpenAIConfig();
17
+ // Returns: { apiKey: string }
18
+ ```
19
+
20
+ ## Functions
21
+
22
+ ### `getOpenAIConfig()`
23
+
24
+ Returns the OpenAI configuration from Modelence server config.
25
+
26
+ **Returns:** `{ apiKey: string }`
27
+
28
+ The API key is retrieved from the `_system.openai.apiKey` configuration key using Modelence's server-side config system.
@@ -0,0 +1,5 @@
1
+ declare function getOpenAIConfig(): {
2
+ apiKey: string;
3
+ };
4
+
5
+ export { getOpenAIConfig };
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ import {getConfig}from'modelence/server';function n(){return {apiKey:String(getConfig("_system.openai.apiKey"))}}export{n as getOpenAIConfig};//# sourceMappingURL=index.js.map
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts"],"names":["getOpenAIConfig","getConfig"],"mappings":"yCAEO,SAASA,GAAkB,CAChC,OAAO,CACL,MAAA,CAAQ,MAAOC,CAAAA,SAAAA,CAAU,uBAAuB,CAAC,CACnD,CACF","file":"index.js","sourcesContent":["import { getConfig } from 'modelence/server';\n\nexport function getOpenAIConfig() {\n return {\n apiKey: String(getConfig('_system.openai.apiKey'))\n };\n}\n"]}
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "type": "module",
3
+ "name": "@modelence/ai",
4
+ "version": "0.1.0-dev.1",
5
+ "description": "Modelence AI engine",
6
+ "exports": {
7
+ ".": {
8
+ "import": "./dist/index.js",
9
+ "types": "./dist/index.d.ts"
10
+ }
11
+ },
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "scripts": {
15
+ "build": "tsup",
16
+ "dev": "tsup --watch",
17
+ "prepublishOnly": "npm run build"
18
+ },
19
+ "author": "Modelence",
20
+ "license": "SEE LICENSE IN LICENSE",
21
+ "dependencies": {
22
+ "modelence": "^0.5.0"
23
+ },
24
+ "devDependencies": {
25
+ "tsup": "^8.3.6",
26
+ "typescript": "^5.7.2"
27
+ },
28
+ "publishConfig": {
29
+ "access": "public"
30
+ }
31
+ }
package/src/index.ts ADDED
@@ -0,0 +1,7 @@
1
+ import { getConfig } from 'modelence/server';
2
+
3
+ export function getOpenAIConfig() {
4
+ return {
5
+ apiKey: String(getConfig('_system.openai.apiKey'))
6
+ };
7
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2020",
4
+ "lib": ["ES2020", "DOM"],
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "allowSyntheticDefaultImports": true,
8
+ "esModuleInterop": true,
9
+ "allowJs": true,
10
+ "strict": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "skipLibCheck": true,
13
+ "declaration": true,
14
+ "outDir": "dist",
15
+ "jsx": "react-jsx"
16
+ },
17
+ "include": ["src/**/*"],
18
+ "exclude": ["node_modules", "dist"]
19
+ }
package/tsup.config.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { defineConfig } from 'tsup'
2
+
3
+ export default defineConfig((options) => ({
4
+ entry: ['src/index.ts'],
5
+ format: ['esm'],
6
+ dts: {
7
+ resolve: true,
8
+ entry: {
9
+ index: 'src/index.ts'
10
+ }
11
+ },
12
+ splitting: true,
13
+ clean: true,
14
+ outDir: 'dist',
15
+ sourcemap: true,
16
+ minify: !options.watch,
17
+ treeshake: !options.watch,
18
+ jsx: true,
19
+ esbuildOptions: (options) => {
20
+ options.resolveExtensions = ['.ts', '.js', '.tsx', '.jsx']
21
+ return options
22
+ },
23
+ external: [
24
+ 'modelence'
25
+ ]
26
+ }));