useMemoryStorage
useMemoryStorage(
options:object):BaseUseMemoryStorageResult
Defined in: src/expo/useMemoryStorage.ts:152
A React hook that wraps useMemory with automatic memory persistence using WatermelonDB.
Expo/React Native version - This is a lightweight version that only supports API-based embeddings. Local embeddings require web APIs not available in React Native.
Parameters
| Parameter | Type | Description |
|---|---|---|
|
|
|
Configuration options |
|
|
|
‐ |
|
|
|
‐ |
|
|
|
‐ |
|
|
‐ | |
|
|
|
‐ |
|
|
|
‐ |
|
|
() => |
‐ |
|
|
( |
‐ |
|
|
‐ | |
|
|
|
‐ |
Returns
BaseUseMemoryStorageResult
An object containing memory state, methods, and storage operations
Example
import { Database } from '@nozbe/watermelondb';
import { useMemoryStorage } from '@reverbia/sdk/expo';
function MemoryScreen({ database }: { database: Database }) {
const {
memories,
extractMemoriesFromMessage,
searchMemories,
} = useMemoryStorage({
database,
getToken: async () => getAuthToken(),
});
const handleExtract = async () => {
await extractMemoriesFromMessage({
messages: [{ role: 'user', content: 'My name is John' }],
});
};
return (
<View>
<Button onPress={handleExtract} title="Extract" />
<Text>Memories: {memories.length}</Text>
</View>
);
}