-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feat/open ai gateway #150
Feat/open ai gateway #150
Conversation
c.cassette_library_dir = "spec/cassettes" | ||
c.hook_into :webmock | ||
c.configure_rspec_metadata! | ||
c.filter_sensitive_data('<OPENAI_API_KEY>') { Rails.application.credentials.dig(:open_ai, :key) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for ensuring the key is redacted from the cassettes ❤️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to get it to return data. Its saying I need to provide an API key. Should that be the case?
Have you added the master.key file yet? If not, I expect that would resolve the issue for you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything here looks really great.
Could someone add a line to the README to give instructions on installing a BE yml for OpenAI so everyone doesn't need to go to their docs?
|
||
def build_prompt(description) | ||
"Please generate 10 practice interview questions based on the following job description: #{description}. | ||
ONLY return a JSON array of strings containing the questions, with no additional formatting or object keys." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is built really cleanly. Easy to follow logic. Easy to follow errors.
I tried your prompt in ChatGPT and got 10 really good responses, so I think the wording should work great.
|
||
expect(response[:success]).to eq(false) | ||
expect(response[:error]).to include("An error occurred: Something went wrong") | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing looks really thorough. I went through you object and line coverage looks great.
sent the master.key in dm then deleted the dm |
I think we'll add info to the readme as part of Kaelin's work that finishes the backend implementation, we'll be able to be more complete when that is finished |
I got together with wally and get it running on my end. Thanks for the tip! |
Sounds good. Approving now |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am trying to get it to return data. Its saying I need to provide an API key. Should that be the case?
*Update: I got it working. This all looks great.
expect(gateway_response[:data][2]).to eq("How do you approach writing clean and maintainable code?") | ||
end | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice comprehensive testing. I can't think of edge cases that you aren't covering.
{ success: false, error: "An error occurred: #{error.message}" } | ||
|
||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got it to pull down sample interview questions, after a little issue on my end with the key. Great job!
Notes
This adds several gems and updates the credentials file. Pulling this down you will need to do a bundle install and get the updated master key from @epintozzi .
Type of Change
Description
This adds a gateway for our application to make a call to openai's api to generate practice interview questions for a given job description.
Motivation and Context
This opens up our application to be able to make calls to openai so that that information can be provided to the front-end to display to the user. This is a sub-issue of the larger epic to make use of those here:
#142
Related Tickets
closes #145
Screenshots (if appropriate):
Added Test?
Checklist: