FakeTextGateway
class FakeTextGateway implements StepTextGateway
Properties
| protected int | $currentResponseIndex | ||
| protected bool | $preventStrayPrompts |
Methods
Generate text for a single step in a conversation.
Stream text for a single step in a conversation.
Resolve the next fake response and marshal it into a step response.
Convert a marshalled fake response into a step response for the generation loop.
Get the next response instance.
Marshal the given response into a full response instance.
Indicate that an exception should be thrown if any prompt is not faked.
Details
at line 48
__construct(Closure|array $responses)
Create a text gateway with fake responses.
at line 58
StepResponse
generateTextStep(TextProvider $provider, string $model, string|null $instructions, array $messages, array $tools, array|null $schema, TextGenerationOptions|null $options, int|null $timeout, StepContext $stepContext)
Generate text for a single step in a conversation.
at line 78
Generator
generateStreamStep(string $invocationId, TextProvider $provider, string $model, string|null $instructions, array $messages, array $tools, array|null $schema, TextGenerationOptions|null $options, int|null $timeout, StepContext $stepContext)
Stream text for a single step in a conversation.
at line 142
protected StepResponse
nextStep(TextProvider $provider, string $model, array $messages, array|null $schema)
Resolve the next fake response and marshal it into a step response.
at line 164
protected StepResponse
toStepResponse(mixed $response, TextProvider $provider, string $model)
Convert a marshalled fake response into a step response for the generation loop.
at line 215
protected mixed
nextResponse(TextProvider $provider, string $model, string $prompt, Collection $attachments, array|null $schema)
Get the next response instance.
at line 237
protected mixed
marshalResponse(mixed $response, TextProvider $provider, string $model, string $prompt, Collection $attachments, array|null $schema)
Marshal the given response into a full response instance.
at line 285
FakeTextGateway
preventStrayPrompts(bool $prevent = true)
Indicate that an exception should be thrown if any prompt is not faked.
When the shared manager holds this fake gateway, the setting affects every request in the worker.