momaabna / QGPTAgent

The QGPT Agent is a powerful plugin for QGIS that utilizes the advanced natural language processing capabilities of the OpenAI GPT model to automate various processes in QGIS. With this plugin, users can interact with the QGIS software using natural language commands, significantly reducing the time and effort required to complete various tasks.
77 stars 7 forks source link

Key Error #8

Open geojochen opened 1 year ago

geojochen commented 1 year ago

I am getting a KeyError: 'choices' error when I send off a request. This is for both Chat as well as Agent mode. What am I supposed to enter under User Name in the Settings? plugins\qgpt_agent_release\qgpt_agent_dockwidget.py", line 90, in get_completion completion = response.json()['choices'][0]['text'] KeyError: 'choices'

momaabna commented 1 year ago

Apparently, that is because the plugin cannot connect to Openai API, Update to the last version Check

Check this tutorial that shows the installation process

https://www.youtube.com/watch?v=OkYSWwpduiw

If the error still exists submit it here witing to hear from you

geojochen commented 1 year ago

Hello Mohammed: I did watch the video and tried everything you mention on your GitHub site. I installed the latest version of the plugin yesterday and created also yesterday the API key, which I then inserted into your plugin settings form. As I mentioned, I am not sure what the user name is for. As I created the API key only yesterday, I still have 100% of my allotted balance in my OpenAI account.

I also asked a colleague to test the plugin. He did not encounter the key error that I still get but this is what he experienced:

I noticed that whenever I closed qgis (I'm still using version 3.28.3), I would have to reenter my openAI key. Additionally, nothing happened when I checked the option for the QGIS agent to show me the code directly. I keep getting this python error whenever I try to work within the layers - ie filter out the country like on the doc or remove certain layers. 2023-05-06T16:11:41 WARNING Traceback (most recent call last): File "C:\Users/Test/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\qgpt_agent_release\qgpt_agent_dockwidget.py", line 355, in debug_code code = completion.split('[[[')[2].split(']]]')[0] IndexError: list index out of range

Cheers, Jochen

On Sun, May 7, 2023 at 8:45 AM Mohammed Mahmood @.***> wrote:

Apparently, that is because the plugin cannot connect to Openai API, Update to the last version Check

  • Internet Connection
  • OpenAI API Key
  • Your Balance In OpenAI Account

Check this tutorial that shows the installation process

https://www.youtube.com/watch?v=OkYSWwpduiw

If the error still exists submit it here witing to hear from you

— Reply to this email directly, view it on GitHub https://github.com/momaabna/QGPTAgent/issues/8#issuecomment-1537433214, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZUGEIXP33TTFGCZNGSBJ3XE6KPXANCNFSM6AAAAAAXYGNE3U . You are receiving this because you authored the thread.Message ID: @.***>

momaabna commented 1 year ago

Have You clicked set token button in setting tab ?

momaabna commented 1 year ago

The user name is only to show in the chat box nothing more.

geojochen commented 1 year ago

[image: image.png]

[image: image.png]

[image: image.png]

On Sun, May 7, 2023 at 11:44 AM Mohammed Mahmood @.***> wrote:

The user name is only to show in the chat box nothing more.

— Reply to this email directly, view it on GitHub https://github.com/momaabna/QGPTAgent/issues/8#issuecomment-1537473466, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZUGEJU5ETYC6E4VBADZMDXE67ONANCNFSM6AAAAAAXYGNE3U . You are receiving this because you authored the thread.Message ID: @.***>