jlewi/foyle

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.

image

image

image

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

  1. Create a markdown cell and enter the text "Fetch the hydros logs for the images"
  2. 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

image

Setp2: Fetch the hydros logs for the images"

image

Sorry your having trouble. To help troubleshoot this can you

  1. Open the developer tools console in your webbrowser
  2. Issue a generate command
  3. Collect any logs in the developer console

Upload the json logs from foyle.

  1. After you attempt to generate a request
  2. Shutdown the Foyle server
  3. 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.

Chrome browser logs
localhost-1715951210360_foyle.log

Foyle logs:
I did not find ~/foyle/raw

image

image

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.

console.error(`Generate request failed ${error}`);

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

  1. 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
  2. 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

const resp = agentpb.GenerateResponse.fromJson(data);

We don't properly handle Generate returning an error; #113