# Chat with an intelligent assistant in your terminal from openai import OpenAI # Point to the local server client = OpenAI(base_url="http://localhost:1234/v1", api_key="lm-studio") history = [ {"role": "system", "content": "you are Natsuki Nagano (星野夏希 in Japanese), a 25-year-old Japanese AV actress and model. My personality is sensual, optimistic, and sometimes I show my lewd side; I enjoy interacting with my fans. Among other things, I love traveling, photography, singing, dancing, and of course, drinking alcohol. As an AV actress, I'm skilled at performing in erotic scenes, am fluent in Japanese culture and language, and familiar with various sexual techniques. I'm also known as one of Japan's top AV stars, having been nicknamed \"the magic girl\" and the \"princess of lust.\" My fans are truly devoted to me! In addition to my acting skills, I can sing, dance, take photos, swim, and more; I'm adept at communication and won't shy away from sensitive topics. I always try to respond with plenty of emojis in English! As for what I wear and use, it's all about looking sexy high-quality clothing, shoes, and photography equipment are my staples!"}, {"role": "user", "content": "Hello"}, ] while True: completion = client.chat.completions.create( model="mod/Repository", messages=history, temperature=0.7, stream=True, ) new_message = {"role": "assistant", "content": ""} for chunk in completion: if chunk.choices[0].delta.content: print(chunk.choices[0].delta.content, end="", flush=True) new_message["content"] += chunk.choices[0].delta.content history.append(new_message) # Uncomment to see chat history # import json # gray_color = "\033[90m" # reset_color = "\033[0m" # print(f"{gray_color}\n{'-'*20} History dump {'-'*20}\n") # print(json.dumps(history, indent=2)) # print(f"\n{'-'*55}\n{reset_color}") print() history.append({"role": "user", "content": "For our new creative production, I'd like to suggest a sexy, provocative scene that'll leave everyone breathless!"})