[bug]: hook example `GpCodeReview` sends to wrong endpoint
kunzaatko opened this issue · 0 comments
kunzaatko commented
The hook calls get_chat_agent()
. With get_command_agent()
it works correctly but when using Prompt
, it calls the wrong endpoint. Even though, I am using claude sonnet, I am getting the response from the openai endpoint.
Here is the error:
Gp: openai response is empty:
'{\n "error": {\n "message": "The model `claude-3-5-sonnet-20240620` does not exist or you do not have access to it.",\n "type": "invalid_request_error",
\n "param": null,\n "code": "model_not_found"\n }\n}\n'
Here is the reference hook from the README:
-- GpCodeReview: Review the provided selection/range
CodeReview = function(gp, params)
local agent = gp.get_chat_agent()
local template = 'I have the following code from {{filename}}:\n\n'
.. '```{{filetype}}\n{{selection}}\n```\n\n'
.. 'Please analyze for code smells and suggest improvements.'
gp.Prompt(params, gp.Target.enew 'markdown', nil, agent.model, template, agent.system_prompt)
end,
Note that the same problem is with GpExplain
.
I would try to debug myself, but I am not sure what the intention is for get_command_agent
and get_chat_agent
and whether the latter should be used in some hooks...