FakeRerankingGateway
class FakeRerankingGateway implements RerankingGateway
Properties
| protected int | $currentResponseIndex | ||
| protected bool | $preventStrayRerankings |
Methods
Rerank the given documents based on their relevance to the query.
Get the next response instance.
Marshal the given response into a full response instance.
Generate a fake ranking for the given documents.
Indicate that an exception should be thrown if any reranking is not faked.
Details
at line 28
__construct(Closure|array $responses = [])
Create a reranking gateway with fake responses.
at line 39
RerankingResponse
rerank(RerankingProvider $provider, string $model, array $documents, string $query, int|null $limit = null, int $timeout = 30, array $providerOptions = [])
Rerank the given documents based on their relevance to the query.
at line 56
protected RerankingResponse
nextResponse(RerankingProvider $provider, string $model, RerankingPrompt $prompt)
Get the next response instance.
at line 79
protected RerankingResponse
marshalResponse(mixed $response, RerankingProvider $provider, string $model, RerankingPrompt $prompt)
Marshal the given response into a full response instance.
at line 114
protected array
generateFakeRanking(array $documents, int|null $limit = null)
Generate a fake ranking for the given documents.
at line 139
FakeRerankingGateway
preventStrayRerankings(bool $prevent = true)
Indicate that an exception should be thrown if any reranking is not faked.
When the shared manager holds this fake gateway, the setting affects every request in the worker.