mirror of
https://github.com/Kaelio/ktx.git
synced 2026-06-28 08:49:38 +02:00
refactor: enforce ktx naming and AGENTS.md compliance sweep (#289)
Align the tree with AGENTS.md/CLAUDE.md conventions: - Rewrite user-facing strings, docs, and tests to lowercase `ktx` (no bare uppercase `KTX` tokens remain outside literal identifiers). - Drop the legacy `historicSql` migration path and its now-unused helpers, per the no-backward-compat rule. - Remove `as unknown as` / `any` casts: narrow `BaseTool` generics to `z.ZodObject`, add a typed `createLookerClient`, and delete the dead `getParametersSchema`/`toAnthropicFormat` pre-AI-SDK helpers. - Use `InvalidArgumentError` for Commander parse failures. - Finish the adapter→connector prose conversion in the `ktx.yaml` docs while keeping the literal `adapters` config key.
This commit is contained in:
parent
005c5fc860
commit
00cdf2de90
237 changed files with 844 additions and 974 deletions
|
|
@ -38,7 +38,7 @@ export async function runKtxEmbeddingHealthCheck(
|
|||
try {
|
||||
const provider = createKtxEmbeddingProvider(config, options.deps);
|
||||
const embedding = await withTimeout(
|
||||
provider.embed(options.text ?? 'KTX embedding health check'),
|
||||
provider.embed(options.text ?? 'ktx embedding health check'),
|
||||
options.timeoutMs ?? 15_000,
|
||||
);
|
||||
if (embedding.length !== config.dimensions) {
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ class OpenAIEmbeddingProvider implements KtxEmbeddingProvider {
|
|||
this.dimensions = config.dimensions;
|
||||
this.maxBatchSize = config.batchSize ?? DEFAULT_BATCH_SIZE;
|
||||
if (!config.openai?.apiKey) {
|
||||
throw new Error('openai.apiKey is required when KTX embedding backend is openai');
|
||||
throw new Error('openai.apiKey is required when ktx embedding backend is openai');
|
||||
}
|
||||
this.client = deps.createOpenAIClient
|
||||
? deps.createOpenAIClient({ apiKey: config.openai.apiKey, baseURL: config.openai.baseURL })
|
||||
|
|
@ -122,7 +122,7 @@ class SentenceTransformersEmbeddingProvider implements KtxEmbeddingProvider {
|
|||
|
||||
constructor(config: KtxEmbeddingConfig, deps: KtxEmbeddingProviderDeps) {
|
||||
if (!config.sentenceTransformers?.baseURL) {
|
||||
throw new Error('sentenceTransformers.baseURL is required when KTX embedding backend is sentence-transformers');
|
||||
throw new Error('sentenceTransformers.baseURL is required when ktx embedding backend is sentence-transformers');
|
||||
}
|
||||
this.dimensions = config.dimensions;
|
||||
this.maxBatchSize = config.batchSize ?? DEFAULT_BATCH_SIZE;
|
||||
|
|
@ -207,6 +207,6 @@ export function createKtxEmbeddingProvider(
|
|||
case 'sentence-transformers':
|
||||
return new SentenceTransformersEmbeddingProvider(config, deps);
|
||||
default:
|
||||
throw new Error(`Unsupported KTX embedding backend: ${String((config as { backend?: string }).backend)}`);
|
||||
throw new Error(`Unsupported ktx embedding backend: ${String((config as { backend?: string }).backend)}`);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ class DefaultKtxLlmProvider implements KtxLlmProvider {
|
|||
|
||||
if (config.backend === 'vertex') {
|
||||
if (!config.vertex?.location) {
|
||||
throw new Error('vertex.location is required when KTX LLM backend is vertex');
|
||||
throw new Error('vertex.location is required when ktx LLM backend is vertex');
|
||||
}
|
||||
const vertex = (deps.createVertexAnthropic ?? createVertexAnthropic)({
|
||||
...(config.vertex.project ? { project: config.vertex.project } : {}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue