feat: Enhance logging by including request payload in generation responses
This commit is contained in:
@@ -100,8 +100,10 @@ abstract class Groq_AI_Abstract_OpenAI_Provider implements Groq_AI_Provider_Inte
|
||||
$request_body['response_format'] = $args['response_format'];
|
||||
}
|
||||
|
||||
$endpoint = $this->get_endpoint();
|
||||
|
||||
$response = wp_remote_post(
|
||||
$this->get_endpoint(),
|
||||
$endpoint,
|
||||
[
|
||||
'headers' => [
|
||||
'Authorization' => 'Bearer ' . $api_key,
|
||||
@@ -140,6 +142,10 @@ abstract class Groq_AI_Abstract_OpenAI_Provider implements Groq_AI_Provider_Inte
|
||||
'content' => $content,
|
||||
'usage' => $usage,
|
||||
'raw_response' => $body,
|
||||
'request_payload' => [
|
||||
'url' => $endpoint,
|
||||
'body' => $request_body,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -231,12 +231,16 @@ class Groq_AI_Provider_Google implements Groq_AI_Provider_Interface {
|
||||
$usage['finish_reason'] = $finish_reason;
|
||||
}
|
||||
|
||||
return [
|
||||
'content' => $content,
|
||||
'usage' => $usage,
|
||||
'raw_response' => $body,
|
||||
];
|
||||
}
|
||||
return [
|
||||
'content' => $content,
|
||||
'usage' => $usage,
|
||||
'raw_response' => $body,
|
||||
'request_payload' => [
|
||||
'url' => $endpoint,
|
||||
'body' => $payload,
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
private function build_safety_settings_payload( $settings ) {
|
||||
if ( empty( $settings ) || ! is_array( $settings ) ) {
|
||||
|
||||
Reference in New Issue
Block a user