Spaces:
Sleeping
Sleeping
Download rag/src/types.ts from NeonatalDAO/askneo: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/spaces/NeonatalDAO/askneo/resolve/main/rag/src/types.ts
- Command line
-
hf download hf://spaces/NeonatalDAO/askneo/rag/src/types.ts
-
curl -L -o types.ts https://huggingface.co/spaces/NeonatalDAO/askneo/resolve/main/rag/src/types.ts
1.79 kB
| /** A normalized document drawn from any dataset-collection source. */ | |
| export interface SourceDoc { | |
| /** Stable id: `<source>:<hash or native id>` */ | |
| id: string; | |
| /** Free text content (question+answer flattened for QA records). */ | |
| text: string; | |
| /** Short title when the source has one. */ | |
| title?: string; | |
| /** Dataset family: corpus | qa_pairs | medical_qa | europe_pmc | deduped | training_merged */ | |
| source: string; | |
| /** Topic label when available (e.g. neonatal_jaundice). */ | |
| topic?: string; | |
| } | |
| /** A chunk of a SourceDoc — the retrieval unit. */ | |
| export interface Chunk { | |
| /** `<docId>#<n>` */ | |
| id: string; | |
| docId: string; | |
| text: string; | |
| title?: string; | |
| source: string; | |
| topic?: string; | |
| } | |
| export interface ScoredChunk extends Chunk { | |
| score: number; | |
| /** Which retriever(s) surfaced it. */ | |
| via: string[]; | |
| } | |
| export interface ChatMessage { | |
| role: "system" | "user" | "assistant"; | |
| content: string; | |
| } | |
| export type ProviderName = "openrouter" | "openai" | "anthropic"; | |
| export interface ChatOptions { | |
| /** Use the cheap/fast model tier (rewriting, reranking, judging). */ | |
| fast?: boolean; | |
| maxTokens?: number; | |
| /** Ask the provider for a JSON object response when supported. */ | |
| json?: boolean; | |
| /** Called with text deltas when streaming to a terminal. */ | |
| onDelta?: (text: string) => void; | |
| } | |
| export interface ChatResult { | |
| text: string; | |
| provider: ProviderName; | |
| model: string; | |
| } | |
| export interface RagAnswer { | |
| answer: string; | |
| provider: ProviderName; | |
| model: string; | |
| /** Queries actually used for retrieval (original + rewrites). */ | |
| queries: string[]; | |
| sources: ScoredChunk[]; | |
| } | |
| export interface IndexManifest { | |
| embeddingModel: string; | |
| dims: number; | |
| count: number; | |
| createdAt: string; | |
| sources: Record<string, number>; | |
| } | |