Skip to content

feat: Consistently include original in "Unexpected response" errors#392

Merged
brainlid merged 5 commits intobrainlid:mainfrom
commoncurriculum:unexpected-response-original
Feb 14, 2026
Merged

feat: Consistently include original in "Unexpected response" errors#392
brainlid merged 5 commits intobrainlid:mainfrom
commoncurriculum:unexpected-response-original

Conversation

@mweidner037
Copy link
Copy Markdown
Contributor

We're encountering these while using ChatGoogleAI but with original: nil. The PR adds original in that case, as well as in the other Chat... classes at an analogous place.

Note: There is a difference in the error messages returned in the "Unexpected response" case for streaming vs non-streaming, consistently across chat models. If you like, I can make them consistent with each other, in either direction.

# do_api_request(...{stream: false}...):
      other ->
        Logger.error("Unexpected and unhandled API response! #{inspect(other)}")
        other

# do_api_request(...{stream: true}...):
      other ->
        Logger.error(
          "Unhandled and unexpected response from streamed post call. #{inspect(other)}"
        )

        {:error,
         LangChainError.exception(
           type: "unexpected_response",
           message: "Unexpected response",
           original: other
         )}

@brainlid
Copy link
Copy Markdown
Owner

Thanks @mweidner037! Sorry it took me so long to follow-up on this. I appreciate your contribution and work though!
❤️💛💙💜

@brainlid brainlid merged commit 425e54e into brainlid:main Feb 14, 2026
2 checks passed
brainlid added a commit that referenced this pull request Feb 14, 2026
- repairs issue introduced in PR #392
- adds additional error catch for something in the shape of {:error, thing} and tracking the "original" error info on the LangChainError
brainlid added a commit that referenced this pull request Feb 14, 2026
- repairs issue introduced in PR #392
- adds additional error catch for something in the shape of {:error, thing} and tracking the "original" error info on the LangChainError
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.

2 participants