Skip to content

Commit 5cf2710

Browse files
committed
Update markdown
1 parent a45cc7b commit 5cf2710

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

docs/ai.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
Sends an AI request to supported LLMs and returns an answer
55

6-
* [`box ai:ask`](#box-aiask)
7-
* [`box ai:extract`](#box-aiextract)
8-
* [`box ai:extract-structured`](#box-aiextract-structured)
9-
* [`box ai:text-gen`](#box-aitext-gen)
6+
- [`box ai`](#box-ai)
7+
- [`box ai:ask`](#box-aiask)
8+
- [`box ai:extract`](#box-aiextract)
9+
- [`box ai:extract-structured`](#box-aiextract-structured)
10+
- [`box ai:text-gen`](#box-aitext-gen)
1011

1112
## `box ai:ask`
1213

@@ -111,8 +112,7 @@ FLAGS
111112
--fields=<value>... The fields to be extracted from the provided items.
112113
--items=<value>... (required) The items that LLM will process.
113114
--json Output formatted JSON
114-
--metadata-template=<value> The metadata template containing the fields to extract. Example: {"type":
115-
"metadata_template", "scope": "enterprise", "template_key": "test"}
115+
--metadata-template=<value> The metadata template containing the fields to extract.
116116
--no-color Turn off colors for logging
117117
--save-to-file-path=<value> Override default file path to save report
118118

src/commands/ai/extract-structured.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,7 @@ AiExtractStructuredCommand.flags = {
7676
},
7777
}),
7878
'metadata-template': Flags.string({
79-
description:
80-
'The metadata template containing the fields to extract. Example: {"type": "metadata_template", "scope": "enterprise", "template_key": "test"}',
79+
description: 'The metadata template containing the fields to extract.',
8180
parse(input) {
8281
const metadataTemplate = {
8382
type: 'metadata_template',
@@ -108,7 +107,6 @@ AiExtractStructuredCommand.flags = {
108107
description: 'The fields to be extracted from the provided items.',
109108
parse(input) {
110109
const fields = {};
111-
112110
const obj = utils.parseStringToObject(input, [
113111
'key',
114112
'type',
@@ -133,7 +131,7 @@ AiExtractStructuredCommand.flags = {
133131
const parsedOptions = obj[key]
134132
.split(';')
135133
.filter((item) => item)
136-
.map((item) => ({ key: item }));
134+
.map((item) => ({ key: item.trim() }));
137135
if (parsedOptions.length === 0) {
138136
throw new Error('Options field must contain at least one value');
139137
}

test/commands/ai.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ describe('AI', () => {
230230
description: 'Person first name',
231231
prompt: 'What is the first name?',
232232
displayName: 'First name',
233-
options: [{key:'First Name'}],
233+
options: [{ key: 'First Name' }, { key: 'Last Name' }],
234234
},
235235
],
236236
};
@@ -267,7 +267,7 @@ describe('AI', () => {
267267
.command([
268268
'ai:extract-structured',
269269
'--items=content=one,two,three,id=12345,type=file',
270-
'--fields=key=firstName,type=string,description=Person first name,prompt=What is the first name?,displayName=First name,options=First Name',
270+
'--fields=key=firstName,type=string,description=Person first name,prompt=What is the first name?,displayName=First name,options=First Name; Last Name',
271271
'--json',
272272
'--token=test',
273273
])
@@ -289,7 +289,7 @@ describe('AI', () => {
289289
.command([
290290
'ai:extract-structured',
291291
'--items=content=one,two,three,id=12345,type=file',
292-
'--fields=key=firstName,type=string,description=Person first name,prompt=What is the first name?,displayName=First name,options=First Name',
292+
'--fields=key=firstName,type=string,description=Person first name,prompt=What is the first name?,displayName=First name,options=First Name;Last Name',
293293
'--token=test',
294294
])
295295

@@ -317,7 +317,7 @@ describe('AI', () => {
317317
description: 'Person first name',
318318
prompt: 'What is the first name?',
319319
displayName: 'First name',
320-
options: [{key:'First Name'}],
320+
options: [{ key: 'First Name' }],
321321
},
322322
],
323323
ai_agent: {

0 commit comments

Comments
 (0)