feat: make extract input structured
This commit is contained in:
@@ -2,14 +2,14 @@ import type {
|
||||
AddFactInput,
|
||||
EmbeddingProvider,
|
||||
TopicLinkInput,
|
||||
} from '../types/api';
|
||||
} from "../types/api";
|
||||
|
||||
export interface ExtractedFact {
|
||||
statement?: string;
|
||||
summary?: string | null;
|
||||
source?: string | null;
|
||||
confidence?: number | null;
|
||||
metadata?: AddFactInput['metadata'];
|
||||
metadata?: AddFactInput["metadata"];
|
||||
topics: TopicLinkInput[];
|
||||
}
|
||||
|
||||
@@ -17,14 +17,19 @@ export interface FactExtractor {
|
||||
extract(input: string): Promise<ExtractedFact>;
|
||||
}
|
||||
|
||||
export interface LlmTextGenerationModelInput {
|
||||
instruction: string;
|
||||
input: string;
|
||||
additionalInstruction?: string | undefined;
|
||||
}
|
||||
|
||||
export interface LlmTextGenerationModel {
|
||||
generateText(prompt: string): Promise<ExtractedFact>;
|
||||
generateText(prompt: LlmTextGenerationModelInput): Promise<ExtractedFact>;
|
||||
}
|
||||
|
||||
export interface LlmFactExtractorOptions {
|
||||
model: LlmTextGenerationModel;
|
||||
instructions?: string;
|
||||
promptBuilder?: (input: string, instructions?: string) => string;
|
||||
additionalInstructions?: string | undefined;
|
||||
}
|
||||
|
||||
export interface IngestStatementOptions {
|
||||
|
||||
Reference in New Issue
Block a user