sylvie-2024

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit b1bc9128c82e63a1c617e122627b06bac413868c
parent dff28b63cc32478f872f4e7349f0bc77a8474415
Author: khanumballz <[email protected]>
Date:   Sun, 19 May 2024 22:52:27 +1200

Chatterbot Ollama Hybrid Success

Diffstat:
Mpython/conversation/chatterbot/chatterbot_ollama.py | 27+++++++++++++++++++++++++--
Mpython/conversation/chatterbot/sylvie_db.sqlite3-shm | 0
Mpython/conversation/chatterbot/sylvie_db.sqlite3-wal | 0
Mpython/conversation/llama/tts_output.wav | 0
4 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/python/conversation/chatterbot/chatterbot_ollama.py b/python/conversation/chatterbot/chatterbot_ollama.py @@ -40,6 +40,15 @@ cbot = ChatBot( learning_mode = False ollama_mode = False +admin_name = "Princess Khan" +admin_pronoun = "She" + +user_prefix = "You are Sylvie Deane who is a cute librarian from French Polynesia. You are 33 years old. You were born on April 12th, in 1991. Your job is to chat with me, " + admin_name + ". We have only just met on Tinder, and we are not sure about each other yet. I asked you: \n" + admin_name + ": '" +user_suffix = "?' Now write a short and concise response in English. \n Sylvie Deane:" + +global_prefix = "" +global_suffix = "" + def get_feedback(): text = input() if 'yes' in text.lower(): @@ -80,11 +89,15 @@ def play_audio_file(audio_path): def ollama_get_text(ollama_prompt, max_attempts=3): attempt = 1 + + final_prompt = global_prefix + ollama_prompt + global_suffix + print("Final prompt:", final_prompt) + while attempt <= max_attempts: # Generate a response using the Ollama API ollama_stream = ollama.chat( - model='dolphin-phi2-usb', - messages=[{'role': 'user', 'content': ollama_prompt}], + model='phi3', + messages=[{'role': 'user', 'content': final_prompt}], stream=True, ) @@ -157,6 +170,16 @@ while True: print('Exiting Ollama mode.') ollama_mode = False continue + elif user_input.lower() == "enable prompt context": + print('Enabling the prompt context.') + global_prefix = user_prefix + global_suffix = user_suffix + continue + elif user_input.lower() == "disable prompt context": + print('Disabling the prompt context.') + global_prefix = "" + global_suffix = "" + continue if learning_mode: input_statement = Statement(user_input) diff --git a/python/conversation/chatterbot/sylvie_db.sqlite3-shm b/python/conversation/chatterbot/sylvie_db.sqlite3-shm Binary files differ. diff --git a/python/conversation/chatterbot/sylvie_db.sqlite3-wal b/python/conversation/chatterbot/sylvie_db.sqlite3-wal Binary files differ. diff --git a/python/conversation/llama/tts_output.wav b/python/conversation/llama/tts_output.wav Binary files differ.