fix: replace hardcoded Mac paths with relative paths in learning engine (routing-optimizer, prompt-optimizer, few-shot-curator)
This commit is contained in:
parent
c3248da6c0
commit
52697bc6fc
@ -9,16 +9,19 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
import { readFileSync, writeFileSync, readdirSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { fileURLToPath } from 'url';
|
||||||
|
import { join, resolve } from 'path';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { query, withTransaction } from '../db/client.js';
|
import { query, withTransaction } from '../db/client.js';
|
||||||
import { logger } from '../observability/logger.js';
|
import { logger } from '../observability/logger.js';
|
||||||
|
|
||||||
// ─── Constants ──────────────────────────────────────────────────────────────
|
// ─── Constants ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const _dir = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
const _defaultTemplatesDir = resolve(join(_dir, '..', '..', '..', 'gateway', 'prompts', 'templates'));
|
||||||
|
|
||||||
const TEMPLATES_DIR =
|
const TEMPLATES_DIR =
|
||||||
process.env['TEMPLATES_DIR'] ??
|
process.env['TEMPLATES_DIR'] ?? _defaultTemplatesDir;
|
||||||
'/Users/renefichtmueller/Desktop/Claude Code/llm-gateway/packages/gateway/prompts/templates';
|
|
||||||
|
|
||||||
const MIN_CONFIDENCE = 9.0;
|
const MIN_CONFIDENCE = 9.0;
|
||||||
const SIMILARITY_THRESHOLD = 0.7;
|
const SIMILARITY_THRESHOLD = 0.7;
|
||||||
|
|||||||
@ -13,7 +13,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFileSync, writeFileSync } from 'fs';
|
import { readFileSync, writeFileSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { fileURLToPath } from 'url';
|
||||||
|
import { join, resolve } from 'path';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { query, withTransaction } from '../db/client.js';
|
import { query, withTransaction } from '../db/client.js';
|
||||||
import { callGateway } from '../gateway-client.js';
|
import { callGateway } from '../gateway-client.js';
|
||||||
@ -22,9 +23,11 @@ import { bumpMinorVersion } from '../few-shot-curator/index.js';
|
|||||||
|
|
||||||
// ─── Constants ──────────────────────────────────────────────────────────────
|
// ─── Constants ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
const _dir = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
const _defaultTemplatesDir = resolve(join(_dir, '..', '..', '..', 'gateway', 'prompts', 'templates'));
|
||||||
|
|
||||||
const TEMPLATES_DIR =
|
const TEMPLATES_DIR =
|
||||||
process.env['TEMPLATES_DIR'] ??
|
process.env['TEMPLATES_DIR'] ?? _defaultTemplatesDir;
|
||||||
'/Users/renefichtmueller/Desktop/Claude Code/llm-gateway/packages/gateway/prompts/templates';
|
|
||||||
|
|
||||||
// Task types that MUST have human review before prompt updates go live
|
// Task types that MUST have human review before prompt updates go live
|
||||||
const SENSITIVE_TASK_TYPES = new Set([
|
const SENSITIVE_TASK_TYPES = new Set([
|
||||||
|
|||||||
@ -10,6 +10,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import { readFileSync, writeFileSync } from 'fs';
|
import { readFileSync, writeFileSync } from 'fs';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
import { join, resolve } from 'path';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { query, withTransaction } from '../db/client.js';
|
import { query, withTransaction } from '../db/client.js';
|
||||||
import { postInternal } from '../gateway-client.js';
|
import { postInternal } from '../gateway-client.js';
|
||||||
@ -17,9 +19,12 @@ import { logger } from '../observability/logger.js';
|
|||||||
|
|
||||||
// ─── Constants ──────────────────────────────────────────────────────────────
|
// ─── Constants ──────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
// Resolve path relative to this file: packages/learning/src/routing-optimizer/ → packages/gateway/src/config/
|
||||||
|
const _dir = fileURLToPath(new URL('.', import.meta.url));
|
||||||
|
const _defaultRoutingRulesPath = resolve(join(_dir, '..', '..', '..', 'gateway', 'src', 'config', 'routing-rules.yaml'));
|
||||||
|
|
||||||
const ROUTING_RULES_PATH =
|
const ROUTING_RULES_PATH =
|
||||||
process.env['ROUTING_RULES_PATH'] ??
|
process.env['ROUTING_RULES_PATH'] ?? _defaultRoutingRulesPath;
|
||||||
'/Users/renefichtmueller/Desktop/Claude Code/llm-gateway/packages/gateway/src/config/routing-rules.yaml';
|
|
||||||
|
|
||||||
const MIN_CONFIDENCE_DELTA = 1.0;
|
const MIN_CONFIDENCE_DELTA = 1.0;
|
||||||
const MIN_LATENCY_IMPROVEMENT_PCT = 30;
|
const MIN_LATENCY_IMPROVEMENT_PCT = 30;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user