-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tomas Pilar <tomas.pilar@ibm.com>
- Loading branch information
1 parent
2ac57af
commit 1b110e5
Showing
19 changed files
with
87 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { stdout } from "node:process"; | ||
import { pipeline } from "node:stream/promises"; | ||
import { Readable } from "node:stream"; | ||
|
||
export const readCommandDefinition = [ | ||
"read <id>", | ||
"Read file contents", | ||
(yargs) => | ||
yargs.positional("id", { | ||
type: "string", | ||
description: "Identifier of the file to read", | ||
}), | ||
async (args) => { | ||
const blob = await args.client.file.read( | ||
{ | ||
id: args.id, | ||
}, | ||
{ signal: args.timeout } | ||
); | ||
const readable = Readable.fromWeb(blob.stream()); | ||
await pipeline(readable, stdout); | ||
}, | ||
]; |
File renamed without changes.
This file was deleted.
Oops, something went wrong.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,11 @@ | ||
import { BaseError, InvalidInputError } from "@ibm-generative-ai/node-sdk"; | ||
import { | ||
BaseError, | ||
InvalidInputError as InvalidInputSDKError, | ||
} from "@ibm-generative-ai/node-sdk"; | ||
|
||
export class InvalidInputError extends Error {} | ||
|
||
export const isUsageError = (err) => | ||
!(err instanceof BaseError) || err instanceof InvalidInputError; | ||
!(err instanceof BaseError) || | ||
err instanceof InvalidInputSDKError || | ||
err instanceof InvalidInputError; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters