Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Support AI APIs using Box Node SDK #539

Merged
merged 9 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ Avatar URL: 'https://app.box.com/api/avatar/large/77777'
<!-- commands -->
# Command Topics

* [`box ai`](docs/ai.md) - Sends an AI request to supported LLMs and returns an answer
* [`box autocomplete`](docs/autocomplete.md) - Display autocomplete installation instructions
* [`box collaboration-allowlist`](docs/collaboration-allowlist.md) - List collaboration allowlist entries
* [`box collaborations`](docs/collaborations.md) - Manage collaborations
Expand Down
83 changes: 83 additions & 0 deletions docs/ai.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
`box ai`
========

Sends an AI request to supported LLMs and returns an answer

* [`box ai:ask`](#box-aiask)
* [`box ai:text-gen`](#box-aitext-gen)

## `box ai:ask`

Sends an AI request to supported LLMs and returns an answer

```
USAGE
$ box ai:ask

OPTIONS
-h, --help Show CLI help
-q, --quiet Suppress any non-error output to stderr
-s, --save Save report to default reports folder on disk
-t, --token=token Provide a token to perform this call
-v, --verbose Show verbose output, which can be helpful for debugging
-y, --yes Automatically respond yes to all confirmation prompts
--as-user=as-user Provide an ID for a user
--bulk-file-path=bulk-file-path File path to bulk .csv or .json objects
--csv Output formatted CSV
--fields=fields Comma separated list of fields to show
--items=items (required) The items for the AI request
--json Output formatted JSON

--mode=mode The mode of the AI request, should be 'single_item_qa' for one item or
'multi_item_qa' for multiple items

--no-color Turn off colors for logging

--prompt=prompt (required) The prompt for the AI request

--save-to-file-path=save-to-file-path Override default file path to save report

EXAMPLE
box ai:ask --mode single_item_qa --items=id=12345,type=file --prompt "What is the status of this document?"
```

_See code: [src/commands/ai/ask.js](https://github.com/box/boxcli/blob/v3.14.1/src/commands/ai/ask.js)_

## `box ai:text-gen`

Sends an AI request to supported LLMs and returns an answer specifically focused on the creation of new text.

```
USAGE
$ box ai:text-gen

OPTIONS
-h, --help Show CLI help
-q, --quiet Suppress any non-error output to stderr
-s, --save Save report to default reports folder on disk
-t, --token=token Provide a token to perform this call
-v, --verbose Show verbose output, which can be helpful for debugging
-y, --yes Automatically respond yes to all confirmation prompts
--as-user=as-user Provide an ID for a user
--bulk-file-path=bulk-file-path File path to bulk .csv or .json objects
--csv Output formatted CSV
--dialogue_history=dialogue_history The history of prompts and answers previously passed to the LLM.
congminh1254 marked this conversation as resolved.
Show resolved Hide resolved
--fields=fields Comma separated list of fields to show

--items=items (required) The items to be processed by the LLM, often files. The array can
include exactly one element.

--json Output formatted JSON

--no-color Turn off colors for logging

--prompt=prompt (required) The prompt for the AI request

--save-to-file-path=save-to-file-path Override default file path to save report

EXAMPLE
box ai:text-gen --dialogue_history=prompt="What is the status of this document?",answer="It is in review"
congminh1254 marked this conversation as resolved.
Show resolved Hide resolved
--items=id=12345,type=file --prompt="What is the status of this document?"
```

_See code: [src/commands/ai/text-gen.js](https://github.com/box/boxcli/blob/v3.14.1/src/commands/ai/text-gen.js)_
Loading
Loading