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

fix(install): bump install script node version and update docs #34

Merged
merged 1 commit into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
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
Loading