Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'NoneType' object has no attribute 'get' #89

Open
Failure404 opened this issue Nov 14, 2024 · 1 comment
Open

'NoneType' object has no attribute 'get' #89

Failure404 opened this issue Nov 14, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@Failure404
Copy link

Bug Description

I never had a problem with OpenAI as provider, but I recently switched to Gemini and now I get this error - but only like half of the time. Sometimes it works as it should, sometimes I get this error. I tried various things, ie changing the image entity to a static local file and changing some other settings. Nothing helped.
Any help would be appreciated.

Version:
1.3.1

Service Call

data:
provider: 01JBPX5M0TXYBYE9C9NVZ3BWWC
include_filename: true
detail: high
max_tokens: 100
temperature: 0.6
message: >-
Describe what you see
model: gemini-1.5-flash
target_width: 1280
image_entity:
- camera.yi_hack_a2_55e948_motion_detection_cam
response_variable: response
action: llmvision.image_analyzer

Logs

Error executing script. Unexpected error for if at pos 5: 'NoneType' object has no attribute 'get'

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 526, in _async_step
await getattr(self, handler)()
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 764, in _async_call_service_step
response_data = await self._async_run_long_action(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/script.py", line 727, in _async_run_long_action
return await long_task
^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2802, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2845, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llmvision/init.py", line 268, in image_analyzer
response = await client.make_request(call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llmvision/request_handlers.py", line 130, in make_request
response_text = await self.google(model=model, api_key=api_key)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/llmvision/request_handlers.py", line 312, in google
"content").get("parts")[0].get("text")
^^^
AttributeError: 'NoneType' object has no attribute 'get'

@Failure404 Failure404 added the bug Something isn't working label Nov 14, 2024
@valentinfrlch
Copy link
Owner

This might be related to #92.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants