momaabna/QGPTAgent

Python error

Closed this issue · 4 comments

Dear momaabna,
Python error - QGPT Agent.txt

When I try to run the QGIS plugin I get a Python error. Please see the message in the attached file. How should I fix this?

Thank you!

Kind regards,
Johan

fuzsin commented

Same here. Win10Pro (64), QGIS 3.30.2-'s-Hertogenbosch, Python-Version 3.9.5:

WARNING    Traceback (most recent call last):
File "C:\Users/<user>/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgpt_agent_release\qgpt_agent_dockwidget.py", line 187, in send
self.worker.run()

File "C:\Users/<user>/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgpt_agent_release\qgpt_agent_dockwidget.py", line 106, in run
completion =get_completion(self.prompt, self.api_key,self.temprature)

File "C:\Users/<user>/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgpt_agent_release\qgpt_agent_dockwidget.py", line 90, in get_completion
completion = response.json()['choices'][0]['text']
KeyError: 'choices'

Greetings
fuzsin

Check

  • internet connection
  • openai API key
  • your balance in openai
    This error will be handled in the next version.
fuzsin commented
  • your balance in openai

Do I need a pro account for the plugin to work?

Actually, openai plan is pay-as-you-go. You can use a free trial or pay for it.