Closed nitaicharan closed 2 months ago
For what it's worth: I ran into this error too, in my case it was because the string for openai_api_key
provided via an external program contained a trailing newline.
I'm also having this issue, and I've double checked my api key. Could it have to do with an incompatibility with openai's move to project-based api keys?
I made it work by:
This issue does not seem to be related to the plugin. As a result, I will be closing this issue.
Just adding to it in case someone hits the same issue, the latest version supports sensitive logging
-- log file location
log_file = vim.fn.stdpath("log"):gsub("/$", "") .. "/gp.nvim.log",
-- write sensitive data to log file for debugging purposes (like api keys)
log_sensitive = false,
when enabled, the :GpInspectLog
will show log full curl commands run against providers, such as:
[2024-07-30.08-24-30.212] [284dedb7] DEBUG: [SENSITIVE DATA] vault get_secret openai_api_key: "sk-..."
[2024-07-30.08-24-30.212] [284dedb7] DEBUG: [SENSITIVE DATA] run command: curl --no-buffer -s https://api.openai.com/v1/chat/completions -H Content-Type: application/json -d {"model":"gpt-4o","top_p":1,"temperature":1.1,"messages":[{"content":"You are a general AI assistant.\n\nThe user provided the additional info about how they would like you to respond:\n\n- If you're unsure don't guess and say you don't know instead.\n- Ask question if you need clarification to provide better answer.\n- Think deeply and carefully from first principles step by step.\n- Zoom out first to see the big picture and then zoom in to details.\n- Use Socratic method to improve your thinking and coding skills.\n- Don't elide any code from your output if the answer requires coding.\n- Take a deep breath; You've got this!","role":"system"},{"content":"Hello there.","role":"user"}],"stream":true} -H Authorization: Bearer sk-... -H api-key: sk-...
[2024-07-30.08-24-30.216] [284dedb7] DEBUG: [SENSITIVE DATA] curl command started with pid: 2636159
[2024-07-30.08-24-37.711] [284dedb7] DEBUG: [SENSITIVE DATA] vault get_secret openai_api_key: "sk-..."
[2024-07-30.08-24-37.711] [284dedb7] DEBUG: [SENSITIVE DATA] run command: curl --no-buffer -s https://api.openai.com/v1/chat/completions -H Content-Type: application/json -d {"model":"gpt-4o","top_p":1,"temperature":1.1,"messages":[{"content":"You are a general AI assistant.\n\nThe user provided the additional info about how they would like you to respond:\n\n- If you're unsure don't guess and say you don't know instead.\n- Ask question if you need clarification to provide better answer.\n- Think deeply and carefully from first principles step by step.\n- Zoom out first to see the big picture and then zoom in to details.\n- Use Socratic method to improve your thinking and coding skills.\n- Don't elide any code from your output if the answer requires coding.\n- Take a deep breath; You've got this!","role":"system"},{"content":"Hello there.","role":"user"},{"content":"Hello! How can I assist you today? Is there something specific you're working on or something you'd like to know more about?","role":"assistant"},{"content":"Summarize the topic of our conversation above in two or three words. Respond only with those words.","role":"user"}],"stream":true} -H Authorization: Bearer sk-... -H api-key: sk-...
(Just be careful not posting your secret keys, I've redacted them manually in the example).
Hello guys, I'm finding an issue when I submit my question using
GpChatNew
. It was working like a charm but know it is outputting the following message:Following the
GpInspectPlugin
:Following
checkhealth
: