-
Notifications
You must be signed in to change notification settings - Fork 37
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
Use system messages to shape the model output #38
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Prompt: Modify the Gpt4Service class. Add a new static method called systemMessages to Gpt4Service. The systemMessages method should return [{role: "system", content: "system" }] Modify the Gpt4Service.call method so that it appends the messages returned by Gpt4Service.systemMessages() in the call to openai.createChatCompletion Add tests for the changes to the Gpt4Service.call method in test/gpt4Service.test.js.
Prompt: Modify the Gpt4Service class. Add a second argument to Gpt4Service.call called "model". In Gpt4Service.call, pass the model argument to openai.createChatCompletion in place of the hardcoded string "gpt-4". Add tests for your changes in test/gpt4Service.test.js
Prompt: Modify the PluginService class. In the PluginService.executeMode() method, call Gpt4Service.call(prompt, model) if model equals "gpt4" or "gpt3" - don't use Gpt3Service. Add tests for your changes in test/pluginService.test.js
…API model param values Prompt: Modify the OpenAiGptService class. In the call() method, if model == "gpt3" then set model to "gpt-3.5-turbo" In the call() method, if model == "gpt4" then set model to "gpt-4" Add tests for your changes in test/OpenAiGptService.test.js Use sinon to assert that openai.createChatCompletion receives the correct model value
Prompt: Make the following changes to the OpenAiGptService.call() method: Add an argument called requestJsonOutput. The requestJsonOutput argument should have a default value of true. If requestJsonOutput is false then don't pass SystemMessage.systemMessages() into the call to openai.createChatCompletion Add tests for your changes in test/OpenAiGptService.test.js
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR modifies the way the prompt is sent to the OpenAI API. The "system" role is now used for messages related to model response formatting.
The bulk of this PR was implemented using Promptr. Take a look at the following commits to get a sense of what's possible. The commit messages include the prompt that was used to apply the changes: