mongodb-rag-core
Version:
Common elements used by MongoDB Chatbot Framework components.
194 lines • 6.31 kB
TypeScript
import { z } from "zod";
import { DatabaseConnection } from "../DatabaseConnection";
import { MakeMongoDbDatabaseConnectionParams } from "../MongoDbDatabaseConnection";
import { Document } from "mongodb";
export declare const SearchRecordDataSourceSchema: z.ZodObject<{
name: z.ZodString;
type: z.ZodOptional<z.ZodString>;
versionLabel: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
name: string;
type?: string | undefined;
versionLabel?: string | undefined;
}, {
name: string;
type?: string | undefined;
versionLabel?: string | undefined;
}>;
export type SearchRecordDataSource = z.infer<typeof SearchRecordDataSourceSchema>;
export interface ResultChunk {
url: string;
title: string;
text: string;
metadata: {
sourceName: string;
sourceType?: string;
tags?: string[];
[key: string]: unknown;
};
}
export declare const ResultChunkSchema: z.ZodObject<{
url: z.ZodString;
title: z.ZodString;
text: z.ZodString;
metadata: z.ZodObject<{
sourceName: z.ZodString;
sourceType: z.ZodOptional<z.ZodString>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
sourceName: z.ZodString;
sourceType: z.ZodOptional<z.ZodString>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
sourceName: z.ZodString;
sourceType: z.ZodOptional<z.ZodString>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, z.ZodTypeAny, "passthrough">>;
}, "strip", z.ZodTypeAny, {
url: string;
title: string;
metadata: {
sourceName: string;
sourceType?: string | undefined;
tags?: string[] | undefined;
} & {
[k: string]: unknown;
};
text: string;
}, {
url: string;
title: string;
metadata: {
sourceName: string;
sourceType?: string | undefined;
tags?: string[] | undefined;
} & {
[k: string]: unknown;
};
text: string;
}>;
export declare const SearchResultRecordSchema: z.ZodObject<{
query: z.ZodString;
results: z.ZodArray<z.ZodObject<{
url: z.ZodString;
title: z.ZodString;
text: z.ZodString;
metadata: z.ZodObject<{
sourceName: z.ZodString;
sourceType: z.ZodOptional<z.ZodString>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
sourceName: z.ZodString;
sourceType: z.ZodOptional<z.ZodString>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
sourceName: z.ZodString;
sourceType: z.ZodOptional<z.ZodString>;
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
}, z.ZodTypeAny, "passthrough">>;
}, "strip", z.ZodTypeAny, {
url: string;
title: string;
metadata: {
sourceName: string;
sourceType?: string | undefined;
tags?: string[] | undefined;
} & {
[k: string]: unknown;
};
text: string;
}, {
url: string;
title: string;
metadata: {
sourceName: string;
sourceType?: string | undefined;
tags?: string[] | undefined;
} & {
[k: string]: unknown;
};
text: string;
}>, "many">;
dataSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
name: z.ZodString;
type: z.ZodOptional<z.ZodString>;
versionLabel: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
name: string;
type?: string | undefined;
versionLabel?: string | undefined;
}, {
name: string;
type?: string | undefined;
versionLabel?: string | undefined;
}>, "many">>;
limit: z.ZodOptional<z.ZodNumber>;
createdAt: z.ZodDate;
customData: z.ZodOptional<z.ZodObject<{}, "passthrough", z.ZodTypeAny, z.objectOutputType<{}, z.ZodTypeAny, "passthrough">, z.objectInputType<{}, z.ZodTypeAny, "passthrough">>>;
}, "strip", z.ZodTypeAny, {
query: string;
results: {
url: string;
title: string;
metadata: {
sourceName: string;
sourceType?: string | undefined;
tags?: string[] | undefined;
} & {
[k: string]: unknown;
};
text: string;
}[];
createdAt: Date;
dataSources?: {
name: string;
type?: string | undefined;
versionLabel?: string | undefined;
}[] | undefined;
limit?: number | undefined;
customData?: z.objectOutputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}, {
query: string;
results: {
url: string;
title: string;
metadata: {
sourceName: string;
sourceType?: string | undefined;
tags?: string[] | undefined;
} & {
[k: string]: unknown;
};
text: string;
}[];
createdAt: Date;
dataSources?: {
name: string;
type?: string | undefined;
versionLabel?: string | undefined;
}[] | undefined;
limit?: number | undefined;
customData?: z.objectInputType<{}, z.ZodTypeAny, "passthrough"> | undefined;
}>;
export interface SearchResultRecord {
query: string;
results: Document[];
dataSources?: SearchRecordDataSource[];
limit?: number;
createdAt: Date;
customData?: Record<string, unknown>;
}
export type MongoDbSearchResultsStore = DatabaseConnection & {
metadata: {
databaseName: string;
collectionName: string;
};
saveSearchResult(record: SearchResultRecord): Promise<void>;
init(): Promise<void>;
};
export type MakeMongoDbSearchResultsStoreParams = MakeMongoDbDatabaseConnectionParams & {
collectionName?: string;
};
export type ContentCustomData = Record<string, unknown> | undefined;
export declare function makeMongoDbSearchResultsStore({ connectionUri, databaseName, collectionName, }: MakeMongoDbSearchResultsStoreParams): MongoDbSearchResultsStore;
//# sourceMappingURL=MongoDbSearchResultsStore.d.ts.map