Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Handle KeyError for 'completion' in ClaudeAdapter
In this commit, we've added error handling for scenarios where the key 'completion' is not present in the 'claude_response' dictionary. This exception was causing the program to crash when the application tried to access the 'completion' key in the 'claude_response' dictionary. Now, the 'get' method is used on the dictionary which allows the program to provide a default value of an empty string if the 'completion' key is not present. This prevents a KeyError from being raised and allows the program to continue execution. The affected methods are 'claude_to_chatgpt_response_stream' and 'claude_to_chatgpt_response'. This is an important fix that improves the robustness of the code by handling potential exceptions arising from unexpected data structures.
- Loading branch information