top of page

Let's try making an AI 1

May 30
3 min read


Since I'm already studying Python, I wanted to do something Python-like → which led me to the idea of creating AI.

There are many different types of AI, and I thought about trying AIOCR, which seems like it could support me at work, but then I realized I wanted a partner that was a better match for me, like KITT or JARVIS.

Actually, when I used to work at a customer support center, I created something that wasn't a full-fledged AI, but more like a pseudo-AI, to speed up the work. I did it using only Excel and VBA.


So, I'd like to ask the real AI that I'm currently using, "How can I create something like you? Preferably one that copies my personality."

Then, I was advised that it would be difficult to jump straight into LLM (ChatGPT-based) + prompt control, so I should try creating it using a rule-based approach first.

*I've already made improvements, so I'm writing this down from memory.


Well, this kind of plan is better, isn't it?

① Operate according to handwritten rules

② Give personality to a CSV file

③ Accumulate conversation data

④ Gradually automate

⑤ AI implementation


So, is that something I created using VBA a long time ago?


Things to prepare

1. Conversation Pattern CSV

Me: Hello

AI: Hello


2. My personality parameters

situation

partner

action

reason

preference

3. Logic

Main.py only



import pandas as pd

import pickle


# -------------------------------

# ① Loading AI model

# -------------------------------

with open("model.pkl", "rb") as f:

model = pickle.load(f)


with open("vectorizer.pkl", "rb") as f:

vectorizer = pickle.load(f)



# -------------------------------

# ② Text classification (AI)

# -------------------------------

def classify_text(text):

X = vectorizer.transform([text])

return model.predict(X)[0]



# -------------------------------

# ③ Personality Reading

# -------------------------------

def get_person(name):

df = pd.read_csv("Personality_db.csv")

return df[df["name"] == name].iloc[0]



# -------------------------------

# ④ Category-based processing (core)

# -------------------------------

def generate_response(person, intent):


politeness = person["politeness"]

depth = person["depth"]


# ---- request ----

if intent == "Request":

if politeness > 0.7:

Please return "Please handle this."

else:

return "Just do it"


# ---- Confession ----

elif intent == "confession":

if politeness > 0.7:

"I appreciate your kind offer, but please give me some time to think about it."

else:

Return: "Sorry, I can't do that right now."


# ---- consultation ----

elif intent == "Consultation":

if depth > 0.6:

return "There are several possible causes, but first, it could be XX."

else:

return "Yes, that's difficult."


# ---- Apology ----

elif intent == "Apology":

if politeness > 0.7:

Return: "We apologize. We will investigate the cause and take appropriate action."

else:

return "Sorry, I'll be more careful"



# ---- Casual chat ----

else:

if person["distance"] > 0.6:

return "Yes, that's right."

else:

return "Yeah, I understand that."



# -------------------------------

# ⑤ Enter command → Execute

# -------------------------------

if __name__ == "__main__":


name = "Taka" # Fixed name is also OK

input_text = input("Please enter:")


intent = classify_text(input_text)

person = get_person(name)

response = generate_response(person, intent)


print("intent:", intent)

print("response:", response)


---

with open("model.pkl", "rb") as f:

model = pickle.load(f)


with open("vectorizer.pkl", "rb") as f:

vectorizer = pickle.load(f)


👉 What I'm doing:


Load the pre-trained AI.

Prepare an engine that converts "text → meaning".


def classify_text(text):

X = vectorizer.transform([text])

return model.predict(X)[0]


sentence

↓

Break it down into words and convert them to numbers.

↓

AI classification

↓

Returns labels such as "Request".



def generate_response(person, intent):

Create a response by combining meaning (intent) and personality (person).



project/

├ training_data.csv

├ model.pkl ← Created here

├ vectorizer.pkl ← This too


But at this point, the answer is simply branched using an IF statement,

It feels less like AI and more like a system I used to create with VBA.

However, the structure is designed to be developed into AI.


The road to KIIT and JARVIS is long.

 
 
 

Comments


bottom of page