Skip to content

Commit

Permalink
Keep dots
Browse files Browse the repository at this point in the history
  • Loading branch information
mariabohorquez authored Oct 29, 2023
1 parent d87156f commit 8c43c43
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/routes/dialogue.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def get_openai_lines(prompt: str):
temperature=0.8,
)

lines = [re.sub(r"[^a-zA-Z0-9 ']", '', item.strip()) for item in response.choices[0].message.content.split("\n") if item != ""]
lines = [re.sub(r"[^a-zA-Z0-9 '.]", '', item.strip()) for item in response.choices[0].message.content.split("\n") if item != ""]

return DialogueResponse(
lines=lines
Expand All @@ -45,7 +45,7 @@ def get_llama_lines(prompt: str):
response = [item for item in response if item != ""]
response = "".join(response).split("\n")
# Llama needs some cleaning up for the response, very difficult to remove via prompt.
response = [re.sub(r"[^a-zA-Z0-9 ']", '', item[2:].strip()) for item in response if item != ""]
response = [re.sub(r"[^a-zA-Z0-9 '.]", '', item[2:].strip()) for item in response if item != ""]
response.pop(0)
return DialogueResponse(lines=response)

Expand Down

0 comments on commit 8c43c43

Please sign in to comment.