Download src/knowledge/api-rag/index.ts from Bin29/ManimCat: direct link, hf CLI and curl.
- Browser
- Download file 1.34 kB
-
https://huggingface.co/spaces/Bin29/ManimCat/resolve/main/src/knowledge/api-rag/index.ts
- Command line
-
hf download hf://spaces/Bin29/ManimCat/src/knowledge/api-rag/index.ts
-
curl -L -o index.ts https://huggingface.co/spaces/Bin29/ManimCat/resolve/main/src/knowledge/api-rag/index.ts
1.34 kB
| import { ApiRagService } from './api-rag-service' | |
| import { createMiniLmEmbedding } from './mini-lm-embedding' | |
| import type { ApiCatalogPackage } from './types' | |
| export * from './types' | |
| export { ApiRagService, type ApiRagServiceOptions } from './api-rag-service' | |
| /** Packages the product may answer for, in the order they are probed. */ | |
| export const API_RAG_PACKAGES: readonly ApiCatalogPackage[] = ['manim', 'matplotlib'] | |
| export function createApiRagService( | |
| packages: readonly ApiCatalogPackage[] = API_RAG_PACKAGES | |
| ): ApiRagService { | |
| return new ApiRagService({ | |
| embedding: createMiniLmEmbedding(), | |
| packages | |
| }) | |
| } | |
| /** | |
| * Registration is decided at construction (one synchronous file read per package), and `ready()` | |
| * is the single asynchronous door that loads the Baselines and the SearchDoc matrix. The | |
| * composition root builds the Tool registry at import time, so construction cannot be async. | |
| */ | |
| let apiRagService: ApiRagService | undefined | |
| /** | |
| * The process-wide instance. Studio Builder and Workflow Code Repair share this one | |
| * Baseline index, SearchDoc matrix and MiniLM session; nothing constructs a second | |
| * service per request or per repair attempt. | |
| */ | |
| export function getApiRagService(): ApiRagService { | |
| if (!apiRagService) { | |
| apiRagService = createApiRagService() | |
| } | |
| return apiRagService | |
| } | |