bluera-knowledge 0.11.9 → 0.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -249,19 +249,11 @@ export class SearchService {
249
249
 
250
250
  /**
251
251
  * Calculate confidence level based on max raw vector similarity score.
252
- * Configurable via environment variables.
252
+ * Configurable via environment variables, with sensible defaults for CLI usage.
253
253
  */
254
254
  private calculateConfidence(maxRawScore: number): SearchConfidence {
255
- const highEnv = process.env['SEARCH_CONFIDENCE_HIGH'];
256
- const mediumEnv = process.env['SEARCH_CONFIDENCE_MEDIUM'];
257
- if (highEnv === undefined) {
258
- throw new Error('SEARCH_CONFIDENCE_HIGH environment variable is required');
259
- }
260
- if (mediumEnv === undefined) {
261
- throw new Error('SEARCH_CONFIDENCE_MEDIUM environment variable is required');
262
- }
263
- const highThreshold = parseFloat(highEnv);
264
- const mediumThreshold = parseFloat(mediumEnv);
255
+ const highThreshold = parseFloat(process.env['SEARCH_CONFIDENCE_HIGH'] ?? '0.5');
256
+ const mediumThreshold = parseFloat(process.env['SEARCH_CONFIDENCE_MEDIUM'] ?? '0.3');
265
257
 
266
258
  if (maxRawScore >= highThreshold) return 'high';
267
259
  if (maxRawScore >= mediumThreshold) return 'medium';
@@ -759,14 +751,9 @@ export class SearchService {
759
751
  case 'source-internal':
760
752
  baseBoost = 0.75; // Internal implementation files (not too harsh)
761
753
  break;
762
- case 'test': {
763
- const testBoostEnv = process.env['SEARCH_TEST_FILE_BOOST'];
764
- if (testBoostEnv === undefined) {
765
- throw new Error('SEARCH_TEST_FILE_BOOST environment variable is required');
766
- }
767
- baseBoost = parseFloat(testBoostEnv);
754
+ case 'test':
755
+ baseBoost = parseFloat(process.env['SEARCH_TEST_FILE_BOOST'] ?? '0.5');
768
756
  break;
769
- }
770
757
  case 'config':
771
758
  baseBoost = 0.5; // Config files rarely answer questions
772
759
  break;