0.3.7 • Published 5 months ago
@daydreamsai/firebase v0.3.7
@daydreamsai/firebase
A Firebase Firestore integration package for the DaydreamsAI platform, providing persistent memory storage for conversation data.
Features
- Persistent memory storage for conversation data in Firestore
- Use with environment variables or direct service account credentials
- Fully typed API
- Implements core DaydreamsAI interfaces for seamless integration
Installation
npm install @daydreamsai/firebase
# or
yarn add @daydreamsai/firebase
# or
pnpm add @daydreamsai/firebase
Usage
import { createFirebaseMemoryStore } from '@daydreamsai/firebase';
// Create and initialize the store
const store = await createFirebaseMemoryStore({
collectionName: 'my_conversations' // Optional, defaults to "conversations"
});
// Store and retrieve data
await store.set('user123', { messages: [...] });
const data = await store.get('user123');
You can also provide service account credentials directly:
const store = await createFirebaseMemoryStore({
serviceAccount: {
projectId: 'your-project-id',
clientEmail: 'your-client-email@project.iam.gserviceaccount.com',
privateKey: 'YOUR_PRIVATE_KEY'
},
collectionName: 'my_conversations'
});
API
createFirebaseMemoryStore(options: FirebaseMemoryOptions): Promise<MemoryStore>
Creates and initializes a Firebase Firestore memory store implementation.
Options
serviceAccount
(optional): Service account credentialsprojectId
: Firebase project IDclientEmail
: Service account client emailprivateKey
: Service account private key
collectionName
(optional): Name of the Firestore collection to use (defaults to "conversations")
Methods
get<T>(key: string): Promise<T | null>
- Retrieve a value by keyset<T>(key: string, value: T): Promise<void>
- Store a value by keydelete(key: string): Promise<void>
- Remove a value by keyclear(): Promise<void>
- Remove all values from the store
License
MIT
0.3.7
5 months ago
0.3.7-alpha.7
5 months ago
0.3.7-alpha.6
5 months ago
0.3.7-alpha.5
5 months ago
0.3.7-alpha.4
5 months ago
0.3.7-alpha.3
5 months ago