Lines Matching +full:- +full:- +full:verbose
20 $options->setHelp(
33 $options->registerOption('verbose', 'Enable verbose output', 'v');
35 // Action-specific options
36 $options->registerCommand('send', 'Send a file or directory to ChromaDB');
37 $options->registerArgument('path', 'File or directory path', true, 'send');
39 $options->registerCommand('query', 'Query ChromaDB');
40 …//$options->registerOption('collection', 'Collection name to query', 'c', 'collection', 'documents…
41 … //$options->registerOption('limit', 'Number of results to return', 'l', 'limit', '5', 'query');
42 $options->registerArgument('search', 'Search terms', true, 'query');
44 $options->registerCommand('heartbeat', 'Check if ChromaDB server is alive');
46 $options->registerCommand('identity', 'Get authentication and identity information');
48 $options->registerCommand('list', 'List all collections');
50 $options->registerCommand('get', 'Get a document by its ID');
51 …//$options->registerOption('collection', 'Collection name', 'c', 'collection', 'documents', 'get');
52 $options->registerArgument('id', 'Document ID', true, 'get');
65 $host = $this->getConf('chroma_host');
66 $port = (int)$this->getConf('chroma_port');
67 $tenant = $this->getConf('chroma_tenant');
68 $database = $this->getConf('chroma_database');
69 $ollamaHost = $this->getConf('ollama_host');
70 $ollamaPort = (int)$this->getConf('ollama_port');
71 $ollamaModel = $this->getConf('ollama_model');
72 $verbose = $options->getOpt('verbose');
74 $action = $options->getCmd();
78 $path = $options->getArgs()[0] ?? null;
80 $this->fatal('Missing file path for send action');
82 …$this->sendFile($path, $host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $…
86 $searchTerms = $options->getArgs()[0] ?? null;
88 $this->fatal('Missing search terms for query action');
90 $collection = $options->getOpt('collection', 'documents');
91 $limit = (int)$options->getOpt('limit', 5);
92 …$this->queryChroma($searchTerms, $limit, $host, $port, $tenant, $database, $collection, $ollamaHos…
96 …$this->checkHeartbeat($host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $v…
100 …$this->checkIdentity($host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $ve…
104 …$this->listCollections($host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $…
108 $documentId = $options->getArgs()[0] ?? null;
110 $this->fatal('Missing document ID for get action');
112 $collection = $options->getOpt('collection', null);
113 …$this->getDocument($documentId, $host, $port, $tenant, $database, $collection, $ollamaHost, $ollam…
117 echo $options->help();
125 …path, $host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $verbose = false) { argument
131 $this->processDirectory($path, $chroma, $host, $port, $tenant, $database, $verbose);
135 $this->error("File does not exist: $path");
142 if ($verbose) {
143 $this->info("Skipping file (starts with underscore): $path");
148 … $this->processSingleFile($path, $chroma, $host, $port, $tenant, $database, false, $verbose);
155 …ilePath, $chroma, $host, $port, $tenant, $database, $collectionChecked = false, $verbose = false) { argument
166 // $this->error("You are not allowed to read this file: $id");
172 $result = $chroma->processSingleFile($filePath, $collectionName, $collectionChecked);
174 // Handle the result with verbose output
175 if ($verbose && !empty($result['collection_status'])) {
176 $this->info($result['collection_status']);
181 if ($verbose) {
182 … $this->info("Adding " . $result['details']['chunks'] . " chunks to ChromaDB...");
184 $this->success("Successfully sent file to ChromaDB:");
185 $this->info(" Document ID: " . $result['details']['document_id']);
186 if ($verbose) {
187 $this->info(" Chunks: " . $result['details']['chunks']);
188 $this->info(" Host: $host:$port");
189 $this->info(" Tenant: $tenant");
190 $this->info(" Database: $database");
191 $this->info(" Collection: " . $result['details']['collection']);
196 if ($verbose) {
197 $this->info($result['message']);
202 $this->error($result['message']);
206 $this->error("Error sending file to ChromaDB: " . $e->getMessage());
214 …private function processDirectory($dirPath, $chroma, $host, $port, $tenant, $database, $verbose = … argument
215 if ($verbose) {
216 $this->info("Processing directory: $dirPath");
221 $this->error("Directory does not exist: $dirPath");
234 … if ($file->isFile() && $file->getExtension() === 'txt' && $file->getFilename()[0] !== '_') {
235 $files[] = $file->getPathname();
241 if ($verbose) {
242 $this->info("No .txt files found in directory: $dirPath");
247 if ($verbose) {
248 $this->info("Found " . count($files) . " files to process.");
258 $collectionStatus = $chroma->ensureCollectionExists($collectionName);
259 if ($verbose) {
260 $this->info($collectionStatus);
273 if ($verbose) {
274 $this->info("\nProcessing file: $file");
278 $result = $chroma->processSingleFile($file, $collectionName, $collectionChecked);
280 // Handle the result with verbose output
281 if ($verbose && !empty($result['collection_status'])) {
282 $this->info($result['collection_status']);
288 if ($verbose) {
289 … $this->info("Adding " . $result['details']['chunks'] . " chunks to ChromaDB...");
291 $this->success("Successfully sent file to ChromaDB:");
292 $this->info(" Document ID: " . $result['details']['document_id']);
293 if ($verbose) {
294 $this->info(" Chunks: " . $result['details']['chunks']);
295 $this->info(" Host: $host:$port");
296 $this->info(" Tenant: $tenant");
297 $this->info(" Database: $database");
298 $this->info(" Collection: " . $result['details']['collection']);
304 if ($verbose) {
305 $this->info($result['message']);
311 $this->error($result['message']);
316 $this->error("Error processing file $file: " . $e->getMessage());
320 if ($verbose) {
321 $this->info("\nFinished processing directory.");
322 $this->info("Processing summary:");
323 $this->info(" Processed: $processedCount files");
324 $this->info(" Skipped: $skippedCount files");
325 $this->info(" Errors: $errorCount files");
327 // Even in non-verbose mode, show summary stats if there were processed files
329 $this->info("Processing summary:");
331 $this->info(" Processed: $processedCount files");
334 $this->info(" Skipped: $skippedCount files");
337 $this->info(" Errors: $errorCount files");
346 …$port, $tenant, $database, $collection, $ollamaHost, $ollamaPort, $ollamaModel, $verbose = false) { argument
352 $results = $chroma->queryCollection($collection, [$searchTerms], $limit);
354 $this->info("Query results for: \"$searchTerms\"");
355 $this->info("Host: $host:$port");
356 $this->info("Tenant: $tenant");
357 $this->info("Database: $database");
358 $this->info("Collection: $collection");
359 $this->info("==========================================");
362 $this->info("No results found.");
367 $this->info("Result " . ($i + 1) . ":");
368 $this->info(" ID: " . $results['ids'][0][$i]);
369 $this->info(" Distance: " . $results['distances'][0][$i]);
370 $this->info(" Document: " . substr($results['documents'][0][$i], 0, 255) . "...");
373 $this->info(" Metadata: " . json_encode($results['metadatas'][0][$i]));
375 $this->info("");
378 $this->error("Error querying ChromaDB: " . $e->getMessage());
386 …tbeat($host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $verbose = false) { argument
391 if ($verbose) {
392 $this->info("Checking ChromaDB server status...");
393 $this->info("Host: $host:$port");
394 $this->info("Tenant: $tenant");
395 $this->info("Database: $database");
396 $this->info("==========================================");
399 $result = $chroma->heartbeat();
401 $this->success("Server is alive!");
402 $this->info("Response: " . json_encode($result));
404 $this->error("Error checking ChromaDB server status: " . $e->getMessage());
412 …ntity($host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $verbose = false) { argument
417 if ($verbose) {
418 $this->info("Checking ChromaDB identity...");
419 $this->info("Host: $host:$port");
420 $this->info("Tenant: $tenant");
421 $this->info("Database: $database");
422 $this->info("==========================================");
425 $result = $chroma->getIdentity();
427 $this->info("Identity information:");
428 $this->info("Response: " . json_encode($result, JSON_PRETTY_PRINT));
430 $this->error("Error checking ChromaDB identity: " . $e->getMessage());
438 …tions($host, $port, $tenant, $database, $ollamaHost, $ollamaPort, $ollamaModel, $verbose = false) { argument
443 if ($verbose) {
444 $this->info("Listing ChromaDB collections...");
445 $this->info("Host: $host:$port");
446 $this->info("Tenant: $tenant");
447 $this->info("Database: $database");
448 $this->info("==========================================");
451 $result = $chroma->listCollections();
454 $this->info("No collections found.");
458 $this->info("Collections:");
460 …$this->info(" - " . (isset($collection['name']) ? $collection['name'] : json_encode($collection))…
463 $this->error("Error listing ChromaDB collections: " . $e->getMessage());
471 …$port, $tenant, $database, $collection, $ollamaHost, $ollamaPort, $ollamaModel, $verbose = false) { argument
483 $results = $chroma->getDocument($collection, $documentId);
485 if ($verbose) {
486 $this->info("Document retrieval results for: \"$documentId\"");
487 $this->info("Host: $host:$port");
488 $this->info("Tenant: $tenant");
489 $this->info("Database: $database");
490 $this->info("Collection: $collection");
491 $this->info("==========================================");
495 $this->info("No document found with ID: $documentId");
500 $this->info("Document " . ($i + 1) . ":");
501 $this->info(" ID: " . $results['ids'][$i]);
504 $this->info(" Content: " . $results['documents'][$i]);
508 … $this->info(" Metadata: " . json_encode($results['metadatas'][$i], JSON_PRETTY_PRINT));
510 $this->info("");
513 $this->error("Error retrieving document from ChromaDB: " . $e->getMessage());