JusticeRage / Gepetto

IDA plugin which queries uses language models to speed up reverse-engineering
GNU General Public License v3.0
2.81k stars 260 forks source link

Update to current openai module version #30

Closed melomac closed 9 months ago

melomac commented 10 months ago

Many thanks for sharing Gepetto with the community, and many thanks for adopting GPT-4-turbo so quickly!

I am super excited with AI these days, up to the point I ended up updating openai module to realize Gepetto relies on openai<1.0 when current version is 1.2.4.

And it turns out ChatCompletion got decommissioned during release 1.0, and this change also breaks your method to load the API key at startup 😬

Would you please be so kind to consider updating the OpenAI code?

JusticeRage commented 10 months ago

Thanks for letting me know! I'll work on an update as soon as I have some free time (which may take a couple of weeks...).

jibanes commented 10 months ago

I think I'm running into the same issue, namely:

Traceback (most recent call last):
  File "/usr/lib/python3.11/threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.11/threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/ida/plugins/gepetto/models/openai.py", line 40, in query_model
    except openai.InvalidRequestError as e:
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'openai' has no attribute 'InvalidRequestError'. Did you mean: 'BadRequestError'?

Looking forward to the upgrade!

MamonthPenis commented 9 months ago

Same: self._target(*self._args, **self._kwargs) File "C:\Program Files/IDA Pro 7.5/plugins\gepetto\models\openai.py", line 40, in query_model except openai.InvalidRequestError as e: AttributeError: module 'openai' has no attribute 'InvalidRequestError

JusticeRage commented 9 months ago

Hi everyone! I've found some time to work on this, things should be resolved now! Let me know if this works for you, and if it does I'll tag the release.

melomac commented 9 months ago

This works just great on a test binary with current IDA Pro with Hex-Rays, current openai (v1.5) and the gpt-4 preview model, many thanks!