Skip to content

Build your personal knowledge base with Trilium Notes

clean up hardcoded values part 4

perf3ct67a45333b327
diff --git a/src/services/llm/context/services/query_processor.ts b/src/services/llm/context/services/query_processor.ts
index 850113e138..86478e5ed3 100644
--- a/src/services/llm/context/services/query_processor.ts
+++ b/src/services/llm/context/services/query_processor.ts
@@ -15,6 +15,7 @@ import { CONTEXT_PROMPTS } from '../../constants/llm_prompt_constants.js';
import { QUERY_DECOMPOSITION_STRINGS } from '../../constants/query_decomposition_constants.js';
import JsonExtractor from '../../utils/json_extractor.js';
import type { LLMServiceInterface } from '../../interfaces/agent_tool_interfaces.js';
+import { SEARCH_CONSTANTS } from '../../constants/search_constants.js';
// Interfaces
export interface SubQuery {
@@ -72,8 +73,8 @@ Format your answer as a valid JSON array without markdown code blocks, like this
];
const options = {
- temperature: 0.3,
- maxTokens: 300,
+ temperature: SEARCH_CONSTANTS.TEMPERATURE.QUERY_PROCESSOR,
+ maxTokens: SEARCH_CONSTANTS.LIMITS.QUERY_PROCESSOR_MAX_TOKENS,
bypassFormatter: true,
expectsJsonResponse: true,
_bypassContextProcessing: true // Prevent recursive calls
diff --git a/src/services/llm/context_extractors/note_navigator_tool.ts b/src/services/llm/context_extractors/note_navigator_tool.ts
index 115447431f..785d515663 100644
--- a/src/services/llm/context_extractors/note_navigator_tool.ts
+++ b/src/services/llm/context_extractors/note_navigator_tool.ts
@@ -15,6 +15,8 @@ import becca from '../../../becca/becca.js';
import log from '../../log.js';
import type BNote from '../../../becca/entities/bnote.js';
import type BAttribute from '../../../becca/entities/battribute.js';
+import sql from "../../sql.js";
+import { SEARCH_CONSTANTS } from "../constants/search_constants.js";
export interface NoteInfo {
noteId: string;
@@ -51,9 +53,9 @@ interface NoteStructure {
}
export class NoteNavigatorTool {
- private maxPathLength: number = 20;
- private maxBreadth: number = 100;
- private maxDepth: number = 5;
+ private maxPathLength: number = SEARCH_CONSTANTS.HIERARCHY.MAX_PATH_LENGTH;
+ private maxBreadth: number = SEARCH_CONSTANTS.HIERARCHY.MAX_BREADTH;
+ private maxDepth: number = SEARCH_CONSTANTS.HIERARCHY.MAX_DEPTH;
/**
* Get detailed information about a note
diff --git a/src/services/llm/tools/relationship_tool.ts b/src/services/llm/tools/relationship_tool.ts
index 2652c464bb..7f8709dfae 100644
--- a/src/services/llm/tools/relationship_tool.ts
+++ b/src/services/llm/tools/relationship_tool.ts
@@ -9,6 +9,7 @@ import log from '../../log.js';
import becca from '../../../becca/becca.js';
import attributes from '../../attributes.js';
import aiServiceManager from '../ai_service_manager.js';
+import { SEARCH_CONSTANTS } from '../constants/search_constants.js';
/**
* Definition of the relationship tool
@@ -347,8 +348,8 @@ Suggest the most appropriate relationship type that would connect the source not
},
{ role: 'user', content: prompt }
], {
- temperature: 0.4,
- maxTokens: 50
+ temperature: SEARCH_CONSTANTS.TEMPERATURE.RELATIONSHIP_TOOL,
+ maxTokens: SEARCH_CONSTANTS.LIMITS.RELATIONSHIP_TOOL_MAX_TOKENS
});
// Extract just the relation name (remove any formatting or explanation)