You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My high-level thought is that while this is a good starting point, this strategy is a little unintuitive. It requires manually detecting and handling API key exceptions. In the future, we should probably wrap the LangChain methods in an exception handler that raises some custom ApiKeyInvalid exception in this case. That way, we show the same error message in magics and in chat.
@dlqqq Looked a little bit into this suggestion. Each LLM raises API key error in its own way using different error types and error messages. Exception handler that would wrap the LangChain methods and would raise some custom ApiKeyInvalid exception would still need to detect that exception is an API key error "manually".
For example, below is how we could wrap langchain methods that throw API key errors, get_llm_chain and self.llm_chain.apredict of DefaultChatHandler.process_message. Note that self.is_api_exception(e) or some other form of "manual" detection is still needed for API error identification which makes this approach less of an improvement. What do you think?
Problem
API key error handling can be further improved:
Originally posted by @dlqqq in #513 (comment)
Proposed solution
Implement API key error handling as described above.
The text was updated successfully, but these errors were encountered: