When I run examples using different LLM models, I noticed that some models raise an error. For instance, using Google Gemini 2.5 to run coin_donation_game.py raises a TypeError: 'NoneType' object is not subscriptable in isek\agent\abstract_agent.py at line 102:
response = self.model.create( ... tool_schemas=tool_schemas or None, ).choices[0].message
Potential reason this error is happening:
The error occurs because the code assumes every model’s response always contains a .choices list with at least one element. However, some models like Google Gemini might return a different response structure or None for .choices, casing a TypeError when attempting to access .choices[0].message.
Thoughts on how to fix this bug:
We should not assume all models share the same response structure. Instead, the code should first validate the response object and its contents before accessing nested fields. Adding a response handler layer or interface to normalize and parse different model responses consistently could be a good approach to handle these variations safely.
Thanks for submitting this issue — great catch!
I‘m openning a feature request to support pluggable model adapters, enabling ISEK to work seamlessly with OpenAI, Google Gemini, Claude, etc.
When will this bug raise:
When I run examples using different LLM models, I noticed that some models raise an error. For instance, using Google Gemini 2.5 to run
coin_donation_game.py
raises aTypeError: 'NoneType' object is not subscriptable
inisek\agent\abstract_agent.py
at line 102:response = self.model.create( ... tool_schemas=tool_schemas or None, ).choices[0].message
Potential reason this error is happening:
The error occurs because the code assumes every model’s response always contains a
.choices
list with at least one element. However, some models like Google Gemini might return a different response structure orNone
for.choices
, casing aTypeError
when attempting to access.choices[0].message
.Thoughts on how to fix this bug:
We should not assume all models share the same response structure. Instead, the code should first validate the response object and its contents before accessing nested fields. Adding a response handler layer or interface to normalize and parse different model responses consistently could be a good approach to handle these variations safely.