Skip to content

Commit 2a8a400

Browse files
authored
Merge pull request #121 from akifbayram/feat/ai-planner-default-on
feat: default AI_DETERMINISTIC_MATCH to true
2 parents 398df84 + 124b14d commit 2a8a400

4 files changed

Lines changed: 14 additions & 14 deletions

File tree

.env.example

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@
8383
# AI_HISTORY_MAX_TURNS=10 # Older turns dropped (1–100)
8484
# AI_HISTORY_MAX_TURN_CHARS=4096 # Per-turn char cap (100–100000)
8585
# AI_HISTORY_MAX_TOTAL_CHARS=32768 # Total cap across all turns (100–1000000)
86-
# Feature flag: when true, the inventory query path matches bins server-side
87-
# and the LLM only formats the answer + relevance strings. Default false until
88-
# validated.
89-
# AI_DETERMINISTIC_MATCH=false
86+
# Inventory query: when true (default), uses LLM planner + SQL executor.
87+
# When false, falls back to legacy LLM-as-matcher. Disable for providers
88+
# without structured-output support (some Ollama models).
89+
# AI_DETERMINISTIC_MATCH=true
9090

9191
# ── Backups ───────────────────────────────────
9292
# BACKUP_ENABLED=false

server/src/__tests__/aiStreamDeterministicFlag.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ beforeEach(() => { app = createApp(); });
99
afterEach(() => { delete process.env.AI_DETERMINISTIC_MATCH; });
1010

1111
describe('AI_DETERMINISTIC_MATCH flag', () => {
12-
it('legacy path is used when the flag is unset (no AI mock — just verifies the route still accepts the request)', async () => {
12+
it('planner path is used by default (no AI mock — just verifies the route still accepts the request)', async () => {
1313
const { token } = await createTestUser(app);
1414
const loc = await createTestLocation(app, token);
1515
await createTestBin(app, token, loc.id, { name: 'Battery Bin' });

server/src/lib/__tests__/configDeterministicMatch.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ describe('config.aiDeterministicMatch', () => {
1414
await initialize();
1515
});
1616

17-
it('defaults to false when env var unset', async () => {
17+
it('defaults to true when env var unset', async () => {
1818
delete process.env.AI_DETERMINISTIC_MATCH;
1919
const { config } = await import('../config.js');
20-
expect(config.aiDeterministicMatch).toBe(false);
20+
expect(config.aiDeterministicMatch).toBe(true);
2121
});
2222

23-
it('is true when AI_DETERMINISTIC_MATCH=true', async () => {
24-
process.env.AI_DETERMINISTIC_MATCH = 'true';
23+
it('is false when AI_DETERMINISTIC_MATCH=false', async () => {
24+
process.env.AI_DETERMINISTIC_MATCH = 'false';
2525
const { config } = await import('../config.js');
26-
expect(config.aiDeterministicMatch).toBe(true);
26+
expect(config.aiDeterministicMatch).toBe(false);
2727
delete process.env.AI_DETERMINISTIC_MATCH;
2828
});
2929
});

server/src/lib/config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,10 +250,10 @@ export const config = Object.freeze({
250250
aiHistoryMaxTurns: clamp(parseInt(process.env.AI_HISTORY_MAX_TURNS || '10', 10), 1, 100, 10),
251251
aiHistoryMaxTurnChars: clamp(parseInt(process.env.AI_HISTORY_MAX_TURN_CHARS || '4096', 10), 100, 100000, 4096),
252252
aiHistoryMaxTotalChars: clamp(parseInt(process.env.AI_HISTORY_MAX_TOTAL_CHARS || '32768', 10), 100, 1_000_000, 32768),
253-
// Feature flag: when true, the inventory query path uses deterministic
254-
// server-side bin matching and reduces the LLM to a formatter. Default off
255-
// — flip on per-environment to validate before retiring the legacy path.
256-
aiDeterministicMatch: parseBool(process.env.AI_DETERMINISTIC_MATCH, false),
253+
// Inventory query: when true (default), uses LLM planner + SQL executor.
254+
// When false, falls back to legacy LLM-as-matcher. Disable for providers
255+
// without structured-output support (some Ollama models).
256+
aiDeterministicMatch: parseBool(process.env.AI_DETERMINISTIC_MATCH, true),
257257

258258
// Backup
259259
backupEnabled: parseBool(process.env.BACKUP_ENABLED, false),

0 commit comments

Comments
 (0)