MemoryService
in
Table of Contents
Methods
- delete() : void
- Delete memory entries for a source
- search() : array<string|int, mixed>
- Search for similar content
- store() : void
- Store content with embedding in memory
Methods
delete()
Delete memory entries for a source
public
delete(int $userId, string $sourceType, int $sourceId) : void
Parameters
- $userId : int
- $sourceType : string
- $sourceId : int
search()
Search for similar content
public
search(int $userId, array<string|int, mixed> $queryEmbedding[, int $limit = 10 ][, float $threshold = 0.7 ]) : array<string|int, mixed>
Parameters
- $userId : int
- $queryEmbedding : array<string|int, mixed>
- $limit : int = 10
- $threshold : float = 0.7
Return values
array<string|int, mixed> —Array of ['content' => string, 'metadata' => array, 'score' => float]
store()
Store content with embedding in memory
public
store(int $userId, string $sourceType, int $sourceId, string $content, array<string|int, mixed> $embedding[, array<string|int, mixed> $metadata = [] ]) : void
Parameters
- $userId : int
- $sourceType : string
- $sourceId : int
- $content : string
- $embedding : array<string|int, mixed>
- $metadata : array<string|int, mixed> = []