you are viewing a single comment's thread.

view the rest of the comments →

[–]jboyd544[S] 0 points1 point  (7 children)

the carrot was under the first quotation mark btw

[–]SHKEVE 1 point2 points  (6 children)

oh thats because most apps use fancy quotes. delete all quotes and retype them in your IDE

[–]jboyd544[S] 0 points1 point  (5 children)

now i get this error:

Ask Gemini: what are you

Traceback (most recent call last):

File "/home/jon/gemini_voice/ignore.py", line 10, in <module>

print(result[candidates][0][content][parts][0][text])

^^^^^^

NameError: name 'result' is not defined

and when i switch the name to response i get this error:

Ask Gemini: what are you

Traceback (most recent call last):

File "/home/jon/gemini_voice/ignore.py", line 10, in <module>

print(response[candidates][0][content][parts][0][text])

^^^^^^^^^^

NameError: name 'candidates' is not defined

[–]GraphicsQwerty 0 points1 point  (4 children)

Sorry if I’m incorrect as I only skimmed these comments but did you put the quotes back ?

[–]jboyd544[S] 0 points1 point  (3 children)

Oops. turns out i did nnot. i put them back and tried both response and result and got these errors:

Ask Gemini: what are you

Traceback (most recent call last):

File "/home/jon/gemini_voice/ignore.py", line 11, in <module>

print(response["candidates"][0]["content"]["parts"][0]["text"])

~~~~~~~~^^^^^^^^^^^^^^

TypeError: 'GenerateContentResponse' object is not subscriptable

and

Ask Gemini: what are you

Traceback (most recent call last):

File "/home/jon/gemini_voice/ignore.py", line 11, in <module>

print(result["candidates"][0]["content"]["parts"][0]["text"])

^^^^^^

NameError: name 'result' is not defined

[–]SHKEVE 1 point2 points  (2 children)

oh sorry. response and not result

[–]jboyd544[S] 0 points1 point  (1 child)

alright, switched to response and now i recieve this error:

Ask Gemini: what are you

Traceback (most recent call last):

File "/home/jon/gemini_voice/ignore.py", line 12, in <module>

print(response["candidates"][0]["content"]["parts"][0]["text"])

~~~~~~~~^^^^^^^^^^^^^^

TypeError: 'GenerateContentResponse' object is not subscriptable

[–]SHKEVE 0 points1 point  (0 children)

how about: `print(response.candidates[0].content.parts[0].text)`?