const embedding = cfg.embedding as Record<string, unknown> | undefined; if (!embedding || typeof embedding.apiKey !== "string") { thrownew Error("embedding.apiKey is required");
}
assertAllowedKeys(embedding, ["apiKey", "model", "baseUrl", "dimensions"], "embedding config");
const model = resolveEmbeddingModel(embedding);
const captureMaxChars = typeof cfg.captureMaxChars === "number" ? Math.floor(cfg.captureMaxChars) : undefined; if ( typeof captureMaxChars === "number" &&
(captureMaxChars < 100 || captureMaxChars > 10_000)
) { thrownew Error("captureMaxChars must be between 100 and 10000");
}
const dreaming =
cfg.dreaming === undefined
? undefined
: cfg.dreaming && typeof cfg.dreaming === "object" && !Array.isArray(cfg.dreaming)
? (cfg.dreaming as Record<string, unknown>)
: (() => { thrownew Error("dreaming config must be an object");
})();
// Parse storageOptions (object with string values)
let storageOptions: Record<string, string> | undefined; const storageOpts = cfg.storageOptions as Record<string, unknown> | undefined; if (storageOpts !== undefined && storageOpts !== null) { if (!storageOpts || typeof storageOpts !== "object" || Array.isArray(storageOpts)) { thrownew Error("storageOptions must be an object");
}
storageOptions = {}; // Validate all values are strings for (const [key, value] of Object.entries(storageOpts)) { if (typeof value !== "string") { thrownew Error(`storageOptions.${key} must be a string`);
}
storageOptions[key] = resolveEnvVars(value);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.