Skip to content

Commit

Permalink
fix(install): bump install script node version and update docs (#34)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Pilar <tomas.pilar@ibm.com>
  • Loading branch information
pilartomas authored Mar 15, 2024
1 parent ced7044 commit a74739f
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 21 deletions.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 }))")
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -32,7 +32,7 @@
},
"packageManager": "yarn@3.5.0",
"engines": {
"node": ">=18.12.0"
"node": ">=18.18.2"
},
"lint-staged": {
"*.js": [
Expand Down
24 changes: 6 additions & 18 deletions src/commands/text/chat/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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(
Expand Down

0 comments on commit a74739f

Please sign in to comment.