diff --git a/README.md b/README.md index 84ae45c..76d5584 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,19 @@ genai --profile joe config All the commands executed with `--profile joe` argument will use that configuration (and default as a fallback). +### Autocompletion + +The full commands have many segments due to alignment with the SDK and REST API. The CLI works best with autocompletion. Run the following to activate autocompletion, replace `.zshrc` with the configuration file of your shell: + +```bash +genai completion >> ~/.zshrc +source ~./zshrc +``` + +### Output format + +You can choose default output format during `genai config` or set it via `--output-format` flag. Choices are `yaml` and `json`. Former is ideal for direct viewing, latter for piping into [jq](https://jqlang.github.io/jq/). + ## Commands ```bash diff --git a/install.sh b/install.sh index 3db4073..827852f 100755 --- a/install.sh +++ b/install.sh @@ -61,7 +61,7 @@ then exit 1 fi else - MINIMAL="v16.10.0" + MINIMAL="v18.18.2" DETECTED=$(node -v) echo $DETECTED RESULT=$(node -e "console.log(\"$DETECTED\".replace('v', '').localeCompare(\"$MINIMAL\".replace('v', ''), undefined, { numeric: true }))") diff --git a/package.json b/package.json index 3f8654f..f6b8de0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@ibm-generative-ai/cli", - "version": "2.0.0", + "version": "2.0.1", "description": "CLI for IBM Generative AI (Tech Preview)", "keywords": [ "ai", @@ -32,7 +32,7 @@ }, "packageManager": "yarn@3.5.0", "engines": { - "node": ">=18.12.0" + "node": ">=18.18.2" }, "lint-staged": { "*.js": [ diff --git a/src/commands/text/chat/create.js b/src/commands/text/chat/create.js index c9df979..713f18b 100644 --- a/src/commands/text/chat/create.js +++ b/src/commands/text/chat/create.js @@ -8,22 +8,12 @@ export const createCommandDefinition = [ (yargs) => yargs .middleware(clientMiddleware) - .middleware(clientMiddleware) - .options(generationConfig) - .middleware(generationMiddleware) + .positional("message", { + type: "string", + describe: "Content of the message", + }) .options( groupOptions({ - model: { - alias: "m", - describe: "Select a model to be used for chat", - requiresArg: true, - type: "string", - coerce: (parameters) => { - if (typeof parameters !== "string") - throw new Error("Only a single model must be specified"); - return parameters; - }, - }, conversation: { alias: "c", type: "string", @@ -38,10 +28,8 @@ export const createCommandDefinition = [ }, }) ) - .positional("message", { - describe: "", - array: true, - }), + .options(generationConfig) + .middleware(generationMiddleware), async (args) => { const { model, message } = args; const output = await args.client.text.chat.create(