Generate a completion failing because of invalid openai api key
Closed this issue · 8 comments
Hi
Followed below document, downloaded
foyle_0.0.9_darwin_amd64
https://foyle.io/docs/getting-started/
I am able to run the server. However, I am getting no suggestion when I type below commands.
it is good to update prerequisite document for the installation.
How did you try to generate a suggestion?
To generate a suggestion you need to invoke command "Foyle Generate a completion" you can do this by
- Open the command pallet and search for Foyle generate a completion
- Use the shortcut key:
“win;” - on windows
“cmd;” - on mac
Based on your screen shot it looks like you entered natural language - "fetch the hdro logs for the images" in a code cell and then tried to execute a code cell. So the exitCode - "-1" indicates an error because its not a valid command.
So what you probably meant to do is
- Create a markdown cell and enter the text "Fetch the hydros logs for the images"
- Generate a completion by running the command "Foyle Generate a completion"
Thank you @jlewi I followed your suggesion
Step 1: select Foyle generate a completion
Setp2: Fetch the hydros logs for the images"
Sorry your having trouble. To help troubleshoot this can you
- Open the developer tools console in your webbrowser
- Issue a generate command
- Collect any logs in the developer console
Upload the json logs from foyle.
- After you attempt to generate a request
- Shutdown the Foyle server
- Upload the JSON logs in ~/.foyle/raw
The screenshot you provided earlier doesn't show a generate request being sent. So I'd like to look at the logs in the case where you do generate a completion to see if a generate request actually gets sent. That will help us narrow down the problem.
Foyle's logs are in the directory ${HOME}/.foyle/raw
. It looks like you are looking for them in the directory where you have cloned the Foyle repository.
Your chrome logs don't indicate a request having been sent to the Foyle server. There should be a message logging whether the request succeeded or failed; you can see that here.
foyle/frontend/foyle/src/web/generate.ts
Line 56 in cd45da7
Can you please retry running the command?
Right now I can't see anything obviously wrong; other than the command didn't get invoked. It seems like your able to execute cells so the frontend is able to send RPCs to the backend. If its not a fluke then we may need to add more instrumentation to figure out where the problem is.
Looks like installation problem for me. After rectifying same issue exist.
To install I did this.
# Make the file executable
chmod +x foyle_0.0.9_darwin_arm64
# Move the file to /usr/local/bin
sudo mv foyle_0.0.9_darwin_arm64 /usr/local/bin/foyle
# Run the program
foyle
foyle_chrom_console.log
logs
foyle.logs.2024-05-18T09:15:46.json
I didn't quite understand your last message. What's the connection between installation and the issue you are having?
For some reason a generate request isn't being sent and its not clear why. Is it possible that you aren't actually invoking the command to generate a completion?
There's two things we can do here
- We can hop on a call to try to debug this together ; shoot me an email at jeremy@lewi.us and we can arrange for a time
- Wait for a future release with additional instrumentation to try to debug
So we troubleshooted this and there was a couple things going on.
The root problem was OpenAI was returning 429. This appeared to happen because the account had no credits and no payment method. Using a valid OpenAI API key solved this problem. Filed #82.
A second problem is that if Foyle returns an error; the frontend logs a JSON deserialization error about the code field missing. This is a bug in our response processing code here
foyle/frontend/foyle/src/web/client.ts
Line 45 in fe1bf81
We don't properly handle Generate returning an error; #113