-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add action template * Add permissions * Add variable * Add markdown fn and script * Fix gha * Formatting * Try require * Formatting * Try with secret * Debugging * Fix prompting * Cleanup * Fix markdown issue * Fix markdown * Switch back to DEBUG * Compress GIF
- Loading branch information
1 parent
6750693
commit 1c4ba74
Showing
9 changed files
with
81 additions
and
25 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: PromptTools | ||
|
||
on: | ||
# Trigger the workflow on push or pull request | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
comment: | ||
permissions: write-all | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out source repository | ||
uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python -m pip install flake8 pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Build prompttools | ||
run: | | ||
pip3 install . | ||
- name: Create markdown | ||
run: | | ||
DEBUG=1 python scripts/create_comment.py | ||
- name: Write comment | ||
uses: actions/github-script@v6 | ||
with: | ||
script: | | ||
const fs = require('fs') | ||
fs.readFile('./markdown.md', 'utf8', (err, data) => { | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: data | ||
}) | ||
}); |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from prompttools.experiment import OpenAIChatExperiment | ||
from prompttools.selector.prompt_selector import PromptSelector | ||
|
||
PROMPTTOOLS_MD_TMP = "markdown.md" | ||
|
||
selectors = [PromptSelector("You are a helpful assistant.", "Is 17077 a prime number?"), | ||
PromptSelector("You are a math tutor.", "Is 17077 a prime number?")] | ||
models = ["gpt-3.5-turbo", "gpt-4"] | ||
temperatures = [0.0] | ||
openai_experiment = OpenAIChatExperiment(models, selectors, temperature=temperatures) | ||
openai_experiment.run() | ||
|
||
markdown = openai_experiment.to_markdown() | ||
with open(PROMPTTOOLS_MD_TMP, "w") as f: | ||
f.write(markdown) |