$this->userId, 'provider' => $this->provider, 'model' => $this->model, 'request_payload' => $this->requestPayload, 'response_payload' => $this->responsePayload, 'prompt_tokens' => $this->promptTokens, 'completion_tokens' => $this->completionTokens, 'total_tokens' => $this->totalTokens, 'response_time_ms' => $this->responseTimeMs, 'prompt_cost' => $this->promptCost, 'completion_cost' => $this->completionCost, 'total_cost' => $this->totalCost, 'status' => $this->status, 'error_message' => $this->errorMessage, 'http_status' => $this->httpStatus, 'ip_address' => $this->ipAddress, 'user_agent' => $this->userAgent, 'request_id' => $this->requestId, ]); } catch (\Exception $e) { Log::error('Failed to log LLM request', [ 'error' => $e->getMessage(), 'user_id' => $this->userId, 'provider' => $this->provider, 'model' => $this->model, 'request_id' => $this->requestId, ]); throw $e; } } public function failed(\Throwable $exception): void { Log::critical('LogLlmRequest job failed after all retries', [ 'user_id' => $this->userId, 'provider' => $this->provider, 'model' => $this->model, 'request_id' => $this->requestId, 'error' => $exception->getMessage(), ]); } }