@equinor/fusion-framework-cli-plugin-ai-index 2.0.1 β 2.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 +52 -0
- package/dist/esm/bin/apply-metadata.js +15 -5
- package/dist/esm/bin/apply-metadata.js.map +1 -1
- package/dist/esm/bin/apply-schema.js +64 -0
- package/dist/esm/bin/apply-schema.js.map +1 -0
- package/dist/esm/bin/apply-schema.test.js +143 -0
- package/dist/esm/bin/apply-schema.test.js.map +1 -0
- package/dist/esm/bin/delete-removed-files.js +1 -1
- package/dist/esm/bin/delete-removed-files.js.map +1 -1
- package/dist/esm/bin/embed.js +188 -47
- package/dist/esm/bin/embed.js.map +1 -1
- package/dist/esm/create-command.js +186 -0
- package/dist/esm/create-command.js.map +1 -0
- package/dist/esm/delete-command.js +14 -2
- package/dist/esm/delete-command.js.map +1 -1
- package/dist/esm/delete-command.options.js +7 -31
- package/dist/esm/delete-command.options.js.map +1 -1
- package/dist/esm/delete-index-command.js +94 -0
- package/dist/esm/delete-index-command.js.map +1 -0
- package/dist/esm/embed-command.js +30 -0
- package/dist/esm/embed-command.js.map +1 -0
- package/dist/esm/embeddings-command.js +14 -17
- package/dist/esm/embeddings-command.js.map +1 -1
- package/dist/esm/embeddings-command.options.js +12 -43
- package/dist/esm/embeddings-command.options.js.map +1 -1
- package/dist/esm/index.js +12 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/schema.js +41 -0
- package/dist/esm/schema.js.map +1 -0
- package/dist/esm/search-command.js +17 -5
- package/dist/esm/search-command.js.map +1 -1
- package/dist/esm/utils/embedding-dimensions.js +37 -0
- package/dist/esm/utils/embedding-dimensions.js.map +1 -0
- package/dist/esm/utils/zod-to-azure-fields.js +120 -0
- package/dist/esm/utils/zod-to-azure-fields.js.map +1 -0
- package/dist/esm/utils/zod-to-azure-fields.test.js +112 -0
- package/dist/esm/utils/zod-to-azure-fields.test.js.map +1 -0
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/bin/apply-metadata.d.ts +2 -1
- package/dist/types/bin/apply-schema.d.ts +22 -0
- package/dist/types/bin/apply-schema.test.d.ts +1 -0
- package/dist/types/config.d.ts +14 -0
- package/dist/types/create-command.d.ts +6 -0
- package/dist/types/delete-command.options.d.ts +9 -23
- package/dist/types/delete-index-command.d.ts +6 -0
- package/dist/types/embed-command.d.ts +12 -0
- package/dist/types/embeddings-command.options.d.ts +9 -28
- package/dist/types/index.d.ts +1 -0
- package/dist/types/schema.d.ts +137 -0
- package/dist/types/utils/embedding-dimensions.d.ts +13 -0
- package/dist/types/utils/zod-to-azure-fields.d.ts +61 -0
- package/dist/types/utils/zod-to-azure-fields.test.d.ts +1 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +6 -6
- package/src/bin/apply-metadata.ts +20 -4
- package/src/bin/apply-schema.test.ts +170 -0
- package/src/bin/apply-schema.ts +86 -0
- package/src/bin/delete-removed-files.ts +1 -1
- package/src/bin/embed.ts +248 -76
- package/src/config.ts +15 -0
- package/src/create-command.ts +218 -0
- package/src/delete-command.options.ts +7 -37
- package/src/delete-command.ts +19 -2
- package/src/delete-index-command.ts +121 -0
- package/src/embed-command.ts +44 -0
- package/src/embeddings-command.options.ts +12 -50
- package/src/embeddings-command.ts +18 -18
- package/src/index.ts +12 -3
- package/src/schema.ts +149 -0
- package/src/search-command.ts +22 -5
- package/src/utils/embedding-dimensions.ts +39 -0
- package/src/utils/zod-to-azure-fields.test.ts +136 -0
- package/src/utils/zod-to-azure-fields.ts +177 -0
- package/src/version.ts +1 -1
|
@@ -1,42 +1,18 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { AiOptionsSchema } from '@equinor/fusion-framework-cli-plugin-ai-base/command-options';
|
|
3
3
|
/**
|
|
4
|
-
* Zod schema for
|
|
4
|
+
* Zod schema for the `ai index remove` command.
|
|
5
5
|
*
|
|
6
|
-
* Extends the base AI options schema
|
|
7
|
-
* Azure Search credentials and the embedding deployment (needed to initialise
|
|
8
|
-
* the vector store service for document removal).
|
|
9
|
-
*
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* const validated = await DeleteOptionsSchema.parseAsync(rawOptions);
|
|
13
|
-
* // validated.dryRun, validated.filter, validated.azureSearchEndpoint, etc.
|
|
14
|
-
* ```
|
|
6
|
+
* Extends the base AI options schema making `indexName` required.
|
|
15
7
|
*/
|
|
16
8
|
export const DeleteOptionsSchema = AiOptionsSchema.extend({
|
|
17
|
-
|
|
18
|
-
.string({ message: '
|
|
19
|
-
.min(1, '
|
|
20
|
-
|
|
21
|
-
azureSearchEndpoint: z
|
|
22
|
-
.string({ message: 'Azure Search endpoint is required for deletion.' })
|
|
23
|
-
.url('Azure Search endpoint must be a valid URL.')
|
|
24
|
-
.min(1, 'Azure Search endpoint must be a non-empty string.')
|
|
25
|
-
.describe('Azure Search endpoint URL'),
|
|
26
|
-
azureSearchApiKey: z
|
|
27
|
-
.string({ message: 'Azure Search API key is required for deletion.' })
|
|
28
|
-
.min(1, 'Azure Search API key must be a non-empty string.')
|
|
29
|
-
.describe('Azure Search API key'),
|
|
30
|
-
azureSearchIndexName: z
|
|
31
|
-
.string({ message: 'Azure Search index name is required for deletion.' })
|
|
32
|
-
.min(1, 'Azure Search index name must be a non-empty string.')
|
|
33
|
-
.describe('Azure Search index name'),
|
|
34
|
-
dryRun: z
|
|
35
|
-
.boolean({ message: 'dryRun must be a boolean value.' })
|
|
36
|
-
.describe('Preview what would be deleted without making changes'),
|
|
9
|
+
indexName: z
|
|
10
|
+
.string({ message: 'Index name is required for deletion.' })
|
|
11
|
+
.min(1, 'Index name must be a non-empty string.'),
|
|
12
|
+
dryRun: z.boolean().describe('Preview what would be deleted without making changes'),
|
|
37
13
|
filter: z
|
|
38
14
|
.string()
|
|
39
|
-
.min(1
|
|
15
|
+
.min(1)
|
|
40
16
|
.optional()
|
|
41
17
|
.describe('Raw OData filter expression for selecting documents to delete'),
|
|
42
18
|
}).describe('Command options for the delete command');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete-command.options.js","sourceRoot":"","sources":["../../src/delete-command.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"delete-command.options.js","sourceRoot":"","sources":["../../src/delete-command.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAE/F;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,eAAe,CAAC,MAAM,CAAC;IACxD,SAAS,EAAE,CAAC;SACT,MAAM,CAAC,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC;SAC3D,GAAG,CAAC,CAAC,EAAE,wCAAwC,CAAC;IACnD,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,sDAAsD,CAAC;IACpF,MAAM,EAAE,CAAC;SACN,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,QAAQ,EAAE;SACV,QAAQ,CAAC,+DAA+D,CAAC;CAC7E,CAAC,CAAC,QAAQ,CAAC,wCAAwC,CAAC,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { createCommand, createOption } from 'commander';
|
|
2
|
+
import { loadFusionAIConfig, setupFramework } from '@equinor/fusion-framework-cli-plugin-ai-base';
|
|
3
|
+
import { withOptions as withAiOptions, } from '@equinor/fusion-framework-cli-plugin-ai-base/command-options';
|
|
4
|
+
/**
|
|
5
|
+
* CLI command: `ai index delete`
|
|
6
|
+
*
|
|
7
|
+
* Permanently deletes an Azure AI Search index and all its documents.
|
|
8
|
+
*
|
|
9
|
+
* This operation is irreversible β once deleted, the index definition and all
|
|
10
|
+
* indexed documents are permanently removed. Requires `Fusion.AI.Search.Manage`
|
|
11
|
+
* with a matching `index-name` scope, or the `Fusion.AI.Admin` role.
|
|
12
|
+
*
|
|
13
|
+
* Usage:
|
|
14
|
+
* $ ffc ai index delete [options]
|
|
15
|
+
*
|
|
16
|
+
* Options:
|
|
17
|
+
* --name <name> Index name to delete (overrides config)
|
|
18
|
+
* --config <config> Path to a config file (default: fusion-ai.config)
|
|
19
|
+
* --yes Skip the confirmation prompt
|
|
20
|
+
*
|
|
21
|
+
* Examples:
|
|
22
|
+
* $ ffc ai index delete
|
|
23
|
+
* $ ffc ai index delete --name my-index --yes
|
|
24
|
+
* $ ffc ai index delete --config fusion-ai.config.eds.ts
|
|
25
|
+
*/
|
|
26
|
+
const _command = createCommand('delete')
|
|
27
|
+
.description('Permanently delete an Azure AI Search index and all its documents')
|
|
28
|
+
.addOption(createOption('--name <name>', 'Index name to delete (overrides config)'))
|
|
29
|
+
.addOption(createOption('--config <config>', 'Path to a config file').default('fusion-ai.config'))
|
|
30
|
+
.addOption(createOption('--yes', 'Skip the confirmation prompt').default(false))
|
|
31
|
+
.hook('preAction', async (thisCommand) => {
|
|
32
|
+
const opts = thisCommand.opts();
|
|
33
|
+
const config = await loadFusionAIConfig(opts.config ?? 'fusion-ai.config', { baseDir: process.cwd() });
|
|
34
|
+
const indexConfig = config.index ?? {};
|
|
35
|
+
// --name flag takes priority, then fall back to config
|
|
36
|
+
if (!opts.name?.trim() && indexConfig.name) {
|
|
37
|
+
thisCommand.setOptionValue('name', indexConfig.name);
|
|
38
|
+
}
|
|
39
|
+
})
|
|
40
|
+
.action(async function (commandOptions) {
|
|
41
|
+
const indexName = commandOptions.name?.trim();
|
|
42
|
+
if (!indexName) {
|
|
43
|
+
console.error('β Index name is required. Set `name` in the index config or pass --name.');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
console.log(`\nποΈ Target index: ${indexName}`);
|
|
47
|
+
// Guard against accidental deletion β require explicit confirmation
|
|
48
|
+
if (!commandOptions.yes) {
|
|
49
|
+
const { createInterface } = await import('node:readline');
|
|
50
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
51
|
+
const answer = await new Promise((resolve) => {
|
|
52
|
+
rl.question(`\nβ οΈ This will permanently delete index "${indexName}" and ALL its documents.\n Type the index name to confirm: `, resolve);
|
|
53
|
+
});
|
|
54
|
+
rl.close();
|
|
55
|
+
if (answer.trim() !== indexName) {
|
|
56
|
+
console.log('β Confirmation did not match. Aborting.');
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const framework = await setupFramework(commandOptions);
|
|
61
|
+
const service = await framework.serviceDiscovery.resolveService('ai');
|
|
62
|
+
const baseUri = service.uri.replace(/\/+$/, '');
|
|
63
|
+
const scopes = service.scopes ?? service.defaultScopes ?? [];
|
|
64
|
+
const token = await framework.auth.acquireAccessToken({ request: { scopes } });
|
|
65
|
+
if (!token) {
|
|
66
|
+
console.error('β Failed to acquire access token for the AI service.');
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
69
|
+
const url = `${baseUri}/indexes/${encodeURIComponent(indexName)}?api-version=2024-07-01`;
|
|
70
|
+
const response = await fetch(url, {
|
|
71
|
+
method: 'DELETE',
|
|
72
|
+
headers: {
|
|
73
|
+
Authorization: `Bearer ${token}`,
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
// 204 No Content = successful deletion, 404 = index doesn't exist
|
|
77
|
+
if (response.status === 404) {
|
|
78
|
+
console.error(`β Index "${indexName}" not found.`);
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
if (!response.ok) {
|
|
82
|
+
const body = await response.text();
|
|
83
|
+
console.error(`β Index deletion failed (${response.status} ${response.statusText})`);
|
|
84
|
+
console.error(body);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
console.log(`β
Index "${indexName}" deleted successfully.`);
|
|
88
|
+
});
|
|
89
|
+
/**
|
|
90
|
+
* The `ai index delete` command with inherited AI base options for
|
|
91
|
+
* authentication and service discovery.
|
|
92
|
+
*/
|
|
93
|
+
export const deleteIndexCommand = withAiOptions(_command);
|
|
94
|
+
//# sourceMappingURL=delete-index-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"delete-index-command.js","sourceRoot":"","sources":["../../src/delete-index-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EACL,WAAW,IAAI,aAAa,GAE7B,MAAM,8DAA8D,CAAC;AAItE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;KACrC,WAAW,CAAC,mEAAmE,CAAC;KAChF,SAAS,CAAC,YAAY,CAAC,eAAe,EAAE,yCAAyC,CAAC,CAAC;KACnF,SAAS,CAAC,YAAY,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACjG,SAAS,CAAC,YAAY,CAAC,OAAO,EAAE,8BAA8B,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC/E,IAAI,CAAC,WAAW,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE;IACvC,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC;IAChC,MAAM,MAAM,GAAG,MAAM,kBAAkB,CACpC,IAAI,CAAC,MAAiB,IAAI,kBAAkB,EAC7C,EAAE,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,CAC3B,CAAC;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;IAEvC,uDAAuD;IACvD,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,WAAW,CAAC,IAAI,EAAE,CAAC;QAC3C,WAAW,CAA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,CAAC,CAAC;AAEL;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAY,aAAa,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createCommand } from 'commander';
|
|
2
|
+
import { setupFramework } from '@equinor/fusion-framework-cli-plugin-ai-base';
|
|
3
|
+
import { withOptions as withAiOptions, } from '@equinor/fusion-framework-cli-plugin-ai-base/command-options';
|
|
4
|
+
/**
|
|
5
|
+
* CLI command: `ai index embed <text>`
|
|
6
|
+
*
|
|
7
|
+
* Embeds a single text string and prints the resulting vector.
|
|
8
|
+
* Useful for verifying the embeddings endpoint and model are reachable.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```sh
|
|
12
|
+
* ffc ai index embed "hello world"
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export const embedCommand = withAiOptions(createCommand('embed')
|
|
16
|
+
.description('Embed a text string and print the resulting vector (for testing)')
|
|
17
|
+
.argument('<text>', 'Text to embed')
|
|
18
|
+
.action(async (text, options) => {
|
|
19
|
+
const framework = await setupFramework(options);
|
|
20
|
+
const embedder = framework.ai.useEmbed(options.embedModel);
|
|
21
|
+
console.log(`Embedding model: ${options.embedModel ?? 'default'}`);
|
|
22
|
+
console.log(`Input: ${JSON.stringify(text)}`);
|
|
23
|
+
const vector = await embedder.embedQuery(text);
|
|
24
|
+
console.log(`Dimensions: ${vector.length}`);
|
|
25
|
+
console.log(`Vector (first 8): [${vector
|
|
26
|
+
.slice(0, 8)
|
|
27
|
+
.map((v) => v.toFixed(6))
|
|
28
|
+
.join(', ')}, ...]`);
|
|
29
|
+
}), { includeEmbedding: true });
|
|
30
|
+
//# sourceMappingURL=embed-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embed-command.js","sourceRoot":"","sources":["../../src/embed-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC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
46
46
|
.addOption(createOption('--clean', 'Delete all existing documents from the vector store before processing').default(false))
|
|
47
47
|
.argument('[glob-patterns...]', 'Glob patterns to match files (optional when using --diff)')
|
|
48
|
+
.hook('preAction', async (thisCommand) => {
|
|
49
|
+
// Load config early so index name and embed model are available
|
|
50
|
+
// before the withOptions validation hook fires.
|
|
51
|
+
const opts = thisCommand.opts();
|
|
52
|
+
const config = await loadFusionAIConfig(opts.config ?? 'fusion-ai.config', { baseDir: process.cwd() });
|
|
53
|
+
const indexConfig = config.index ?? {};
|
|
54
|
+
if (indexConfig.name && !opts.indexName?.trim()) {
|
|
55
|
+
thisCommand.setOptionValue('indexName', indexConfig.name);
|
|
56
|
+
}
|
|
57
|
+
if (indexConfig.model && !opts.embedModel?.trim()) {
|
|
58
|
+
thisCommand.setOptionValue('embedModel', indexConfig.model);
|
|
59
|
+
}
|
|
60
|
+
})
|
|
48
61
|
.action(async function (patterns, commandOptions) {
|
|
49
|
-
//
|
|
62
|
+
// Config was already loaded in preAction; reload here for embed() usage.
|
|
50
63
|
const preOptions = commandOptions;
|
|
51
64
|
const config = await loadFusionAIConfig(preOptions.config ?? 'fusion-ai.config', { baseDir: process.cwd() });
|
|
52
65
|
const indexConfig = config.index ?? {};
|
|
53
|
-
// Config file values override env-var defaults but not explicit CLI flags.
|
|
54
|
-
// Commander merges env vars before the action runs, so we use
|
|
55
|
-
// getOptionValueSource to distinguish "user passed --flag" from "came from env".
|
|
56
|
-
const parentCommand = this.parent ?? this;
|
|
57
|
-
if (indexConfig.name) {
|
|
58
|
-
const source = parentCommand.getOptionValueSource('azureSearchIndexName');
|
|
59
|
-
if (source !== 'cli') {
|
|
60
|
-
preOptions.azureSearchIndexName = indexConfig.name;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
if (indexConfig.model) {
|
|
64
|
-
const source = parentCommand.getOptionValueSource('openaiEmbeddingDeployment');
|
|
65
|
-
if (source !== 'cli') {
|
|
66
|
-
preOptions.openaiEmbeddingDeployment = indexConfig.model;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
66
|
const options = await CommandOptionsSchema.parseAsync(preOptions);
|
|
70
67
|
// CLI args take precedence over config patterns
|
|
71
68
|
const allowedFilePatterns = indexConfig.patterns ?? ['**/*.ts', '**/*.md', '**/*.mdx'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings-command.js","sourceRoot":"","sources":["../../src/embeddings-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,MAAM,8DAA8D,CAAC;AAE5G,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAuB,MAAM,iCAAiC,CAAC;AAG5F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC;KAClC,WAAW,CAAC,+DAA+D,CAAC;KAC5E,SAAS,CACR,YAAY,CAAC,WAAW,EAAE,wDAAwD,CAAC,CAAC,OAAO,CACzF,KAAK,CACN,CACF;KACA,SAAS,CAAC,YAAY,CAAC,mBAAmB,EAAE,uBAAuB,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;KACjG,SAAS,CAAC,YAAY,CAAC,QAAQ,EAAE,4CAA4C,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;KAC9F,SAAS,CAAC,YAAY,CAAC,kBAAkB,EAAE,kCAAkC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;KACjG,SAAS,CACR,YAAY,CACV,SAAS,EACT,uEAAuE,CACxE,CAAC,OAAO,CAAC,KAAK,CAAC,CACjB;KACA,QAAQ,CAAC,oBAAoB,EAAE,2DAA2D,CAAC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AC;QACV,SAAS;QACT,OAAO;QACP,MAAM;QACN,YAAY;KACb,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEL;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,QAAQ,EAAE;IAC7C,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC;AAEH,eAAe,OAAO,CAAC"}
|
|
@@ -1,55 +1,24 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { AiOptionsSchema } from '@equinor/fusion-framework-cli-plugin-ai-base/command-options';
|
|
3
3
|
/**
|
|
4
|
-
* Zod schema for
|
|
4
|
+
* Zod schema for the `ai index add` command.
|
|
5
5
|
*
|
|
6
|
-
* Extends the base AI options schema
|
|
7
|
-
* add-specific options such as `--dry-run`, `--diff`, `--config`,
|
|
8
|
-
* `--base-ref`, and `--clean`.
|
|
9
|
-
*
|
|
10
|
-
* Azure Search and embedding options that are optional in the base schema
|
|
11
|
-
* become **required** because the add command always writes to a
|
|
12
|
-
* vector store.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* ```ts
|
|
16
|
-
* const validated = await CommandOptionsSchema.parseAsync(rawOptions);
|
|
17
|
-
* // validated.dryRun, validated.azureSearchEndpoint, etc.
|
|
18
|
-
* ```
|
|
6
|
+
* Extends the base AI options schema making `embedModel` and `indexName` required.
|
|
19
7
|
*/
|
|
20
8
|
export const CommandOptionsSchema = AiOptionsSchema.extend({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
.string({ message: 'Azure Search endpoint is required for embeddings command.' })
|
|
28
|
-
.url('Azure Search endpoint must be a valid URL.')
|
|
29
|
-
.min(1, 'Azure Search endpoint must be a non-empty string.')
|
|
30
|
-
.describe('Azure Search endpoint URL'),
|
|
31
|
-
azureSearchApiKey: z
|
|
32
|
-
.string({ message: 'Azure Search API key is required for embeddings command.' })
|
|
33
|
-
.min(1, 'Azure Search API key must be a non-empty string.')
|
|
34
|
-
.describe('Azure Search API key'),
|
|
35
|
-
azureSearchIndexName: z
|
|
36
|
-
.string({ message: 'Azure Search index name is required for embeddings command.' })
|
|
37
|
-
.min(1, 'Azure Search index name must be a non-empty string.')
|
|
38
|
-
.describe('Azure Search index name'),
|
|
9
|
+
embedModel: z
|
|
10
|
+
.string({ message: 'Embedding model name is required for the index add command.' })
|
|
11
|
+
.min(1, 'Embedding model name must be a non-empty string.'),
|
|
12
|
+
indexName: z
|
|
13
|
+
.string({ message: 'Index name is required for the index add command.' })
|
|
14
|
+
.min(1, 'Index name must be a non-empty string.'),
|
|
39
15
|
// Embeddings-specific options
|
|
40
|
-
dryRun: z
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
config: z
|
|
44
|
-
.string({ message: 'Config file path is required and must be a non-empty string.' })
|
|
45
|
-
.min(1, 'Config file path must be a non-empty string.')
|
|
46
|
-
.describe('Path to a config file'),
|
|
47
|
-
diff: z
|
|
48
|
-
.boolean({ message: 'diff must be a boolean value.' })
|
|
49
|
-
.describe('Process only changed files (workflow mode)'),
|
|
16
|
+
dryRun: z.boolean().describe('Show what would be processed without actually doing it'),
|
|
17
|
+
config: z.string().min(1).describe('Path to a config file'),
|
|
18
|
+
diff: z.boolean().describe('Process only changed files (workflow mode)'),
|
|
50
19
|
baseRef: z.string().min(1).optional().describe('Git reference to compare against'),
|
|
51
20
|
clean: z
|
|
52
|
-
.boolean(
|
|
21
|
+
.boolean()
|
|
53
22
|
.describe('Delete all existing documents from the vector store before processing'),
|
|
54
23
|
}).describe('Command options for the embeddings command');
|
|
55
24
|
//# sourceMappingURL=embeddings-command.options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embeddings-command.options.js","sourceRoot":"","sources":["../../src/embeddings-command.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"embeddings-command.options.js","sourceRoot":"","sources":["../../src/embeddings-command.options.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,8DAA8D,CAAC;AAE/F;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,eAAe,CAAC,MAAM,CAAC;IACzD,UAAU,EAAE,CAAC;SACV,MAAM,CAAC,EAAE,OAAO,EAAE,6DAA6D,EAAE,CAAC;SAClF,GAAG,CAAC,CAAC,EAAE,kDAAkD,CAAC;IAC7D,SAAS,EAAE,CAAC;SACT,MAAM,CAAC,EAAE,OAAO,EAAE,mDAAmD,EAAE,CAAC;SACxE,GAAG,CAAC,CAAC,EAAE,wCAAwC,CAAC;IAEnD,8BAA8B;IAC9B,MAAM,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;IACtF,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IAC3D,IAAI,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,CAAC,4CAA4C,CAAC;IACxE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,kCAAkC,CAAC;IAClF,KAAK,EAAE,CAAC;SACL,OAAO,EAAE;SACT,QAAQ,CAAC,uEAAuE,CAAC;CACrF,CAAC,CAAC,QAAQ,CAAC,4CAA4C,CAAC,CAAC"}
|
package/dist/esm/index.js
CHANGED
|
@@ -3,19 +3,28 @@ import { registerAiPlugin as registerAiPluginBase } from '@equinor/fusion-framew
|
|
|
3
3
|
import { command as addCommand } from './embeddings-command.js';
|
|
4
4
|
import { deleteCommand as removeCommand } from './delete-command.js';
|
|
5
5
|
import { searchCommand } from './search-command.js';
|
|
6
|
+
import { embedCommand } from './embed-command.js';
|
|
7
|
+
import { createIndexCommand } from './create-command.js';
|
|
8
|
+
import { deleteIndexCommand } from './delete-index-command.js';
|
|
9
|
+
export { defineIndexSchema } from './schema.js';
|
|
6
10
|
/**
|
|
7
11
|
* Parent command for the `ai index` group.
|
|
8
12
|
*
|
|
9
|
-
* Owns
|
|
13
|
+
* Owns subcommands:
|
|
10
14
|
* - `add` β index documents into the Azure AI Search vector store.
|
|
11
15
|
* - `remove` β remove documents from the vector store.
|
|
12
16
|
* - `search` β query the vector store for indexed documents.
|
|
17
|
+
* - `create` β create an index from the config schema definition.
|
|
18
|
+
* - `delete` β permanently delete an index and all its documents.
|
|
13
19
|
*/
|
|
14
20
|
const indexCommand = createCommand('index')
|
|
15
|
-
.description('Manage the AI search index (add, search, remove)')
|
|
21
|
+
.description('Manage the AI search index (add, search, remove, create, delete)')
|
|
16
22
|
.addCommand(addCommand)
|
|
17
23
|
.addCommand(removeCommand)
|
|
18
|
-
.addCommand(searchCommand)
|
|
24
|
+
.addCommand(searchCommand)
|
|
25
|
+
.addCommand(embedCommand)
|
|
26
|
+
.addCommand(createIndexCommand)
|
|
27
|
+
.addCommand(deleteIndexCommand);
|
|
19
28
|
/**
|
|
20
29
|
* Registers the `ai index` command with the Fusion Framework CLI.
|
|
21
30
|
*
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACxG,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,aAAa,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,iBAAiB,EAAqB,MAAM,aAAa,CAAC;AAEnE;;;;;;;;;GASG;AACH,MAAM,YAAY,GAAG,aAAa,CAAC,OAAO,CAAC;KACxC,WAAW,CAAC,kEAAkE,CAAC;KAC/E,UAAU,CAAC,UAAU,CAAC;KACtB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,aAAa,CAAC;KACzB,UAAU,CAAC,YAAY,CAAC;KACxB,UAAU,CAAC,kBAAkB,CAAC;KAC9B,UAAU,CAAC,kBAAkB,CAAC,CAAC;AAElC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAgB;IAC/C,oBAAoB,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;AAC9C,CAAC;AAED,eAAe,gBAAgB,CAAC;AAEhC,6CAA6C;AAC7C,OAAO,EACL,iBAAiB,GAElB,MAAM,8CAA8C,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type-safe factory for creating an {@link IndexSchemaConfig}.
|
|
3
|
+
*
|
|
4
|
+
* Infers `T` from the Zod shape and constrains both the
|
|
5
|
+
* `prepareAttributes` parameter types and the `resolve` return type,
|
|
6
|
+
* providing compile-time safety that attribute processing and resolution
|
|
7
|
+
* match the declared schema.
|
|
8
|
+
*
|
|
9
|
+
* @template T - Zod object schema type, inferred from `config.shape`.
|
|
10
|
+
* @param config - Schema configuration with a Zod shape, optional typed
|
|
11
|
+
* attribute processor, and a resolver function.
|
|
12
|
+
* @returns The same config object, narrowed to the inferred generic type.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { z } from 'zod';
|
|
17
|
+
* import { defineIndexSchema } from '@equinor/fusion-framework-cli-plugin-ai-index';
|
|
18
|
+
*
|
|
19
|
+
* const schema = defineIndexSchema({
|
|
20
|
+
* shape: z.object({
|
|
21
|
+
* tags: z.array(z.string()).default([]),
|
|
22
|
+
* type: z.string(),
|
|
23
|
+
* }),
|
|
24
|
+
* prepareAttributes: (attrs, doc) => {
|
|
25
|
+
* attrs.tags ??= []; // string[] | undefined β type-safe β
|
|
26
|
+
* if (doc.metadata.source.includes('cookbooks/')) {
|
|
27
|
+
* attrs.tags.push('cookbook');
|
|
28
|
+
* }
|
|
29
|
+
* return attrs;
|
|
30
|
+
* },
|
|
31
|
+
* resolve: (doc) => ({
|
|
32
|
+
* tags: (doc.metadata.attributes?.tags as string[]) ?? [],
|
|
33
|
+
* type: (doc.metadata.attributes?.type as string) ?? 'raw',
|
|
34
|
+
* }),
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
export function defineIndexSchema(config) {
|
|
39
|
+
return config;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AA2GA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAA4B;IAE5B,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createCommand, createOption } from 'commander';
|
|
2
2
|
import { inspect } from 'node:util';
|
|
3
|
-
import { setupFramework } from '@equinor/fusion-framework-cli-plugin-ai-base';
|
|
3
|
+
import { loadFusionAIConfig, setupFramework } from '@equinor/fusion-framework-cli-plugin-ai-base';
|
|
4
4
|
import { withOptions as withAiOptions, } from '@equinor/fusion-framework-cli-plugin-ai-base/command-options';
|
|
5
5
|
/**
|
|
6
6
|
* Flatten Azure Cognitive Search metadata attributes into a plain object.
|
|
@@ -75,6 +75,7 @@ const normalizeMetadata = (metadata) => {
|
|
|
75
75
|
*/
|
|
76
76
|
const _command = createCommand('search')
|
|
77
77
|
.description('Search the vector store to validate embeddings and retrieve relevant documents')
|
|
78
|
+
.addOption(createOption('--config <config>', 'Path to a config file').default('fusion-ai.config'))
|
|
78
79
|
.addOption(createOption('--limit <number>', 'Maximum number of results to return')
|
|
79
80
|
.default(10)
|
|
80
81
|
.argParser(parseInt))
|
|
@@ -86,17 +87,28 @@ const _command = createCommand('search')
|
|
|
86
87
|
.addOption(createOption('--raw', 'Output raw metadata without normalization').default(false))
|
|
87
88
|
.addOption(createOption('--verbose', 'Enable verbose output').default(false))
|
|
88
89
|
.argument('<query>', 'Search query string')
|
|
90
|
+
.hook('preAction', async (thisCommand) => {
|
|
91
|
+
const opts = thisCommand.opts();
|
|
92
|
+
const config = await loadFusionAIConfig(opts.config ?? 'fusion-ai.config', { baseDir: process.cwd() });
|
|
93
|
+
const indexConfig = config.index ?? {};
|
|
94
|
+
if (indexConfig.name && !opts.indexName?.trim()) {
|
|
95
|
+
thisCommand.setOptionValue('indexName', indexConfig.name);
|
|
96
|
+
}
|
|
97
|
+
if (indexConfig.model && !opts.embedModel?.trim()) {
|
|
98
|
+
thisCommand.setOptionValue('embedModel', indexConfig.model);
|
|
99
|
+
}
|
|
100
|
+
})
|
|
89
101
|
.action(async (query, options) => {
|
|
90
102
|
if (options.verbose) {
|
|
91
103
|
console.log('π Initializing framework...');
|
|
92
104
|
}
|
|
93
105
|
const framework = await setupFramework(options);
|
|
94
|
-
if (!options.
|
|
95
|
-
throw new Error('
|
|
106
|
+
if (!options.indexName) {
|
|
107
|
+
throw new Error('Index name is required');
|
|
96
108
|
}
|
|
97
109
|
if (options.verbose) {
|
|
98
110
|
console.log('β
Framework initialized successfully');
|
|
99
|
-
console.log(`π Index: ${options.
|
|
111
|
+
console.log(`π Index: ${options.indexName}`);
|
|
100
112
|
console.log(`π Searching for: "${query}"`);
|
|
101
113
|
console.log(`π Limit: ${options.limit}`);
|
|
102
114
|
console.log(`π Search type: ${options.searchType}`);
|
|
@@ -105,7 +117,7 @@ const _command = createCommand('search')
|
|
|
105
117
|
}
|
|
106
118
|
console.log('');
|
|
107
119
|
}
|
|
108
|
-
const vectorStoreService = framework.ai.
|
|
120
|
+
const vectorStoreService = framework.ai.useIndex(options.indexName);
|
|
109
121
|
try {
|
|
110
122
|
const filter = options.filter ? { filterExpression: options.filter } : undefined;
|
|
111
123
|
const retrieverOptions = options.searchType === 'mmr'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-command.js","sourceRoot":"","sources":["../../src/search-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;
|
|
1
|
+
{"version":3,"file":"search-command.js","sourceRoot":"","sources":["../../src/search-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8CAA8C,CAAC;AAClG,OAAO,E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;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,QAAQ,EAAE;IACnD,gBAAgB,EAAE,IAAI;IACtB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Known OpenAI embedding model names and their output vector dimensions.
|
|
3
|
+
*
|
|
4
|
+
* Used by the `ffc ai index create` command to set the `dimensions`
|
|
5
|
+
* property on the `content_vector` field in the Azure AI Search schema.
|
|
6
|
+
*
|
|
7
|
+
* @see https://platform.openai.com/docs/guides/embeddings
|
|
8
|
+
*/
|
|
9
|
+
const KNOWN_MODEL_DIMENSIONS = new Map([
|
|
10
|
+
['text-embedding-3-large', 3072],
|
|
11
|
+
['text-embedding-3-small', 1536],
|
|
12
|
+
['text-embedding-ada-002', 1536],
|
|
13
|
+
]);
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the embedding vector dimensions for a given model name.
|
|
16
|
+
*
|
|
17
|
+
* Checks the known modelβdimensions map first. Falls back to an explicit
|
|
18
|
+
* `dimensions` override from the config. Throws if neither is available.
|
|
19
|
+
*
|
|
20
|
+
* @param model - The embedding model name (e.g. `'text-embedding-3-large'`).
|
|
21
|
+
* @param configDimensions - Optional explicit dimensions from config, used
|
|
22
|
+
* when the model is not in the known map.
|
|
23
|
+
* @returns The number of dimensions for the embedding vector.
|
|
24
|
+
* @throws {Error} When the model is unknown and no explicit dimensions are configured.
|
|
25
|
+
*/
|
|
26
|
+
export function resolveEmbeddingDimensions(model, configDimensions) {
|
|
27
|
+
const known = KNOWN_MODEL_DIMENSIONS.get(model);
|
|
28
|
+
if (known !== undefined)
|
|
29
|
+
return known;
|
|
30
|
+
if (configDimensions !== undefined)
|
|
31
|
+
return configDimensions;
|
|
32
|
+
const knownModels = [...KNOWN_MODEL_DIMENSIONS.keys()].join(', ');
|
|
33
|
+
throw new Error(`Unknown embedding model "${model}". ` +
|
|
34
|
+
`Known models: ${knownModels}. ` +
|
|
35
|
+
'For custom models, set `index.embedding.dimensions` in the config.');
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=embedding-dimensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-dimensions.js","sourceRoot":"","sources":["../../../src/utils/embedding-dimensions.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,sBAAsB,GAAgC,IAAI,GAAG,CAAC;IAClE,CAAC,wBAAwB,EAAE,IAAI,CAAC;IAChC,CAAC,wBAAwB,EAAE,IAAI,CAAC;IAChC,CAAC,wBAAwB,EAAE,IAAI,CAAC;CACjC,CAAC,CAAC;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAa,EAAE,gBAAyB;IACjF,MAAM,KAAK,GAAG,sBAAsB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC;IAEtC,IAAI,gBAAgB,KAAK,SAAS;QAAE,OAAO,gBAAgB,CAAC;IAE5D,MAAM,WAAW,GAAG,CAAC,GAAG,sBAAsB,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,MAAM,IAAI,KAAK,CACb,4BAA4B,KAAK,KAAK;QACpC,iBAAiB,WAAW,IAAI;QAChC,oEAAoE,CACvE,CAAC;AACJ,CAAC"}
|