python-docs-samples icon indicating copy to clipboard operation
python-docs-samples copied to clipboard

Generative AI - Function Calling sample's test fails Infrequent

Open msampathkumar opened this issue 1 year ago • 0 comments

Infrequent, I seen the following error for other Generative code samples. Raising a bug request on this.

_________________________ test_function_calling_config _________________________
Traceback (most recent call last):
  File "/workspace/generative_ai/.nox/py-3-11/lib/python3.11/site-packages/_pytest/runner.py", line 341, in from_call
...
...
...
  File "/workspace/generative_ai/function_calling/chat_function_calling_test.py", line 41, in test_function_calling_config
    response = chat_function_calling_config.generate_text()
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/generative_ai/function_calling/chat_function_calling_config.py", line 80, in generate_text
    print("Function:", response.choices[0].message.tool_calls[0].id)
                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable

Originally posted by @msampathkumar in https://github.com/GoogleCloudPlatform/python-docs-samples/issues/12644#issuecomment-2386390934

msampathkumar avatar Oct 01 '24 15:10 msampathkumar