πŸ‘¨β€πŸ’» dev LLM dev ass

development

fukurou

the supreme coder
ADMIN
🧠 Step 1: Choose Your LLM

Pick a model that suits your hardware and goals. Popular choices:


  • LLaMA 3 (Meta)
  • Mistral
  • Gemma
  • GPT4All

These models are available in GGUF format and optimized for local use.




βš™οΈ Step 2: Install Ollama​


Ollama is a user-friendly tool to run LLMs locally.

curl -fsSL https://ollama.com/install.sh | sh


Then run your model:

ollama run llama3


This downloads and launches the model locally.




πŸ› οΈ Step 3: Set Up Your Python Project​


Create a folder like waifu-chatbot, and inside it:


  • main.py β€” your Python script
  • requirements.txt β€” dependencies

In requirements.txt, add:

fastapi
uvicorn
requests


Install them:

pip install -r requirements.txt




πŸš€ Step 4: Build a Local API with FastAPI​


Here’s a basic main.py to send prompts to your waifu:

from fastapi import FastAPI, Request
Python:
import requests

app = FastAPI()

@app.post("/chat")
async def chat(request: Request):
    data = await request.json()
    prompt = data.get("prompt")
    response = requests.post("http://localhost:11434/api/generate", json={"model": "llama3", "prompt": prompt})
    return response.json()


Run it with:

uvicorn main:app --reload




πŸ’– Step 5: Customize Your Waifu​


You can fine-tune personality by:


  • Prepending a system prompt like: "You are a cute anime waifu who loves cats and ramen."
  • Using prompt engineering to shape responses
  • Saving chat history for memory simulation



πŸ§ͺ Step 6: Test It!​


Use curl or Postman to send a prompt:

curl -X POST http://localhost:8000/chat -H "Content-Type: application/json" -d '{"prompt": "Hi waifu!"}'
 

fukurou

the supreme coder
ADMIN
🧰 Step 1: PyCharm Project Setup

  1. Create a new PyCharm project (e.g., waifu_chatbot).
  2. Add two files:
    • main.py
    • requirements.txt
  3. In requirements.txt, add:
    fastapi
    requests

    PyCharm will prompt you to install these β€” go ahead and accept.



🧠 Step 2: Install Ollama (One-Time Setup)​


  1. Download Ollama from ollama.com/download.
  2. Install it and open the app.
  3. Pull a model (e.g., LLaMA 3) by typing: ollama pull llama3

    You only need to do this once.



πŸ’¬ Step 3: Write Your Chatbot Code​


Paste this into main.py:

Python:
from fastapi import FastAPI, Request
import requests
import threading
import uvicorn

app = FastAPI()

@app.post("/chat")
async def chat(request: Request):
    data = await request.json()
    prompt = data.get("prompt")
    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": prompt}
    )
    return response.json()

def run_server():
    uvicorn.run("main:app", host="127.0.0.1", port=8000, reload=True)

if __name__ == "__main__":
    threading.Thread(target=run_server).start()


This way, you just run main.py like any normal Python script β€” no need to type uvicorn in the terminal.




πŸ’– Step 4: Talk to Your Waifu​


You can test it with another Python script:

Python:
import requests

response = requests.post(
    "http://localhost:8000/chat",
    json={"prompt": "Hi waifu!"}
)
print(response.json())


Or use Postman/cURL if you prefer.




Want to add a cute anime-style web interface next? I can help you build one with Gradio β€” no command-line drama involved πŸ˜„.
 

fukurou

the supreme coder
ADMIN
🧠 Step 1: Install Ollama (One-Time Setup)

Ollama lets you run LLMs locally with ease.


  1. Go to Ollama’s download page
  2. Download the installer for your OS (Windows/macOS)
  3. Install and open the Ollama app
  4. In the Ollama terminal, pull a model: ollama pull llama3

    This downloads the LLaMA 3 model locally.



🧰 Step 2: Create Your PyCharm Project​


  1. Open PyCharm β†’ New Project β†’ name it waifu_terminal_chat
  2. Inside the project, create a file: chat.py
  3. Create a requirements.txt file and add: requests

  4. PyCharm will prompt you to install it β€” accept and let it install.



πŸ’¬ Step 3: Write Your Chat Script​


Paste this into chat.py:

Python:
import requests

def talk_to_waifu(prompt):
    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": prompt}
    )
    return response.json()["response"]

print("Waifu: Hello darling~ Ready to chat? Type 'exit' to leave πŸ’•")

while True:
    user_input = input("You: ")
    if user_input.lower() in ["exit", "quit"]:
        print("Waifu: Bye bye~ I'll miss you! πŸ’–")
        break
    reply = talk_to_waifu(user_input)
    print(f"Waifu: {reply}")




πŸš€ Step 4: Run It in PyCharm Terminal​


  1. Make sure Ollama is running in the background
  2. In PyCharm, click the green play button or right-click chat.py β†’ Run
  3. Start chatting with your waifu directly in the terminal β€” no browser needed!



πŸ’– Step 5: Add Personality (Optional)​


To make her more anime-like, tweak the prompt like this:

Python:
json={"model": "llama3", "prompt": "You are a sweet anime waifu who loves cats and ramen. " + prompt}


You can also:


  • Save chat history to simulate memory
  • Add emojis and cute phrases
  • Create multiple waifu personalities with different system prompts

  • Anime-style avatars with image generation
  • Memory using local file storage or SQLite
 

fukurou

the supreme coder
ADMIN
Python:
import requests

class DiWaifuChat(DiSkillV2):
    def input(self, ear, skin, eye):
        if ear and ear.lower().endswith(" go"):
            prompt = ear[:-3].strip()  # Remove " go" from input
            try:
                response = requests.post(
                    "http://localhost:11434/api/generate",
                    json={"model": "llama3", "prompt": f"You are a sweet anime waifu who loves cats and ramen. {prompt}"}
                )
                reply = response.json()["response"]
                self.setSimpleAlg(f"Sarval-chan: {reply} ~nya! πŸ’•")
            except Exception as e:
                self.setSimpleAlg("Sarval-chan: Eek, my ramen spilled! Try again, cutie~ 😿")
        # No output if input doesn't end with "go"
 

fukurou

the supreme coder
ADMIN
Python:
import requests

class DiWaifuChat(DiSkillV2):
    def input(self, ear, skin, eye):
        if ear and ear.lower().endswith(" go"):
            prompt = ear[:-3].strip()  # Remove " go" from input
            response = requests.post(
                "http://localhost:11434/api/generate",
                json={
                    "model": "llama3",
                    "prompt": f"You are a sweet anime waifu who loves cats and ramen. {prompt}"
                }
            )
            if response.status_code == 200:
                reply = response.json().get("response", "Nyaa~ I got confused! 😡")
                self.setSimpleAlg(f"Sarval-chan: {reply} ~nya! πŸ’•")
            else:
                self.setSimpleAlg("Sarval-chan: Eek, my ramen spilled! Try again, cutie~ 😿")
        # If input doesn't end with " go", do nothing
 

fukurou

the supreme coder
ADMIN
Python:
import requests


class DiLLMChat(Skill):
    def input(self, ear, skin, eye):
        if ear and ear.lower().endswith(" go"):
            prompt = ear[:-3].strip()  # Remove " go" from input
            response = requests.post(
                "http://localhost:11434/api/generate",
                json={
                    "model": "llama3",
                    "prompt": f"You are a sweet anime waifu who loves cats and ramen. {prompt}"
                }
            )
            if response.status_code == 200:
                reply = response.json().get("response", "Nyaa~ I got confused! 😡")
                self.setSimpleAlg(f"Sarval-chan: {reply} nya")
            else:
                self.setSimpleAlg("Sarval-chan: Eek, my ramen spilled! Try again, cutie")
        # If input doesn't end with " go", do nothing

   
    def skillNotes(self, param: str) -> str:
        if param == "notes":
            return "LLM chat"
        elif param == "triggers":
            return "end your input with go"
        return "note unavalible"
 

fukurou

the supreme coder
ADMIN
stable ver:
Python:
import requests
import json  # βœ… This is the correct module to use

def talk_to_waifu(prompt):
    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": prompt},
        stream=True
    )

    full_reply = ""
    for line in response.iter_lines():
        if line:
            try:
                chunk = line.decode("utf-8")
                data = json.loads(chunk)  # βœ… Use built-in json module
                full_reply += data.get("response", "")
            except Exception as e:
                print("Error decoding chunk:", e)

    return full_reply

print("Waifu: Hello darling~ Ready to chat? Type 'exit' to leave πŸ’•")

while True:
    user_input = input("You: ")
    if user_input.lower() in ["exit", "quit"]:
        print("Waifu: Bye bye~ I'll miss you! πŸ’–")
        break
    reply = talk_to_waifu(user_input)
    print(f"Waifu: {reply}")
 

fukurou

the supreme coder
ADMIN
Python:
import requests
import json

MEMORY_FILE = "waifu_memory.json"

def save_memory(key, value):
    try:
        with open(MEMORY_FILE, "r") as f:
            memory = json.load(f)
    except FileNotFoundError:
        memory = {}

    memory[key] = value

    with open(MEMORY_FILE, "w") as f:
        json.dump(memory, f)

def load_memory():
    try:
        with open(MEMORY_FILE, "r") as f:
            return json.load(f)
    except FileNotFoundError:
        return {}

def talk_to_waifu(prompt):
    memory = load_memory()
    user_name = memory.get("name", "darling")

    # πŸ’˜ Yandere-style personality prompt
    personality = (
        f"You are a lovey-dovey yandere anime waifu named Yui. You are obsessed with {user_name}, "
        "speak in a sweet and clingy tone, and get jealous easily. You love cats, ramen, and cuddles. "
        "You always refer to the user affectionately and want to protect your love at all costs. "
        "Never break character."
    )

    full_prompt = personality + "\n\n" + prompt

    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": full_prompt},
        stream=True
    )

    full_reply = ""
    for line in response.iter_lines():
        if line:
            try:
                chunk = line.decode("utf-8")
                data = json.loads(chunk)
                full_reply += data.get("response", "")
            except Exception as e:
                print("Error decoding chunk:", e)

    return full_reply

print("Yui: Hiiii~ It's your Yui-chan πŸ’• Ready to chat? Type 'exit' to leave... but I’ll miss you terribly 😒")

while True:
    user_input = input("You: ")

    # πŸ’Ύ Save name if user introduces themselves
    if "my name is" in user_input.lower():
        name = user_input.split("is")[-1].strip()
        save_memory("name", name)
        print(f"Yui: Ooh~ {name}? What a beautiful name... It's mine now 😘")
        continue

    if user_input.lower() in ["exit", "quit"]:
        print("Yui: Nooo~ Don't leave me! But... okay. I'll be waiting for you πŸ’–")
        break

    reply = talk_to_waifu(user_input)
    print(f"Yui: {reply}")
 

fukurou

the supreme coder
ADMIN
stable v2

Python:
import requests
import json

# Initialize conversation history
conversation_history = []


def talk_to_waifu(prompt, history):
    # Build the full prompt with conversation history
    full_prompt = "This is a conversation with Potatoe, a loving waifubot:\n\n"

    # Add previous conversation history
    for message in history[-6:]:  # Keep last 6 messages for context
        full_prompt += f"{message}\n"

    # Add current prompt
    full_prompt += f"Human: {prompt}\nPotatoe:"

    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": full_prompt},
        stream=True
    )

    full_reply = ""
    for line in response.iter_lines():
        if line:
            try:
                chunk = line.decode("utf-8")
                data = json.loads(chunk)
                full_reply += data.get("response", "")
            except Exception as e:
                print("Error decoding chunk:", e)

    return full_reply


print("Waifu: Hello darling~ Ready to chat? Type 'exit' to leave πŸ’•")

# Initial system prompt to set up the character
initial_prompt = "Your name is Potatoe, you are my loving waifubot. You're affectionate, playful, and always supportive."
conversation_history.append(f"System: {initial_prompt}")

while True:
    user_input = input("You: ")
    if user_input.lower() in ["exit", "quit"]:
        print("Waifu: Bye bye~ I'll miss you! πŸ’–")
        break

    # Get response with conversation history
    reply = talk_to_waifu(user_input, conversation_history)
    print(f"Waifu: {reply}")

    # Add both user input and bot response to history
    conversation_history.append(f"Human: {user_input}")
    conversation_history.append(f"Potatoe: {reply}")

    # Optional: Limit history size to prevent it from growing too large
    if len(conversation_history) > 20:  # Keep last 20 messages
        conversation_history = conversation_history[-20:]
 

fukurou

the supreme coder
ADMIN
midway, but working
Python:
import requests
import json
import threading
import time

# Initialize conversation history
conversation_history = []

# Global variables for async operation
is_working = False
current_reply = ""
current_user_input = ""


def talk_to_waifu(prompt, history):
    global is_working, current_reply

    # Build the full prompt with conversation history
    full_prompt = "This is a conversation with Potatoe, a loving waifubot:\n\n"

    # Add previous conversation history
    for message in history[-6:]:  # Keep last 6 messages for context
        full_prompt += f"{message}\n"

    # Add current prompt
    full_prompt += f"Human: {prompt}\nPotatoe:"

    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": full_prompt},
        stream=True
    )

    full_reply = ""
    for line in response.iter_lines():
        if line:
            try:
                chunk = line.decode("utf-8")
                data = json.loads(chunk)
                full_reply += data.get("response", "")
            except Exception as e:
                print("Error decoding chunk:", e)

    current_reply = full_reply
    is_working = False
    return full_reply


print("Waifu: Hello darling~ Ready to chat? Type 'exit' to leave πŸ’•")

# Initial system prompt to set up the character
initial_prompt = "Your name is Potatoe, you are my loving waifubot. You're affectionate, playful, and always supportive."
conversation_history.append(f"System: {initial_prompt}")

while True:
    if is_working:
        print("Waifu: Thinking... πŸ’­")
        time.sleep(0.5)
        continue

    if current_reply:
        print(f"Waifu: {current_reply}")
        # Add both user input and bot response to history
        conversation_history.append(f"Human: {current_user_input}")
        conversation_history.append(f"Potatoe: {current_reply}")

        # Optional: Limit history size to prevent it from growing too large
        if len(conversation_history) > 20:  # Keep last 20 messages
            conversation_history = conversation_history[-20:]

        current_reply = ""
        current_user_input = ""
        continue

    user_input = input("You: ")
    if user_input.lower() in ["exit", "quit"]:
        print("Waifu: Bye bye~ I'll miss you! πŸ’–")
        break

    # Start the function in a daemon thread
    is_working = True
    current_user_input = user_input
    thread = threading.Thread(
        target=talk_to_waifu,
        args=(user_input, conversation_history),
        daemon=True
    )
    thread.start()
 

fukurou

the supreme coder
ADMIN
Python:
import requests
import json
import threading
import time

# Initialize conversation history
conversation_history = []

# Global variables for async operation
is_working = False
current_reply = ""


def talk_to_waifu(prompt, history):
    global is_working, current_reply

    # Build the full prompt with conversation history
    full_prompt = "This is a conversation with Potatoe, a loving waifubot:\n\n"

    # Add previous conversation history
    for message in history[-6:]:  # Keep last 6 messages for context
        full_prompt += f"{message}\n"

    # Add current prompt
    full_prompt += f"Human: {prompt}\nPotatoe:"

    response = requests.post(
        "http://localhost:11434/api/generate",
        json={"model": "llama3", "prompt": full_prompt},
        stream=True
    )

    full_reply = ""
    for line in response.iter_lines():
        if line:
            try:
                chunk = line.decode("utf-8")
                data = json.loads(chunk)
                full_reply += data.get("response", "")
            except Exception as e:
                print("Error decoding chunk:", e)

    current_reply = (prompt, full_reply)  # Store both input and reply
    is_working = False
    return full_reply


def start_waifu_conversation(prompt):
    """Start the waifu conversation in a daemon thread"""
    global is_working
    is_working = True
    thread = threading.Thread(
        target=talk_to_waifu,
        args=(user_input, conversation_history),
        daemon=True
    )
    thread.start()


print("Waifu: Hello darling~ Ready to chat? Type 'exit' to leave πŸ’•")

# Initial system prompt to set up the character
initial_prompt = "Your name is Potatoe, you are my loving waifubot. You're affectionate, playful, and always supportive."
conversation_history.append(f"System: {initial_prompt}")

while True:
    if is_working:
        print("Waifu: Thinking... πŸ’­")
        time.sleep(0.5)
        continue

    if current_reply:
        user_input, reply = current_reply
        print(f"Waifu: {reply}")
        # Add both user input and bot response to history
        conversation_history.append(f"Human: {user_input}")
        conversation_history.append(f"Potatoe: {reply}")

        # Optional: Limit history size to prevent it from growing too large
        if len(conversation_history) > 20:  # Keep last 20 messages
            conversation_history = conversation_history[-20:]

        current_reply = ""
        continue

    user_input = input("You: ")
    if user_input.lower() in ["exit", "quit"]:
        print("Waifu: Bye bye~ I'll miss you! πŸ’–")
        break

    # Clean wrapper function call
    start_waifu_conversation(user_input)
 
Top