diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 985a383..4b3195b 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 @@ -28,7 +28,7 @@ jobs: strategy: matrix: - node-version: [16.x, 18.x, 20.x] + node-version: [18.x, 20.x] steps: - uses: actions/checkout@v3 diff --git a/README.md b/README.md index 1edc3af..84ae45c 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,7 @@ This is not the [watsonx.ai](https://www.ibm.com/products/watsonx-ai) CLI. This is the CLI for the Tech Preview program for IBM Foundation Models Studio. You can start a trial version or request a demo via https://www.ibm.com/products/watsonx-ai. -This project provides convenient access to the Generative AI API from the command line. For a full description of the API, please visit the [Generative AI API Documentation](https://workbench.res.ibm.com/docs/api-reference). - -![demo](./assets/img/demo.gif) +This project provides convenient access to the Generative AI API from the command line. For a full description of the API, please visit the [Generative AI API Documentation](https://bam.res.ibm.com/docs/api-reference). _Are you looking for an SDK?
If so, check out the [NodeJS SDK](https://github.com/IBM/ibm-generative-ai-node-sdk) and [Python SDK](https://github.com/IBM/ibm-generative-ai)._ @@ -73,51 +71,18 @@ genai --profile joe config All the commands executed with `--profile joe` argument will use that configuration (and default as a fallback). -## Usage +## Commands ```bash -# Run single generate request: -genai generate "Once upon a time there lived a rabbit" -# " called Edward. He lived well because he had some things to eat. He had a wife called Daisy" - -# Run multiple generate requests from a file: -# "Best Christmas gift for dad: " -# "Best Christmas gift for mum: " -# "Best Christmas gift for dog: " -genai generate -f inputs.txt -# "a new wallet" -# "a day out" -# "a bone" - -# Run tokenize request: -genai tokenize "This is a future." -# {"token_count":5,"tokens":["This", "is", "a", "future", "."]} - -# Retrieve generate config -genai generate config -# model_id: google/flan-ul2, -# parameters: -# max_new_tokens: 1, -# decoding_method: greedy -# - -# Update generate config -genai generate config -m google/flan-ul2 --decoding-method greedy --max-new-tokens 5 --min-new-tokens 1 - -# Enter interactive mode -genai generate interactive - -# List models -genai models list -# google/flan-t5-xxl -# google/flan-ul2 -# ... - -# Show model details -genai models info google/flan-ul2 -# id: google/flan-ul2 -# name: flan-ul2 (20B) -# size: 20B -# description: >- -# flan-ul2 (20B) is an encoder decoder model ... +$ genai --help +genai + +Commands: + genai config Manage CLI configuration + genai text Text generation, tokenization and chat services + genai model Available models + genai file Upload, download and manage files + genai request Request history (for the past 30 days) + genai tune Train and manage tuned models + genai completion Generate completion script ``` diff --git a/assets/img/demo.gif b/assets/img/demo.gif deleted file mode 100644 index a2c5360..0000000 Binary files a/assets/img/demo.gif and /dev/null differ diff --git a/src/commands/text/generation/create.js b/src/commands/text/generation/create.js index 17f3255..1dbd48b 100644 --- a/src/commands/text/generation/create.js +++ b/src/commands/text/generation/create.js @@ -31,7 +31,9 @@ export const createCommandDefinition = [ async (args) => { const inlineInputs = args.inputs; const inputs = - inlineInputs ?? (await readJSONStream(stdin)).map(parseInput); + inlineInputs.length > 0 + ? inlineInputs + : (await readJSONStream(stdin)).map(parseInput); const { model, parameters, allowErrors } = args; const promises = inputs.map((input) => diff --git a/src/commands/text/tokenization/create.js b/src/commands/text/tokenization/create.js index 7f27c12..f1900a2 100644 --- a/src/commands/text/tokenization/create.js +++ b/src/commands/text/tokenization/create.js @@ -13,8 +13,7 @@ export const createCommandDefinition = [ .middleware(clientMiddleware) .positional("inputs", { describe: "Text serving as an input for the generation", - array: true, - conflicts: "input", + type: "array", }) .options( groupOptions( @@ -48,10 +47,12 @@ export const createCommandDefinition = [ async (args) => { const inlineInputs = args.inputs; const inputs = - inlineInputs ?? (await readJSONStream(stdin)).map(parseInput); + inlineInputs.length > 0 + ? inlineInputs + : (await readJSONStream(stdin)).map(parseInput); const { model, tokens, inputText } = args; - const { results } = await args.client.text.tokenization.create( + const output = await args.client.text.tokenization.create( { model_id: model, input: inputs, @@ -66,6 +67,6 @@ export const createCommandDefinition = [ signal: args.timeout, } ); - args.print(results); + args.print(output); }, ];