Files
IdentityDB/src/types/api.ts

105 lines
2.1 KiB
TypeScript

import type { JsonValue, TopicCategory, TopicGranularity } from './domain';
export interface UpsertTopicInput {
name: string;
category?: TopicCategory;
granularity?: TopicGranularity;
description?: string | null;
metadata?: JsonValue | null;
}
export interface TopicLinkInput extends UpsertTopicInput {
role?: string | null;
}
export interface AddFactInput {
statement: string;
summary?: string | null;
source?: string | null;
confidence?: number | null;
metadata?: JsonValue | null;
topics: TopicLinkInput[];
}
export interface LinkTopicsInput {
parentName: string;
childName: string;
}
export interface Topic {
id: string;
name: string;
normalizedName: string;
category: TopicCategory;
granularity: TopicGranularity;
description: string | null;
metadata: JsonValue | null;
createdAt: string;
updatedAt: string;
}
export interface FactTopic extends Topic {
role: string | null;
position: number;
}
export interface Fact {
id: string;
statement: string;
summary: string | null;
source: string | null;
confidence: number | null;
metadata: JsonValue | null;
createdAt: string;
updatedAt: string;
topics: FactTopic[];
}
export interface TopicWithFacts extends Topic {
facts: Fact[];
}
export interface ConnectedTopic extends Topic {
sharedFactCount: number;
}
export interface TopicLookupOptions {
includeFacts?: boolean;
}
export interface ListTopicsOptions {
includeFacts?: boolean;
limit?: number;
}
export interface EmbeddingProvider {
model: string;
dimensions: number;
embed(input: string): Promise<number[]>;
embedMany?(inputs: string[]): Promise<number[][]>;
}
export interface IndexFactEmbeddingsInput {
provider: EmbeddingProvider;
}
export interface SearchFactsInput {
query: string;
provider: EmbeddingProvider;
topicNames?: string[];
limit?: number;
minimumScore?: number;
}
export interface FindSimilarFactsInput {
statement: string;
provider: EmbeddingProvider;
topicNames?: string[];
limit?: number;
minimumScore?: number;
}
export interface ScoredFact extends Fact {
score: number;
}