FakeEmbeddingGateway
class FakeEmbeddingGateway implements EmbeddingGateway
Properties
| protected int | $currentResponseIndex | ||
| protected bool | $preventStrayGenerations |
Methods
Generate embedding vectors representing the given inputs.
Get the next response instance.
Marshal the given response into a full response instance.
Generate fake embedding vectors.
Indicate that an exception should be thrown if any embeddings generation is not faked.
Details
at line 31
__construct(Closure|array $responses = [])
Create an embedding gateway with fake responses.
at line 42
EmbeddingsResponse
generateEmbeddings(EmbeddingProvider $provider, string $model, array $inputs, int $dimensions, int $timeout = 30, array $providerOptions = [])
Generate embedding vectors representing the given inputs.
at line 58
protected EmbeddingsResponse
nextResponse(EmbeddingProvider $provider, string $model, EmbeddingsPrompt $prompt)
Get the next response instance.
at line 81
protected EmbeddingsResponse
marshalResponse(mixed $response, EmbeddingProvider $provider, string $model, EmbeddingsPrompt $prompt)
Marshal the given response into a full response instance.
at line 118
protected array
generateFakeEmbeddings(int $count, int $dimensions)
Generate fake embedding vectors.
at line 132
FakeEmbeddingGateway
preventStrayEmbeddings(bool $prevent = true)
Indicate that an exception should be thrown if any embeddings generation is not faked.
When the shared manager holds this fake gateway, the setting affects every request in the worker.