-
-
Notifications
You must be signed in to change notification settings - Fork 230
Open
Description
Prism can only make blocking HTTP requests. This makes it hard to do async workflows.
For example: running an input guardrail asynchronously with the main model request.
$guardrailRequest = Prism::structured()
->async()
// ...
->asStructures();
$conversationRequest = Prism::text()
->async()
// ...
->stream();
[$guardrailResult, $conversationResult] = Promise\all([
$guardrailRequest,
$conversationRequest,
]);
if ($guardrailResult->structured['failed']) {
throw new GuardrailException();
}
foreach ($conversationResult as $chunk) {
yield $chunk->text;
}FredrikPAC, BoweFrankema, voodarkdoo, selected-pixel-jameson, B2rana and 2 more
Metadata
Metadata
Assignees
Labels
No labels