class FakeStoreGateway implements StoreGateway

Properties

protected int $currentResponseIndex
protected bool $preventStrayOperations

Methods

__construct(Closure|array $responses = [])

Create a store gateway with fake responses.

getStore(StoreProvider $provider, string $storeId)

Get a vector store by its ID.

nextGetResponse(StoreProvider $provider, string $storeId)

Get the next response for a get request.

marshalGetResponse(StoreProvider $provider, mixed $response, string $storeId)

Marshal the given response into a Store instance.

createStore(StoreProvider $provider, string $name, string|null $description = null, Collection|null $fileIds = null, DateInterval|null $expiresWhenIdleFor = null)

Create a new vector store.

string
addFile(StoreProvider $provider, string $storeId, string $fileId, array $metadata = [])

Add a file to a vector store.

bool
removeFile(StoreProvider $provider, string $storeId, string $documentId)

Remove a file from a vector store.

bool
deleteStore(StoreProvider $provider, string $storeId)

Delete a vector store by its ID.

preventStrayOperations(bool $prevent = true)

Indicate that an exception should be thrown if any store operation is not faked.

Details

at line 28
__construct(Closure|array $responses = [])

Create a store gateway with fake responses.

Parameters

Closure|array $responses

at line 36
Store getStore(StoreProvider $provider, string $storeId)

Get a vector store by its ID.

Parameters

StoreProvider $provider
string $storeId

Return Value

Store

at line 44
protected Store nextGetResponse(StoreProvider $provider, string $storeId)

Get the next response for a get request.

Parameters

StoreProvider $provider
string $storeId

Return Value

Store

at line 63
protected Store marshalGetResponse(StoreProvider $provider, mixed $response, string $storeId)

Marshal the given response into a Store instance.

Parameters

StoreProvider $provider
mixed $response
string $storeId

Return Value

Store

at line 101
Store createStore(StoreProvider $provider, string $name, string|null $description = null, Collection|null $fileIds = null, DateInterval|null $expiresWhenIdleFor = null)

Create a new vector store.

Parameters

StoreProvider $provider
string $name
string|null $description
Collection|null $fileIds
DateInterval|null $expiresWhenIdleFor

Return Value

Store

at line 121
string addFile(StoreProvider $provider, string $storeId, string $fileId, array $metadata = [])

Add a file to a vector store.

Parameters

StoreProvider $provider
string $storeId
string $fileId
array $metadata

Return Value

string

at line 129
bool removeFile(StoreProvider $provider, string $storeId, string $documentId)

Remove a file from a vector store.

Parameters

StoreProvider $provider
string $storeId
string $documentId

Return Value

bool

at line 137
bool deleteStore(StoreProvider $provider, string $storeId)

Delete a vector store by its ID.

Parameters

StoreProvider $provider
string $storeId

Return Value

bool

at line 148
FakeStoreGateway preventStrayOperations(bool $prevent = true)

Indicate that an exception should be thrown if any store operation is not faked.

When the shared manager holds this fake gateway, the setting affects every request in the worker.

Parameters

bool $prevent

Return Value

FakeStoreGateway