Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.makeKnowledgeAIProgram = void 0; const commander_1 = require("commander"); const knowledgeAI_1 = require("../commands/knowledgeAI"); const makeKnowledgeAIProgram = () => { const knowledgeAI = new commander_1.Command(); knowledgeAI .name('knowledge-ai') .description('CLI to manage data ingestion and removal of the knowledge AI.'); knowledgeAI.addHelpText('after', ` Examples: Print more information about a specific command: $ cognigy knowledge-ai ingest --help Ingest a single ".txt" file: $ cognigy knowledge-ai ingest --projectId 643689fb81236ff450744d51 --language en-US --knowledgeStoreId 12389fb81236ff450744321 --input "~/path/to/my/file.txt" Ingest all ".txt" files within a directory: $ cognigy knowledge-ai ingest --projectId 643689fb81236ff450744d51 --language en-US --knowledgeStoreId 12389fb81236ff450744321 --input "~/path/to/my/directory" Extract data chunks from a pdf file into a .txt file $ cognigy knowledge-ai extract pdf -i "/path/to/your/file/tutorial.pdf" -o "/path/to/your/output/tutorial.txt"`); knowledgeAI .command('create <resourceType> <resourceName> [resourceDescription]') .description(`Creates knowledgeAI resources type [store, source] for a project with the specified name and description. Names must be unique.`) .option('-p, --projectId <string>', 'Project ID') .option('-k, --knowledgeStoreId <string>', 'Knowledge Store ID') .option('-l, --language <string>', 'Language') .option('-u, --url <string>', 'Url') .option('-t, --type <string>', 'Source type e.g. manual, website') .action(async (resourceType, resourceName, resourceDescription = 'Cognigy.AI CLI', options) => { try { await (0, knowledgeAI_1.createKnowledgeAIResourceCMD)({ resourceType, name: resourceName, description: resourceDescription, projectId: options.projectId, language: options.language, knowledgeStoreId: options.knowledgeStoreId, type: options.type, url: options.url, }); } catch (e) { console.log(e.message); } }) .on('--help', () => { console.log(` Examples: Create a knowledge store: $ cognigy knowledge-ai create store "General Information" "General information about my business" --projectId 643689fb81236ff450744d51 --language en-US Create a knowledgeAI source: $ cognigy knowledge-ai create source test-cli-source -k 64b66622b8641100718bcf06 -t manual`); }); knowledgeAI .command('delete <resourceType>') .description(`Deletes knowledgeAI resource type [store, source].`) .option('-s, --sourceId <string>', 'Source ID') .option('-k, --knowledgeStoreId <string>', 'Knowledge Store ID') .action(async (resourceType, options) => { try { await (0, knowledgeAI_1.deleteKnowledgeAIResourceCMD)({ resourceType, knowledgeStoreId: options.knowledgeStoreId, sourceId: options.sourceId, }); } catch (e) { console.log(e.message); } }) .on('--help', () => { console.log(` Examples: Delte a knowledge store: $ cognigy knowledge-ai delete store --knowledgeStoreId 643689fb81236ff450744d51" Delte a knowledge source: $ cognigy knowledge-ai delete source --knowledgeStoreId 643689fb81236ff450744d51 --sourceId 643689fb81236ff450744d52`); }); knowledgeAI .command('index <resourceType>') .description(`List all the knowledge stores for a project.`) .option('-p, --projectId <string>', 'Project ID') .option('-k, --knowledgeStoreId <string>', 'Knowledge Store ID') .action(async (resourceType, options) => { try { await (0, knowledgeAI_1.indexKnowledgeAIResourcesCMD)({ resourceType, knowledgeStoreId: options.knowledgeStoreId, projectId: options.projectId, }); } catch (e) { console.log(e.message); } }) .on('--help', () => { console.log(` Examples: Index a knowledge store: $ cognigy knowledge-ai index store --projectId 643689fb81236ff450744d51" Index a knowledge source: $ cognigy knowledge-ai index source --knowledgeStoreId 643689fb81236ff450744d51`); }); knowledgeAI .command('read <resourceType>') .description(`Get a knowledgeAI store/source.`) .option('-s, --sourceId <string>', 'Source ID') .option('-k, --knowledgeStoreId <string>', 'Knowledge Store ID') .action(async (resourceType, options) => { try { await (0, knowledgeAI_1.readKnowledgeAIResourceCMD)({ resourceType, knowledgeStoreId: options.knowledgeStoreId, sourceId: options.sourceId, }); } catch (e) { console.log(e.message); } }) .on('--help', () => { console.log(` Examples: Read a knowledge store: $ cognigy knowledge-ai read store --sourceId 643689fb81236ff450744d51" Read a knowledge source: $ cognigy knowledge-ai read source --knowledgeStoreId 643689fb81236ff450744d51`); }); knowledgeAI .command('ingest') .description(`Takes as "--input" a directory or ".txt" file. In case "--input" is a path to a directory, all ".txt" files found within will be ingested one after another. Subfolders will be ignored. For each file the paragraphs are expected to be separated by two newline characters. Each paragraph will be ingested into the referenced knowledge store of the specified project and language.`) .option('-n --name <string>', 'Name of the knowledge store for file retrieval') .option('-k, --knowledgeStoreId <string>', 'Knowledge Store ID') .requiredOption('-i, --input <path>', 'Path to file or directory') .action(async (options) => { try { await (0, knowledgeAI_1.ingestCMD)(options.knowledgeStoreId, options.input, options.name); } catch (e) { console.log(e.message); } }) .on('--help', () => { console.log(` Examples: Ingest a File: $ cognigy knowledge-ai ingest --knowledgeStoreId 643689fb81236ff450744d51 -i /home/Downloads/file.txt Ingest all files in a directory: $ cognigy knowledge-ai ingest --knowledgeStoreId 643689fb81236ff450744d51 -i /home/Downloads`); }); knowledgeAI .command('size') .description(`Checks the number of tokens in a file.`) .option('-i, --inputFile <string>', 'Input File Path') .action(async (options) => { try { await (0, knowledgeAI_1.handleSizeCMD)(options.inputFile); } catch (e) { console.log(e.message); } }); knowledgeAI .command('extract <type>') .description(`Converts "diffbot" output into text files parsing the output as paragraphs as expected as input for the "ingest" command.`) .option('-i, --inputFile <string>', 'Input File Path') .option('-o, --outputFile <string>', 'Output File Path') .option('-u --url <string>', 'Target URL (for web based extraction)') .option('-e, --excludeString <string>', 'Resulting paragraphs will be excluded if they contain this string') .option('-s, --splitter <string>', 'Name of the splitter to use, leave empty for default') .option('--cs, --chunkSize <number>', 'Chunksize to use, default 2000') .option('--co, --chunkOverlap <number>', 'Chunk overlap to use, default 200') .option('--ap, --additionalParameters <string>', 'Additional parameters to send to the extractor') .option('--fl, --forceLocal', 'Forces local processing of files') .option('-v, --verbose', 'Print detailed logs', false) .action(async (type, options) => { try { await (0, knowledgeAI_1.extractCMD)(type, options); } catch (e) { console.log(e.message); } }) .on('--help', () => { console.log(` Examples: Extract data chunks from a pdf file into a .txt file $ cognigy knowledge-ai extract pdf -i "/path/to/your/file/tutorial.pdf" -o "/path/to/your/output/tutorial.ctxt"`); }); return knowledgeAI; }; exports.makeKnowledgeAIProgram = makeKnowledgeAIProgram; |