findAnsweringModelKey (routing/contextWindowLimits.ts)

openchamber · packages/ui/src/lib/routing/contextWindowLimits.ts · typescript · MIT
ai, tag:knn-classified

Functions to find model keys and context limits for chat sessions.

// Source: https://github.com/openchamber/openchamber | License: MIT | Copyright 2025 Bohdan Triapitsyn
// Provided via justclaw.it.com; keep this notice with the code.
export type ContextWindowLimits = {
  /** 0 when unknown; the readouts then fall back to their own default. */
  context: number;
  output: number;
};

const NO_CONTEXT_WINDOW_LIMITS: ContextWindowLimits = { context: 0, output: 0 };

type AnsweringMessage = { role?: string; providerID?: string; modelID?: string };

/**
 * `provider/model` of the newest assistant message, or null before the first
 * answer. Reduced to a string so a store selector can return it and only
 * notify when the answering model changes, not on every streamed part.
 */
export const findAnsweringModelKey = (messages: readonly AnsweringMessage[]): stri

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key