Skip to content

Commit

Permalink
Merge branch 'dev' into feature/tts
Browse files Browse the repository at this point in the history
  • Loading branch information
ndjenkins85 committed Jul 16, 2023
2 parents 4e54484 + 6f78c00 commit 8d11f61
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 11 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,12 @@ Follow the [Instructions for developers](#instructions-for-developers) to set up
MacOS requirements:

- Python 3.8
- pyaudio
- ffmpeg for mp3 text-to-speech, `brew install ffmpeg`

```
brew install portaudio
```

Note: Instructions marked with %% are not functioning and are for demo purposes only.

Expand Down
4 changes: 3 additions & 1 deletion afkode/action.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ def collate_and_choose_command(self, command_candidate: str) -> None:
options = utils.get_formatted_command_list()

# Get our command prompt
choose_command_prompt = Path(utils.get_prompt_path(), "programflow", "choose_command.txt").read_text()
choose_command_prompt = Path(utils.get_prompt_path(), "programflow", "choose_command.txt").read_text(
encoding="utf-8"
)

choose_command_request = (
choose_command_prompt + "\nUser input:" + command_candidate + f"\n{'-'*20}Options:\n" + options
Expand Down
2 changes: 1 addition & 1 deletion afkode/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def whisper(path: str) -> str:
# Whisper is prone to hallucinations, so we suppress known hallucination outputs
# They aren't really a problem at least in the longer transcripts, but they mess up the logging
hallucinations_path = Path(utils.get_base_path(), "afkode", "prompts", "debug", "whisper_hallucinations.txt")
hallucinations = hallucinations_path.read_text().split("\n")
hallucinations = hallucinations_path.read_text(encoding="utf-8").split("\n")
if transcript in hallucinations:
logging.debug("Hallucination detected")
transcript = ""
Expand Down
2 changes: 1 addition & 1 deletion afkode/commands/suggest_program_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def execute(not_used: str) -> str:
Returns:
Chatgpt reponse
"""
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_actions.txt").read_text()
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_actions.txt").read_text(encoding="utf-8")

readme = meta.get_formatted_readme()
run = meta.clean_py(Path(utils.get_base_path(), "afkode", "run.py").read_text(encoding="utf-8"))
Expand Down
4 changes: 3 additions & 1 deletion afkode/commands/suggest_program_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def execute(not_used: str) -> str:
Returns:
Chatgpt reponse
"""
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_functionality.txt").read_text()
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_functionality.txt").read_text(
encoding="utf-8"
)

readme = meta.get_formatted_readme()

Expand Down
4 changes: 3 additions & 1 deletion afkode/commands/suggest_program_improvements.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ def execute(not_used: str) -> str:
Returns:
Chatgpt reponse
"""
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_improvements.txt").read_text()
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_improvements.txt").read_text(
encoding="utf-8"
)

readme = meta.get_formatted_readme()

Expand Down
2 changes: 1 addition & 1 deletion afkode/commands/suggest_program_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def execute(not_used: str) -> str:
Returns:
Chatgpt reponse
"""
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_tests.txt").read_text()
program_commands_prompt = Path(utils.get_prompt_path(), "debug", "program_tests.txt").read_text(encoding="utf-8")

readme = meta.get_formatted_readme()

Expand Down
2 changes: 1 addition & 1 deletion afkode/commands/summarize_filename.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def execute(transcript: str) -> str:
Returns:
Chatgpt response, limited to four words
"""
prompt = Path(utils.get_prompt_path(), "programflow", "proposed_filename.txt").read_text()
prompt = Path(utils.get_prompt_path(), "programflow", "proposed_filename.txt").read_text(encoding="utf-8")
request = prompt + "\n\n--------- Here is the user input:\n" + transcript

logging.debug(request)
Expand Down
1 change: 1 addition & 0 deletions afkode/prompts/debug/whisper_hallucinations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@ Well...
ah
Uh...
Oh.
Thank you so much for watching!
6 changes: 3 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ PyAudio = "^0.2.13"
PyYAML = "^6.0"
pydub = "^0.25.1"
gTTS = "^2.3.2"

google-auth = "2.22.0"
requests = "^2.23.0"
requests_toolbelt = "^1.0.0"
urllib3 = "1.26.16"
Expand Down Expand Up @@ -73,6 +73,7 @@ ipykernel = "^6.23.1"
ipython = "7.23.1"
traitlets = "^5.9.0"
jupyter = "^1.0.0"
lxml = "4.9.2"
nox = "^2023.04.22"
pre-commit = "^2.15"
MarkupSafe = "^2.0.1"
Expand Down

0 comments on commit 8d11f61

Please sign in to comment.