@promptbook/openai
Version:
Promptbook: Turn your company's scattered knowledge into AI ready books
43 lines (42 loc) • 1.68 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import type { string_data_url, string_filename, string_knowledge_source_link } from '../../types/typeAliases';
/**
* @private Internal representation of inline knowledge prepared for uploads.
*/
export type InlineKnowledgeSourceFile = {
readonly filename: string_filename;
readonly mimeType: string;
readonly buffer: Buffer;
};
/**
* @private Function signature used to upload inline knowledge files to external storage.
*/
export type InlineKnowledgeSourceUploader = (file: InlineKnowledgeSourceFile) => Promise<string_knowledge_source_link>;
/**
* @private Converts inline knowledge into the internal metadata form used for uploads.
*/
export declare function createInlineKnowledgeSourceFile(content: string): InlineKnowledgeSourceFile;
/**
* Checks whether the provided source string is a data URL that can be decoded.
*
* @private thing of inline knowledge
*/
export declare function isDataUrlKnowledgeSource(source: string): source is string_data_url;
/**
* @private Converts a stored inline knowledge file into a data URL for backwards compatibility.
*/
export declare function inlineKnowledgeSourceToDataUrl(source: InlineKnowledgeSourceFile): string_knowledge_source_link;
/**
* Parses a data URL-based knowledge source into its raw buffer, filename, and MIME type.
*
* @private utility of inline knowledge processing
*/
export declare function parseDataUrlKnowledgeSource(source: string): {
readonly buffer: Buffer;
readonly filename: string_filename;
readonly mimeType: string;
} | null;
/**
* Note: [💞] Ignore a discrepancy between file name and entity name
*/