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

Adding debug support for request and response. #56

Open
pushpak1300 opened this issue Nov 9, 2024 · 5 comments
Open

Adding debug support for request and response. #56

pushpak1300 opened this issue Nov 9, 2024 · 5 comments

Comments

@pushpak1300
Copy link
Contributor

Is there a way to get Raw Json response from the ProviderResponse ?
Also It will be great to see what Request is being sent from the prism to different provider ?

@sixlive
Copy link
Contributor

sixlive commented Nov 9, 2024

There isn't anything right now but I'm open to it.

Do you have a specific use case in mind?

@pushpak1300
Copy link
Contributor Author

Yes. For debugging Having something like this will help a lot.

$response = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-sonnet')
    ->withSystemPrompt(view('prompts.system'))
    ->withPrompt('Explain quantum computing to a 5-year-old.')
    ->generate()
   ->dumpRawResponse(); // will  dump response in array format

   
$response = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-sonnet')
    ->withSystemPrompt(view('prompts.system'))
    ->withPrompt('Explain quantum computing to a 5-year-old.')
    ->generate()
   ->ddRawResponse(); // will die& dump response in array format

$response = Prism::text()
    ->using(Provider::Anthropic, 'claude-3-sonnet')
    ->withSystemPrompt(view('prompts.system'))
    ->withPrompt('Explain quantum computing to a 5-year-old.')
   ->ddRawRequest(); //Will dump request payload and url in array format
   

What do you think ? (Similar to this )

@sixlive
Copy link
Contributor

sixlive commented Nov 14, 2024

I think this is totally doable. I'm working my way through a pretty major refactor in preparation for structured output / object support. I'll try and keep this in mind and we can circle back to it. Going to leave this issue open as a reference.

@code-distortion
Copy link

Hi there. dump and dd variants seem useful to me too, similar to those in the Eloquent QueryBuilder, for quick verification.

I'd like to also suggest callbacks, which would allow for logging of requests/responses.

Or perhaps the middleware in the roadmap will allow for this?

@pushpak1300
Copy link
Contributor Author

I think extension of this is to have a system architected in a such way where so we can integration with system like Langfuse or debuggeres where we can log the request and response asynchornously. https://api.reference.langfuse.com/#get-/api/public/comments

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

No branches or pull requests

3 participants