106
107
108▶def _generate_response_from_error(error: BaseException) -> list[ChatGeneration]:
109 if hasattr(error, "response"):
110 response = error.response
· · ·
109▶ if hasattr(error, "response"):
110 response = error.response
111 metadata: dict = {}
· · ·
110▶ response = error.response
111 metadata: dict = {}
112 if hasattr(response, "json"):
· · ·
125 if hasattr(response, "status_code"):
126 metadata["status_code"] = response.status_code
127▶ if hasattr(error, "request_id"):
128 metadata["request_id"] = error.request_id
129 generations = [
· · ·
128▶ metadata["request_id"] = error.request_id
129 generations = [
130 ChatGeneration(message=AIMessage(content="", response_metadata=metadata))
+ 57 more matches in this file