MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / compileQuestion

Function compileQuestion

graph-ui/src/chat/ask-atlas.ts:181–205  ·  view source on GitHub ↗
(input: AskInput)

Source from the content-addressed store, hash-verified

179 * let a slow index turn into a difference between two models' scores.
180 */
181export async function compileQuestion(input: AskInput): Promise<CompiledQuestion> {
182 const depth = input.depth ?? NEIGHBOR_DEPTH_DEFAULT;
183 const packet = await compileFacts(input.source, input.root, input.question, {
184 depth,
185 ...(input.context === undefined ? {} : { context: input.context }),
186 ...(input.focus === undefined ? {} : { focus: input.focus }),
187 ...(input.chosenSubject === undefined ? {} : { chosenSubject: input.chosenSubject }),
188 ...(input.observed === undefined ? {} : { observed: input.observed }),
189 ...(input.opts ?? {}),
190 });
191 const cards = compileCards(packet, { budget: cardBudgetOf(input.modelClass) });
192 if (cards.cards.length === 0) {
193 return { packet, cards };
194 }
195 return {
196 packet,
197 cards,
198 plan: buildPrompt({
199 question: input.question,
200 klass: packet.klass,
201 cards,
202 modelName: input.modelName,
203 }),
204 };
205}
206
207/** Tokens per second, or nothing when the sidecar did not report enough to say. */
208export function tokensPerSecond(completionTokens: number | undefined, durationMs: number): number | undefined {

Callers 2

ask-atlas.test.tsFile · 0.90
askAtlasFunction · 0.85

Calls 4

compileFactsFunction · 0.90
compileCardsFunction · 0.90
cardBudgetOfFunction · 0.90
buildPromptFunction · 0.90

Tested by

no test coverage detected