AiManager
class AiManager extends MultipleInstanceManager
Traits
Constants
| HTTP_CONNECTION |
|
| ON_DEMAND_PROVIDERS_CONTEXT_KEY |
|
Properties
| protected Repository | $config | The configuration repository instance. |
from MultipleInstanceManager |
| protected array | $instances | The array of resolved instances. |
from MultipleInstanceManager |
| protected array | $customCreators | The registered custom instance creators. |
from MultipleInstanceManager |
| protected string | $driverKey | The key name of the "driver" equivalent configuration option. |
from MultipleInstanceManager |
| protected array | $fakeAgentGateways | All of the registered fake agent gateways. |
from InteractsWithFakeAgents |
| protected array | $recordedPrompts | All of the recorded agent prompts. |
from InteractsWithFakeAgents |
| protected array | $recordedQueuedPrompts | All of the recorded agent prompts that were queued. |
from InteractsWithFakeAgents |
| protected FakeAudioGateway|null | $fakeAudioGateway | The fake audio gateway instance. |
from InteractsWithFakeAudio |
| protected array | $recordedAudioGenerations | All of the recorded audio generations. |
from InteractsWithFakeAudio |
| protected array | $recordedQueuedAudioGenerations | All of the recorded audio generations that were queued. |
from InteractsWithFakeAudio |
| protected FakeClassificationGateway|null | $fakeClassificationGateway | The fake classification gateway instance. |
from InteractsWithFakeClassification |
| protected array | $recordedClassifications | All of the recorded classifications. |
from InteractsWithFakeClassification |
| protected FakeEmbeddingGateway|null | $fakeEmbeddingGateway | The fake embedding gateway instance. |
from InteractsWithFakeEmbeddings |
| protected array | $recordedEmbeddingsGenerations | All of the recorded embeddings generations. |
from InteractsWithFakeEmbeddings |
| protected array | $recordedQueuedEmbeddingsGenerations | All of the recorded embeddings generations that were queued. |
from InteractsWithFakeEmbeddings |
| protected FakeFileGateway|null | $fakeFileGateway | The fake file gateway instance. |
from InteractsWithFakeFiles |
| protected array | $recordedFileUploads | All of the recorded file uploads. |
from InteractsWithFakeFiles |
| protected array | $recordedFileDeletions | All of the recorded file deletions. |
from InteractsWithFakeFiles |
| protected FakeImageGateway|null | $fakeImageGateway | The fake image gateway instance. |
from InteractsWithFakeImages |
| protected array | $recordedImageGenerations | All of the recorded image generations. |
from InteractsWithFakeImages |
| protected array | $recordedQueuedImageGenerations | All of the recorded image generations that were queued. |
from InteractsWithFakeImages |
| protected FakeRerankingGateway|null | $fakeRerankingGateway | The fake reranking gateway instance. |
from InteractsWithFakeReranking |
| protected array | $recordedRerankings | All of the recorded rerankings. |
from InteractsWithFakeReranking |
| protected FakeStoreGateway|null | $fakeStoreGateway | The fake store gateway instance. |
from InteractsWithFakeStores |
| protected array | $recordedStoreCreations | All of the recorded store creations. |
from InteractsWithFakeStores |
| protected array | $recordedStoreDeletions | All of the recorded store deletions. |
from InteractsWithFakeStores |
| protected array | $recordedFileAdditions | All of the recorded file additions. |
from InteractsWithFakeStores |
| protected array | $recordedFileRemovals | All of the recorded file removals. |
from InteractsWithFakeStores |
| protected FakeTranscriptionGateway|null | $fakeTranscriptionGateway | The fake transcription gateway instance. |
from InteractsWithFakeTranscriptions |
| protected array | $recordedTranscriptionGenerations | All of the recorded transcription generations. |
from InteractsWithFakeTranscriptions |
| protected array | $recordedQueuedTranscriptionGenerations | All of the recorded transcription generations that were queued. |
from InteractsWithFakeTranscriptions |
| protected null|Closure(string, array): array | $providerConfigResolver | ||
| protected string|null | $conversationPartitionColumn | ||
| protected null|Closure(): null|int|string | $conversationPartitionResolver | ||
| protected null|Closure(): ?string | $embeddingsCacheScopeResolver | ||
| protected null|Closure | $contextCapture |
Methods
Get the default instance name.
Set the default instance name.
Get the instance specific configuration.
Get a provider without retaining operation-owned credentials in the worker.
Attempt to get an instance from the local cache.
Forget resolved providers while retaining their configuration.
Remove a resolved provider.
Dynamically call the default instance.
Assert that a prompt was received matching a given truth test.
Assert that a certain number of prompts were received.
Assert that a prompt was received matching a given truth test.
Assert that a prompt was not received matching a given truth test.
Assert that a queued prompt was not received matching a given truth test.
Assert that no prompts were received.
Assert that no queued prompts were received.
Assert that audio was generated matching a given truth test.
Assert that audio was not generated matching a given truth test.
Assert that no audio was generated.
Assert that a queued audio generation was recorded matching a given truth test.
Assert that a queued audio generation was not recorded matching a given truth test.
Assert that no queued audio generations were recorded.
Assert that a classification was performed matching a given truth test.
Assert that a classification was not performed matching a given truth test.
Assert that no classifications were performed.
Determine if classification is faked.
Get the fake classification gateway.
Record an embeddings generation.
Assert that embeddings were generated matching a given truth test.
Assert that embeddings were not generated matching a given truth test.
Assert that no embeddings were generated.
Assert that a queued embeddings generation was recorded matching a given truth test.
Assert that a queued embeddings generation was not recorded matching a given truth test.
Assert that no queued embeddings generations were recorded.
Determine if embeddings generation is faked.
Get the fake embedding gateway.
Record a file deletion.
Assert that a file was not uploaded matching a given truth test.
Assert that no files were uploaded.
Assert that a file was deleted matching a given truth test.
Assert that a file was not deleted matching a given truth test.
Assert that no files were deleted.
Assert that an image was generated matching a given truth test.
Assert that an image was not generated matching a given truth test.
Assert that no images were generated.
Assert that a queued image generation was recorded matching a given truth test.
Assert that a queued image generation was not recorded matching a given truth test.
Assert that no queued image generations were recorded.
Assert that a reranking was performed matching a given truth test.
Assert that a reranking was not performed matching a given truth test.
Assert that no rerankings were performed.
Get the fake reranking gateway.
Record a store creation.
Record a store deletion.
Record a file addition to a store.
Record a file removal from a store.
Assert that a store was created matching a given truth test.
Assert that a store was not created matching a given truth test.
Assert that no stores were created.
Assert that a store was deleted matching a given truth test.
Assert that a store was not deleted matching a given truth test.
Assert that no stores were deleted.
Assert that a file was added to a store matching a given truth test.
Assert that a file was not added to a store matching a given truth test.
Assert that a file was removed from a store matching a given truth test.
Assert that a file was not removed from a store matching a given truth test.
Get a callback for matching store and file IDs.
Determine if the given file matches the expected file ID.
Record a transcription generation.
Assert that a transcription was generated matching a given truth test.
Assert that a transcription was not generated matching a given truth test.
Assert that no transcriptions were generated.
Assert that a queued transcription generation was recorded matching a given truth test.
Assert that a queued transcription generation was not recorded matching a given truth test.
Assert that no queued transcription generations were recorded.
Determine if transcription generation is faked.
Get the fake transcription gateway.
Get an on-demand provider from the current operation, if one exists.
Capture on-demand providers before an earlier failover attempt can replace them.
Get an audio provider instance, using a fake gateway if audio is faked.
Get a classification provider instance by name.
Get a classification provider instance, using a fake gateway if classification is faked.
Get an embedding provider instance, using a fake gateway if embeddings are faked.
Get a reranking provider instance, using a fake gateway if reranking is faked.
Get an image provider instance, using a fake gateway if images are faked.
Get a provider instance for an agent by name.
Get a transcription provider instance by name.
Get a transcription provider instance, using a fake gateway if transcriptions are faked.
Get a file provider instance, using a fake gateway if files are faked.
Get a store provider instance, using a fake gateway if stores are faked.
Create an Anthropic powered instance.
Create an Azure OpenAI powered instance.
Create an AWS Bedrock powered instance.
Create a Cohere powered instance.
Create a DeepSeek powered instance.
Create an ElevenLabs powered instance.
Create a Gemini powered instance.
Create a Groq powered instance.
Create a Jina powered instance.
Create a Mistral AI powered instance.
Create an Ollama powered instance.
Create an OpenAI powered instance.
Create an OpenAI-compatible powered instance.
Create an OpenRouter powered instance.
Create a TypeSafe powered instance.
Create a VoyageAI powered instance.
Create an xAI powered instance.
Get a provider instance by name, ensuring it implements the given capability contract.
Configure the conversation row partition resolver.
Get the configured conversation partition column.
Resolve the current conversation partition.
Resolve the current embeddings cache scope.
Capture a runner for the current operation's context.
Flush the on-demand providers built during the current operation.
Details
in
RebindsCallbacksToSelf at line 18
protected Closure|null
bindCallbackToSelf(Closure $callback)
Bind the provided callback to the class instance.
in
MultipleInstanceManager at line 44
__construct(Application $app)
Create a new manager instance.
at line 636
string
getDefaultInstance()
Get the default instance name.
at line 656
void
setDefaultInstance(string $name)
Set the default instance name.
This changes the worker's default provider for every request.
at line 665
array
getInstanceConfig(string $name)
Get the instance specific configuration.
at line 113
mixed
instance(string|null $name = null)
Get a provider without retaining operation-owned credentials in the worker.
in
MultipleInstanceManager at line 84
protected mixed
get(string $name)
Attempt to get an instance from the local cache.
in
MultipleInstanceManager at line 95
protected mixed
resolve(string $name)
Resolve the given instance.
in
MultipleInstanceManager at line 127
protected mixed
callCustomCreator(array $config)
Call a custom instance creator.
at line 181
MultipleInstanceManager
forgetInstance(array|string|null $name = null)
Forget resolved providers while retaining their configuration.
Forgetting a configured provider affects every request on the worker; on-demand providers belong to the current operation.
at line 201
void
purge(string|null $name = null)
Remove a resolved provider.
Forgetting a configured provider affects every request on the worker; on-demand providers belong to the current operation.
in
MultipleInstanceManager at line 181
MultipleInstanceManager
extend(string $name, Closure $callback)
Register a custom instance creator Closure.
Anonymous closures run in this manager's class scope; non-static closures also receive the manager as $this.
The callback persists in the singleton's customCreators array for the worker lifetime and applies to every subsequent instance resolution.
in
MultipleInstanceManager at line 205
MultipleInstanceManager
setApplication(Application $app)
Set the application instance used by the manager.
Swaps the singleton's application and configuration references without rebuilding resolved instances; per-request use races across coroutines and breaks every concurrent resolution through this manager.
in
MultipleInstanceManager at line 217
mixed
__call(string $method, array $parameters)
Dynamically call the default instance.
in
InteractsWithFakeAgents at line 40
FakeTextGateway
fakeAgent(string $agent, Closure|array $responses = [])
Fake the responses returned by the given agent.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeAgents at line 52
bool
hasFakeGatewayFor(Agent|string $agent)
Determine if the given agent has been faked.
in
InteractsWithFakeAgents at line 63
FakeTextGateway
fakeGatewayFor(Agent $agent)
Get a fake gateway instance for the given agent.
in
InteractsWithFakeAgents at line 75
InteractsWithFakeAgents
recordPrompt(AgentPrompt|QueuedAgentPrompt $prompt)
Record the given prompt for the faked agent.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeAgents at line 90
InteractsWithFakeAgents
assertAgentWasPrompted(string $agent, Closure|string $callback, array|null $prompts = null, string|null $message = null)
Assert that a prompt was received matching a given truth test.
in
InteractsWithFakeAgents at line 111
InteractsWithFakeAgents
assertAgentWasPromptedTimes(string $agent, int $times = 1)
Assert that a certain number of prompts were received.
in
InteractsWithFakeAgents at line 131
InteractsWithFakeAgents
assertAgentWasQueued(string $agent, Closure|string $callback)
Assert that a prompt was received matching a given truth test.
in
InteractsWithFakeAgents at line 144
InteractsWithFakeAgents
assertAgentNotPrompted(string $agent, Closure|string $callback, array|null $prompts = null, string|null $message = null)
Assert that a prompt was not received matching a given truth test.
in
InteractsWithFakeAgents at line 165
InteractsWithFakeAgents
assertAgentNotQueued(string $agent, Closure|string $callback)
Assert that a queued prompt was not received matching a given truth test.
in
InteractsWithFakeAgents at line 178
InteractsWithFakeAgents
assertAgentNeverPrompted(string $agent)
Assert that no prompts were received.
in
InteractsWithFakeAgents at line 191
InteractsWithFakeAgents
assertAgentNeverQueued(string $agent)
Assert that no queued prompts were received.
in
InteractsWithFakeAudio at line 37
FakeAudioGateway
fakeAudio(Closure|array $responses = [])
Fake audio generation.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeAudio at line 48
InteractsWithFakeAudio
recordAudioGeneration(AudioPrompt|QueuedAudioPrompt $prompt)
Record an audio generation.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeAudio at line 63
InteractsWithFakeAudio
assertAudioGenerated(Closure $callback)
Assert that audio was generated matching a given truth test.
in
InteractsWithFakeAudio at line 76
InteractsWithFakeAudio
assertAudioNotGenerated(Closure $callback)
Assert that audio was not generated matching a given truth test.
in
InteractsWithFakeAudio at line 89
InteractsWithFakeAudio
assertNoAudioGenerated()
Assert that no audio was generated.
in
InteractsWithFakeAudio at line 102
InteractsWithFakeAudio
assertAudioQueued(Closure $callback)
Assert that a queued audio generation was recorded matching a given truth test.
in
InteractsWithFakeAudio at line 115
InteractsWithFakeAudio
assertAudioNotQueued(Closure $callback)
Assert that a queued audio generation was not recorded matching a given truth test.
in
InteractsWithFakeAudio at line 128
InteractsWithFakeAudio
assertNoAudioQueued()
Assert that no queued audio generations were recorded.
in
InteractsWithFakeAudio at line 143
bool
audioIsFaked()
Determine if audio generation is faked.
in
InteractsWithFakeAudio at line 151
FakeAudioGateway|null
fakeAudioGateway()
Get the fake audio gateway.
in
InteractsWithFakeClassification at line 31
FakeClassificationGateway
fakeClassification(Closure|array $responses = [])
Fake classification operations.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeClassification at line 42
InteractsWithFakeClassification
recordClassification(ClassificationPrompt $prompt)
Record a classification.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeClassification at line 53
InteractsWithFakeClassification
assertClassified(Closure $callback)
Assert that a classification was performed matching a given truth test.
in
InteractsWithFakeClassification at line 66
InteractsWithFakeClassification
assertNotClassified(Closure $callback)
Assert that a classification was not performed matching a given truth test.
in
InteractsWithFakeClassification at line 79
InteractsWithFakeClassification
assertNothingClassified()
Assert that no classifications were performed.
in
InteractsWithFakeClassification at line 94
bool
classificationIsFaked()
Determine if classification is faked.
in
InteractsWithFakeClassification at line 102
FakeClassificationGateway|null
fakeClassificationGateway()
Get the fake classification gateway.
in
InteractsWithFakeEmbeddings at line 37
FakeEmbeddingGateway
fakeEmbeddings(Closure|array $responses = [])
Fake embeddings generation.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeEmbeddings at line 48
InteractsWithFakeEmbeddings
recordEmbeddingsGeneration(EmbeddingsPrompt|QueuedEmbeddingsPrompt $prompt)
Record an embeddings generation.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeEmbeddings at line 63
InteractsWithFakeEmbeddings
assertEmbeddingsGenerated(Closure $callback)
Assert that embeddings were generated matching a given truth test.
in
InteractsWithFakeEmbeddings at line 76
InteractsWithFakeEmbeddings
assertEmbeddingsNotGenerated(Closure $callback)
Assert that embeddings were not generated matching a given truth test.
in
InteractsWithFakeEmbeddings at line 89
InteractsWithFakeEmbeddings
assertNoEmbeddingsGenerated()
Assert that no embeddings were generated.
in
InteractsWithFakeEmbeddings at line 102
InteractsWithFakeEmbeddings
assertEmbeddingsQueued(Closure $callback)
Assert that a queued embeddings generation was recorded matching a given truth test.
in
InteractsWithFakeEmbeddings at line 115
InteractsWithFakeEmbeddings
assertEmbeddingsNotQueued(Closure $callback)
Assert that a queued embeddings generation was not recorded matching a given truth test.
in
InteractsWithFakeEmbeddings at line 128
InteractsWithFakeEmbeddings
assertNoEmbeddingsQueued()
Assert that no queued embeddings generations were recorded.
in
InteractsWithFakeEmbeddings at line 143
bool
embeddingsAreFaked()
Determine if embeddings generation is faked.
in
InteractsWithFakeEmbeddings at line 151
FakeEmbeddingGateway|null
fakeEmbeddingGateway()
Get the fake embedding gateway.
in
InteractsWithFakeFiles at line 36
FakeFileGateway
fakeFiles(Closure|array $responses = [])
Fake file operations.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeFiles at line 47
InteractsWithFakeFiles
recordFileUpload(StorableFile $file)
Record a file upload.
Recorded uploads remain on the worker-shared manager.
in
InteractsWithFakeFiles at line 62
InteractsWithFakeFiles
recordFileDeletion(string $fileId)
Record a file deletion.
Recorded deletions remain on the worker-shared manager.
in
InteractsWithFakeFiles at line 73
InteractsWithFakeFiles
assertFileUploaded(Closure $callback)
Assert that a file was uploaded matching a given truth test.
in
InteractsWithFakeFiles at line 86
InteractsWithFakeFiles
assertFileNotUploaded(Closure $callback)
Assert that a file was not uploaded matching a given truth test.
in
InteractsWithFakeFiles at line 99
InteractsWithFakeFiles
assertNoFilesUploaded()
Assert that no files were uploaded.
in
InteractsWithFakeFiles at line 112
InteractsWithFakeFiles
assertFileDeleted(Closure|string $callback)
Assert that a file was deleted matching a given truth test.
in
InteractsWithFakeFiles at line 130
InteractsWithFakeFiles
assertFileNotDeleted(Closure|string $callback)
Assert that a file was not deleted matching a given truth test.
in
InteractsWithFakeFiles at line 148
InteractsWithFakeFiles
assertNoFilesDeleted()
Assert that no files were deleted.
in
InteractsWithFakeFiles at line 163
bool
filesAreFaked()
Determine if file operations are faked.
in
InteractsWithFakeFiles at line 171
FakeFileGateway|null
fakeFileGateway()
Get the fake file gateway.
in
InteractsWithFakeImages at line 37
FakeImageGateway
fakeImages(Closure|array $responses = [])
Fake image generation.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeImages at line 48
InteractsWithFakeImages
recordImageGeneration(ImagePrompt|QueuedImagePrompt $prompt)
Record an image generation.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeImages at line 63
InteractsWithFakeImages
assertImageGenerated(Closure $callback)
Assert that an image was generated matching a given truth test.
in
InteractsWithFakeImages at line 76
InteractsWithFakeImages
assertImageNotGenerated(Closure $callback)
Assert that an image was not generated matching a given truth test.
in
InteractsWithFakeImages at line 89
InteractsWithFakeImages
assertNoImagesGenerated()
Assert that no images were generated.
in
InteractsWithFakeImages at line 102
InteractsWithFakeImages
assertImageQueued(Closure $callback)
Assert that a queued image generation was recorded matching a given truth test.
in
InteractsWithFakeImages at line 115
InteractsWithFakeImages
assertImageNotQueued(Closure $callback)
Assert that a queued image generation was not recorded matching a given truth test.
in
InteractsWithFakeImages at line 128
InteractsWithFakeImages
assertNoImagesQueued()
Assert that no queued image generations were recorded.
in
InteractsWithFakeImages at line 143
bool
imagesAreFaked()
Determine if image generation is faked.
in
InteractsWithFakeImages at line 151
FakeImageGateway|null
fakeImageGateway()
Get the fake image gateway.
in
InteractsWithFakeReranking at line 31
FakeRerankingGateway
fakeReranking(Closure|array $responses = [])
Fake reranking operations.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeReranking at line 42
InteractsWithFakeReranking
recordReranking(RerankingPrompt $prompt)
Record a reranking.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeReranking at line 53
InteractsWithFakeReranking
assertReranked(Closure $callback)
Assert that a reranking was performed matching a given truth test.
in
InteractsWithFakeReranking at line 66
InteractsWithFakeReranking
assertNotReranked(Closure $callback)
Assert that a reranking was not performed matching a given truth test.
in
InteractsWithFakeReranking at line 79
InteractsWithFakeReranking
assertNothingReranked()
Assert that no rerankings were performed.
in
InteractsWithFakeReranking at line 94
bool
rerankingIsFaked()
Determine if reranking is faked.
in
InteractsWithFakeReranking at line 102
FakeRerankingGateway|null
fakeRerankingGateway()
Get the fake reranking gateway.
in
InteractsWithFakeStores at line 51
FakeStoreGateway
fakeStores(Closure|array $responses = [])
Fake store operations.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeStores at line 62
InteractsWithFakeStores
recordStoreCreation(string $name, string|null $description = null, Collection|null $fileIds = null, DateInterval|null $expiresWhenIdleFor = null)
Record a store creation.
Recorded creations remain on the worker-shared manager.
in
InteractsWithFakeStores at line 84
InteractsWithFakeStores
recordStoreDeletion(string $storeId)
Record a store deletion.
Recorded deletions remain on the worker-shared manager.
in
InteractsWithFakeStores at line 97
InteractsWithFakeStores
recordFileAddition(string $storeId, string $fileId, StorableFile|UploadedFile|HasProviderId|string $file)
Record a file addition to a store.
Recorded additions remain on the worker-shared manager.
in
InteractsWithFakeStores at line 117
InteractsWithFakeStores
recordFileRemoval(string $storeId, string $fileId)
Record a file removal from a store.
Recorded removals remain on the worker-shared manager.
in
InteractsWithFakeStores at line 131
InteractsWithFakeStores
assertStoreCreated(Closure|string $callback)
Assert that a store was created matching a given truth test.
in
InteractsWithFakeStores at line 154
InteractsWithFakeStores
assertStoreNotCreated(Closure|string $callback)
Assert that a store was not created matching a given truth test.
in
InteractsWithFakeStores at line 177
InteractsWithFakeStores
assertNoStoresCreated()
Assert that no stores were created.
in
InteractsWithFakeStores at line 190
InteractsWithFakeStores
assertStoreDeleted(Closure|string $callback)
Assert that a store was deleted matching a given truth test.
in
InteractsWithFakeStores at line 208
InteractsWithFakeStores
assertStoreNotDeleted(Closure|string $callback)
Assert that a store was not deleted matching a given truth test.
in
InteractsWithFakeStores at line 226
InteractsWithFakeStores
assertNoStoresDeleted()
Assert that no stores were deleted.
in
InteractsWithFakeStores at line 239
InteractsWithFakeStores
assertFileAddedToStore(Closure|string $storeId, string|null $fileId = null)
Assert that a file was added to a store matching a given truth test.
in
InteractsWithFakeStores at line 254
InteractsWithFakeStores
assertFileNotAddedToStore(Closure|string $storeId, string|null $fileId = null)
Assert that a file was not added to a store matching a given truth test.
in
InteractsWithFakeStores at line 269
InteractsWithFakeStores
assertFileRemovedFromStore(Closure|string $storeId, string|null $fileId = null)
Assert that a file was removed from a store matching a given truth test.
in
InteractsWithFakeStores at line 284
InteractsWithFakeStores
assertFileNotRemovedFromStore(Closure|string $storeId, string|null $fileId = null)
Assert that a file was not removed from a store matching a given truth test.
in
InteractsWithFakeStores at line 299
protected Closure
fileMatchingCallback(Closure|string $storeId, string|null $fileId)
Get a callback for matching store and file IDs.
in
InteractsWithFakeStores at line 312
protected bool
fileIdMatches(StorableFile|UploadedFile|HasProviderId|string $file, string|null $expectedFileId)
Determine if the given file matches the expected file ID.
in
InteractsWithFakeStores at line 328
bool
storesAreFaked()
Determine if store operations are faked.
in
InteractsWithFakeStores at line 336
FakeStoreGateway|null
fakeStoreGateway()
Get the fake store gateway.
in
InteractsWithFakeTranscriptions at line 37
FakeTranscriptionGateway
fakeTranscriptions(Closure|array $responses = [])
Fake transcription generation.
On the shared manager, the fake gateway affects every request.
in
InteractsWithFakeTranscriptions at line 48
InteractsWithFakeTranscriptions
recordTranscriptionGeneration(TranscriptionPrompt|QueuedTranscriptionPrompt $prompt)
Record a transcription generation.
Recorded prompts remain on the worker-shared manager.
in
InteractsWithFakeTranscriptions at line 63
InteractsWithFakeTranscriptions
assertTranscriptionGenerated(Closure $callback)
Assert that a transcription was generated matching a given truth test.
in
InteractsWithFakeTranscriptions at line 76
InteractsWithFakeTranscriptions
assertTranscriptionNotGenerated(Closure $callback)
Assert that a transcription was not generated matching a given truth test.
in
InteractsWithFakeTranscriptions at line 89
InteractsWithFakeTranscriptions
assertNoTranscriptionsGenerated()
Assert that no transcriptions were generated.
in
InteractsWithFakeTranscriptions at line 102
InteractsWithFakeTranscriptions
assertTranscriptionQueued(Closure $callback)
Assert that a queued transcription generation was recorded matching a given truth test.
in
InteractsWithFakeTranscriptions at line 115
InteractsWithFakeTranscriptions
assertTranscriptionNotQueued(Closure $callback)
Assert that a queued transcription generation was not recorded matching a given truth test.
in
InteractsWithFakeTranscriptions at line 128
InteractsWithFakeTranscriptions
assertNoTranscriptionsQueued()
Assert that no queued transcription generations were recorded.
in
InteractsWithFakeTranscriptions at line 143
bool
transcriptionsAreFaked()
Determine if transcription generation is faked.
in
InteractsWithFakeTranscriptions at line 151
FakeTranscriptionGateway|null
fakeTranscriptionGateway()
Get the fake transcription gateway.
at line 91
Provider
build(array $config)
Build an on-demand provider instance from the given configuration.
at line 145
Provider|null
onDemandProvider(string $name)
| internal |
Get an on-demand provider from the current operation, if one exists.
at line 164
array
resolveOnDemandProviders(array $providers)
| internal |
Capture on-demand providers before an earlier failover attempt can replace them.
at line 211
AudioProvider
audioProvider(Provider|string|null $name = null)
Get an audio provider instance by name.
at line 221
AudioProvider
fakeableAudioProvider(Provider|string|null $name = null)
Get an audio provider instance, using a fake gateway if audio is faked.
at line 235
ClassificationProvider
classificationProvider(Provider|string|null $name = null)
Get a classification provider instance by name.
at line 245
ClassificationProvider
fakeableClassificationProvider(Provider|string|null $name = null)
Get a classification provider instance, using a fake gateway if classification is faked.
at line 259
EmbeddingProvider
embeddingProvider(Provider|string|null $name = null)
Get an embedding provider instance by name.
at line 269
EmbeddingProvider
fakeableEmbeddingProvider(Provider|string|null $name = null)
Get an embedding provider instance, using a fake gateway if embeddings are faked.
at line 283
RerankingProvider
rerankingProvider(Provider|string|null $name = null)
Get a reranking provider instance by name.
at line 293
RerankingProvider
fakeableRerankingProvider(Provider|string|null $name = null)
Get a reranking provider instance, using a fake gateway if reranking is faked.
at line 307
ImageProvider
imageProvider(Provider|string|null $name = null)
Get an image provider instance by name.
at line 317
ImageProvider
fakeableImageProvider(Provider|string|null $name = null)
Get an image provider instance, using a fake gateway if images are faked.
at line 331
TextProvider
textProvider(Provider|string|null $name = null)
Get a text provider instance by name.
at line 341
TextProvider
textProviderFor(Agent $agent, Provider|string|null $name = null)
Get a provider instance for an agent by name.
at line 355
TranscriptionProvider
transcriptionProvider(Provider|string|null $name = null)
Get a transcription provider instance by name.
at line 365
TranscriptionProvider
fakeableTranscriptionProvider(Provider|string|null $name = null)
Get a transcription provider instance, using a fake gateway if transcriptions are faked.
at line 379
FileProvider
fileProvider(Provider|string|null $name = null)
Get a file provider instance by name.
at line 389
FileProvider
fakeableFileProvider(Provider|string|null $name = null)
Get a file provider instance, using a fake gateway if files are faked.
at line 403
StoreProvider
storeProvider(Provider|string|null $name = null)
Get a store provider instance by name.
at line 413
StoreProvider
fakeableStoreProvider(Provider|string|null $name = null)
Get a store provider instance, using a fake gateway if stores are faked.
at line 425
AnthropicProvider
createAnthropicDriver(array $config)
Create an Anthropic powered instance.
at line 437
AzureOpenAiProvider
createAzureDriver(array $config)
Create an Azure OpenAI powered instance.
at line 448
BedrockProvider
createBedrockDriver(array $config)
Create an AWS Bedrock powered instance.
at line 459
CohereProvider
createCohereDriver(array $config)
Create a Cohere powered instance.
at line 470
DeepSeekProvider
createDeepseekDriver(array $config)
Create a DeepSeek powered instance.
at line 481
ElevenLabsProvider
createElevenDriver(array $config)
Create an ElevenLabs powered instance.
at line 492
GeminiProvider
createGeminiDriver(array $config)
Create a Gemini powered instance.
at line 504
GroqProvider
createGroqDriver(array $config)
Create a Groq powered instance.
at line 515
JinaProvider
createJinaDriver(array $config)
Create a Jina powered instance.
at line 526
MistralProvider
createMistralDriver(array $config)
Create a Mistral AI powered instance.
at line 537
OllamaProvider
createOllamaDriver(array $config)
Create an Ollama powered instance.
at line 548
OpenAiProvider
createOpenaiDriver(array $config)
Create an OpenAI powered instance.
at line 560
OpenAiCompatibleProvider
createOpenaiCompatibleDriver(array $config)
Create an OpenAI-compatible powered instance.
at line 571
OpenRouterProvider
createOpenrouterDriver(array $config)
Create an OpenRouter powered instance.
at line 582
TypeSafeProvider
createTypesafeDriver(array $config)
Create a TypeSafe powered instance.
at line 593
VoyageAiProvider
createVoyageaiDriver(array $config)
Create a VoyageAI powered instance.
at line 604
XaiProvider
createXaiDriver(array $config)
Create an xAI powered instance.
at line 622
protected mixed
ensureProviderSupports(string $contract, string $capability, Provider|string|null $name)
Get a provider instance by name, ensuring it implements the given capability contract.
at line 699
void
resolveProviderConfigUsing(Closure $resolver)
Configure the provider configuration resolver.
Configured providers are rebuilt on every lookup, including those built by custom creators. Keep custom creators inexpensive and stateless.
On the shared manager, the callback applies to every later AI operation.
at line 717
void
resolveConversationPartitionUsing(string $column, Closure $resolver)
Configure the conversation row partition resolver.
On the shared manager, the column and callback apply to every subsequent conversation operation.
at line 735
string|null
conversationPartitionColumn()
Get the configured conversation partition column.
at line 743
int|string|null
conversationPartition()
Resolve the current conversation partition.
at line 766
void
resolveEmbeddingsCacheScopeUsing(Closure $resolver)
Configure the embeddings cache scope resolver.
On the shared manager, the callback applies to every subsequent embeddings cache operation.
at line 779
string|null
embeddingsCacheScope()
Resolve the current embeddings cache scope.
at line 802
void
captureContextUsing(Closure $capture)
Configure context capture for deferred operations.
The returned runner wraps every stream resumption and AI callback, including nested failover and sub-agent streams. It must be safe to nest and inexpensive to re-enter when its context is already active. Return a runner for a captured empty context too; null means no wrapper.
On the shared manager, the callback applies to every later AI operation.
at line 817
Closure|null
captureContext()
Capture a runner for the current operation's context.
at line 825
void
flushState()
Flush the on-demand providers built during the current operation.