r2ai icon indicating copy to clipboard operation
r2ai copied to clipboard

r2ai C cannot change model without restarting r2

Open cryptax opened this issue 7 months ago • 1 comments

I start the analysis of a binary (r2 ./binary) and use, let's say chatgpt:

r2ai -e api=openai
r2ai -e model=gpt-4o-mini

I ask a question, like r2 -a decompile the function that uses sockets. It begins and issues a command afl~socket but I decide I don't want to use gpt-4o-mini but something else, so I cancel the execution.

[0x00001350]> afl~socket
afl~socket


gpt-4o-mini | total: 29515 in: 29480 out: 35 | run: 14780 in: 14763 out: 17 | 10s / 25s

[r2cmd]> 
^C
[0x00001350]> 
INFO: Command execution cancelled 

I change the model to another one, and ask a new question. There's an error contacting the new model.

[0x00001350]> r2ai -e api=mistral
[0x00001350]> r2ai -e model=mistral-large-latest
[0x00001350]> r2ai -a decompile the main
[r2cmd]> 
[0x00001350]> afl~main
afl~main

0x00000ef0   33   1116 main

INFO: Retrying request (1/10) after failure...
INFO: Retrying request (2/10) after failure...
^CERROR: OpenAI API error 404

I am unsure if the error comes from the fact I change from a model to another one, or if the error comes from the fact I canceled a request and it doesn't like it.

cryptax avatar Apr 11 '25 08:04 cryptax