llm/types.ts

chiasmus · src/llm/types.ts · typescript · Apache-2.0
ai

* A message in the LLM conversation */

// Source: https://github.com/yogthos/chiasmus | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/** A message in the LLM conversation */
export interface LLMMessage {
  role: "user" | "assistant";
  content: string;
}

/** Interface for LLM backends */
export interface LLMAdapter {
  /** Generate a completion from a system prompt and messages */
  complete(system: string, messages: LLMMessage[]): Promise<string>;
}

/**
 * Interface for embedding backends. Converts text to fixed-size dense
 * vectors suitable for cosine-similarity search. Batching is required
 * because single-vector calls have outsized per-request overhead.
 */
export interface EmbeddingAdapter {
  /** Produce den

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

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

Get a free API key