This React hook provides an easy integration with the CloseVectorManager
from the closevector-web
package.
npm install closevector-react
import { useCloseVectorManager } from 'closevector-react';
function MyComponent() {
const { manager, downloadProgress, getInstance } = useCloseVectorManager({
accessKey: 'YOUR_ACCESS_KEY',
uuid: 'YOUR_UUID',
customEmbeddings: 'YOUR_CUSTOM_EMBEDDINGS'
});
// Use the manager, downloadProgress, and getInstance as needed
}
The useCloseVectorManager
hook initializes and manages the instance of CloseVectorManager
.
options
: An object containing the following properties:accessKey
: Your access key for CloseVectorManager.uuid
: Your unique identifier for the instance.customEmbeddings
: Your custom embeddings (if any).
manager
: The instance ofCloseVectorManager
.downloadProgress
: A number representing the download progress (ranging from 0 to 1).getInstance
: A function to retrieve the library instance of the manager. Throws an error if the manager is not initialized.