@gensx/storage
Version:
Cloud storage, blobs, sqlite, and vector database providers/hooks for GenSX.
18 lines (16 loc) • 593 B
text/typescript
import { SearchClient } from "./searchClient.js";
import { Namespace, SearchStorageOptions } from "./types.js";
/**
* Hook to access a search namespace
* @param name The name of the namespace to access
* @param options Optional configuration properties for the search namespace
* @returns A promise that resolves to a namespace object for the given name
*/
export async function useSearch(
name: string,
options: SearchStorageOptions = {},
): Promise<Namespace> {
const client = new SearchClient(options);
const namespace = await client.getNamespace(name);
return namespace;
}