Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test utilities #54

Merged
merged 9 commits into from
Nov 9, 2024
Merged

Test utilities #54

merged 9 commits into from
Nov 9, 2024

Conversation

sixlive
Copy link
Contributor

@sixlive sixlive commented Nov 8, 2024

Description

Closes #57

$fake = Prism::fake([
    new ProviderResponse(
        text: 'The meaning of life is 42',
        toolCalls: [],
        usage: new Usage(42, 42),
        finishReason: FinishReason::Stop,
        response: ['id' => 'cpl_1234', 'model' => 'claude-3-sonnet'],
    ),
]);

Prism::text()
    ->using('anthropic', 'claude-3-sonnet')
    ->withPrompt('What is the meaning of life?')
    ->generate();

$fake->assertCallCount(1);
$fake->assertPrompt('What is the meaning of life?');
$fake->assertRequest(function (array $requests): void {
    expect($requests)->toHaveCount(1);
    expect($requests[0])->toBeInstanceOf(TextRequest::class);
});

@sixlive sixlive self-assigned this Nov 8, 2024
@sixlive sixlive marked this pull request as ready for review November 9, 2024 21:14
Copy link

netlify bot commented Nov 9, 2024

Deploy Preview for stunning-cannoli-238aa5 ready!

Name Link
🔨 Latest commit 392a37b
🔍 Latest deploy log https://app.netlify.com/sites/stunning-cannoli-238aa5/deploys/672fea1537886500085c2d5a
😎 Deploy Preview https://deploy-preview-54--stunning-cannoli-238aa5.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@sixlive sixlive merged commit 6ad1789 into main Nov 9, 2024
10 checks passed
@sixlive sixlive deleted the test-utilities branch November 9, 2024 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Testing Prism integrations
1 participant