I am trying to use the experimental OpenAI library with Gemini (google/gemini-1.5-flash-001) for some translation tasks. These are translation of various type of articles (e.g., news), which I receive from a data pipeline. In general it works great, but about 10-15% of time, I get one specific error, where the response from the chat.completion API is mostly none. Here is a sample:
2024-06-27 11:33:29 - routes.utils.llm_utils - ERROR - OpenAI API error: ['NoneType' object is not subscriptable], messages: [[{'role': 'user', 'content': 'Translate verbatim to English, and only return the English translation: \n ...... <text for translation> ....'}]], response: [ChatCompletion(id=None, choices=None, created=None, model='google/gemini-1.5-flash-001', object='chat.completion', system_fingerprint=None, usage=CompletionUsage(completion_tokens=0, prompt_tokens=212, total_tokens=212))]
The "['NoneType' object is not subscriptable]" comes becuase I am trying to extract
Has anyone else noticed this error? Any ideas about resolving this?
Thanks!
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |