Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate a completion failing because of invalid openai api key #109

Closed
menithya opened this issue May 16, 2024 · 8 comments
Closed

Generate a completion failing because of invalid openai api key #109

menithya opened this issue May 16, 2024 · 8 comments

Comments

@menithya
Copy link

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.

@jlewi
Copy link
Owner

jlewi commented May 16, 2024

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"

@jlewi jlewi changed the title Issue with Installation. How to generate a completion May 16, 2024
@menithya
Copy link
Author

menithya commented May 17, 2024

Thank you @jlewi I followed your suggesion

Step 1: select Foyle generate a completion

image

Setp2: Fetch the hydros logs for the images"

image

@jlewi
Copy link
Owner

jlewi commented May 17, 2024

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.

@menithya
Copy link
Author

Chrome browser logs
localhost-1715951210360_foyle.log

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

image

image

@jlewi
Copy link
Owner

jlewi commented May 17, 2024

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.

@menithya
Copy link
Author

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

@jlewi
Copy link
Owner

jlewi commented May 19, 2024

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

@jlewi
Copy link
Owner

jlewi commented May 22, 2024

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

@jlewi jlewi closed this as completed May 22, 2024
@jlewi jlewi changed the title How to generate a completion Generate a completion failing because of invalid openai api key May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants