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

When CohereAPIError happens, error is not propagated to Jupyter AI, langchain is stuck in the loop #516

Open
andrii-i opened this issue Dec 12, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@andrii-i
Copy link
Collaborator

andrii-i commented Dec 12, 2023

Description

When CohereAPIError happens, error is not propagated to Jupyter AI, langchain is stuck in the loop

Reproduce

  1. Choose Cohere model, use bad API key
  2. Attempt to send a chat message
  3. Note that there is no response from Jupyternaut, note terminal error messages and server getting stuck in a loop
Current conversation:

Human: test

AI:
Retrying langchain.llms.cohere.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised CohereAPIError: invalid api token.
Retrying langchain.llms.cohere.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised CohereAPIError: invalid api token.
Retrying langchain.llms.cohere.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised CohereAPIError: invalid api token.

image

Expected behavior

Usual behavior: error is propagated to Jupyter AI, caught by ChatHandler, Jupyternaut sends error stack trace to user.

Tried implementing a workaround without success:

  1. handling exception via try-except cohere.CohereAPIError block to CohereProvider._acall()
  2. handling exception via try-except cohere.CohereAPIError in BaseProvider._generate_in_executor() and BaseProvider._call_in_executor()
@JasonWeill
Copy link
Collaborator

This is still an issue after recent revisions to the Cohere models in #584 and #594.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants