llamaindex
Version:
<p align="center"> <img height="100" width="100" alt="LlamaIndex logo" src="https://ts.llamaindex.ai/square.svg" /> </p> <h1 align="center">LlamaIndex.TS</h1> <h3 align="center"> Data framework for your LLM application. </h3>
55 lines (50 loc) • 2.26 kB
text/typescript
export * from '@llamaindex/core/storage/chat-store';
import { KVDocumentStore, BaseDocumentStore } from '@llamaindex/core/storage/doc-store';
export * from '@llamaindex/core/storage/doc-store';
import { BaseIndexStore } from '@llamaindex/core/storage/index-store';
export * from '@llamaindex/core/storage/index-store';
import { SimpleKVStore } from '@llamaindex/core/storage/kv-store';
export * from '@llamaindex/core/storage/kv-store';
import { Logger } from '@llamaindex/env';
import { VectorStoreByType, BaseVectorStore } from '@llamaindex/core/vector-store';
type SaveDict = Record<string, any>;
declare class SimpleDocumentStore extends KVDocumentStore {
private kvStore;
constructor(kvStore?: SimpleKVStore, namespace?: string);
static fromPersistDir(persistDir?: string, namespace?: string, options?: {
logger?: Logger;
}): Promise<SimpleDocumentStore>;
static fromPersistPath(persistPath: string, namespace?: string, options?: {
logger?: Logger;
}): Promise<SimpleDocumentStore>;
persist(persistPath?: string): Promise<void>;
static fromDict(saveDict: SaveDict, namespace?: string): SimpleDocumentStore;
toDict(): SaveDict;
}
/**
* Checks if a file exists.
* Analogous to the os.path.exists function from Python.
* @param path The path to the file to check.
* @returns A promise that resolves to true if the file exists, false otherwise.
*/
declare function exists(path: string): Promise<boolean>;
/**
* Recursively traverses a directory and yields all the paths to the files in it.
* @param dirPath The path to the directory to traverse.
*/
declare function walk(dirPath: string): AsyncIterable<string>;
interface StorageContext {
docStore: BaseDocumentStore;
indexStore: BaseIndexStore;
vectorStores: VectorStoreByType;
}
type BuilderParams = {
docStore: BaseDocumentStore;
indexStore: BaseIndexStore;
vectorStore: BaseVectorStore;
vectorStores: VectorStoreByType;
persistDir: string;
};
declare function storageContextFromDefaults({ docStore, indexStore, vectorStore, vectorStores, persistDir, }: Partial<BuilderParams>): Promise<StorageContext>;
export { SimpleDocumentStore, exists, storageContextFromDefaults, walk };
export type { StorageContext };