UNPKG

fumadocs-core

Version:

The React.js library for building a documentation website

74 lines • 2.27 kB
import { r as SortedResult } from "./index-BlFx9iJj.js"; import { n as SearchAPI } from "./server-CYiYlUy_.js"; import { t as DocumentRecord } from "./meilisearch-B_1NqhPM.js"; import Mixedbread from "@mixedbread/sdk"; import { ScoredTextInputChunk } from "@mixedbread/sdk/resources/stores"; /** * Metadata of the file of a page */ interface SearchMetadata { title: string; url: string; breadcrumbs?: string[]; tags: string[]; locale?: string; /** hash of its chunks, unchanged pages are skipped */ hash: string; } /** * Metadata of a chunk, a search record of its page */ interface RecordMetadata { kind: SortedResult['type']; /** ID of the heading it belongs to */ heading?: string; table?: string; } type StoreSearchResult = ScoredTextInputChunk & { metadata: SearchMetadata; generated_metadata: RecordMetadata; }; interface MixedbreadSearchOptions { /** * The Mixedbread SDK client instance */ client: Mixedbread; /** * The identifier of the store to search in */ storeIdentifier: string; /** * Maximum number of results to return, the `limit` of requests can only lower it * * @defaultValue 10 */ topK?: number; /** * Re-rank search results for improved relevance (this adds latency to the search) */ rerank?: boolean; /** * Rewrite the query for better search results (this adds latency to the search) */ rewriteQuery?: boolean; /** * Minimum score threshold for results */ scoreThreshold?: number; /** * Custom transform function for search results */ transform?: (results: StoreSearchResult[], query: string) => SortedResult[]; } declare function createMixedbreadSearchAPI(options: MixedbreadSearchOptions): SearchAPI; interface SyncOptions { storeIdentifier: string; documents: DocumentRecord[]; } /** * Upload a file for each page, whose chunks are the title, headings and paragraphs of the page. Unchanged pages are skipped, files of removed pages are deleted. * * @param client - Mixedbread client with an API key that can write to the store */ declare function sync(client: Mixedbread, options: SyncOptions): Promise<void>; export { sync as a, createMixedbreadSearchAPI as i, SearchMetadata as n, SyncOptions as r, MixedbreadSearchOptions as t };