can you enhance this glua script 10x times, add the recent 5 messages from the server (in chat) in memory, have working error handling in chat, more commands, more functions,  and make it chat to me.. and when thinking.. its going to do the thinking pose in gmod
-- File: lua/entities/ai_npc/init.lua
AddCSLuaFile("cl_init.lua")
AddCSLuaFile("shared.lua")

include("shared.lua")

function ENT:Initialize()
    local models = {
        "models/Humans/Group01/male_01.mdl",
        "models/Humans/Group01/male_02.mdl",
        "models/Humans/Group01/male_03.mdl",
        "models/Humans/Group01/male_04.mdl",
        "models/Humans/Group01/male_05.mdl",
        "models/Humans/Group01/male_06.mdl",
        "models/Humans/Group01/male_07.mdl",
        "models/Humans/Group01/male_08.mdl",
        "models/Humans/Group01/male_09.mdl",
        "models/Humans/Group01/female_01.mdl",
        "models/Humans/Group01/female_02.mdl",
        "models/Humans/Group01/female_03.mdl",
        "models/Humans/Group01/female_04.mdl",
        "models/Humans/Group01/female_06.mdl",
        "models/Humans/Group01/female_07.mdl"
    }

    self:SetModel(models[math.random(#models)])
    self:SetHullType(HULL_HUMAN)
    self:SetHullSizeNormal()
    self:SetNPCState(NPC_STATE_SCRIPT)
    self:SetSolid(SOLID_BBOX)
    self:CapabilitiesAdd(bit.bor(CAP_MOVE_GROUND, CAP_ANIMATEDFACE, CAP_USE_WEAPONS, CAP_WEAPON_MELEE_ATTACK1))
    self:SetUseType(SIMPLE_USE)
    self:DropToFloor()
    self.NextThinkTime = 0
end

function ENT:OnTakeDamage(dmginfo)
    self:SetHealth(self:Health() - dmginfo:GetDamage())
    if self:Health() <= 0 then
        self:Remove()
    end
end

function ENT:Think()
    if CurTime() >= self.NextThinkTime then
        self:PerformAction()
        print("think")
        self.NextThinkTime = CurTime() + math.random(5, 10)
    end
end

function ENT:PerformAction()
    print("performin something")
    local actions = {"Move to player", "Move away", "Equip shotgun", "Random move", "Say hello"}
    local items = {"weapon_pistol", "weapon_shotgun", "weapon_crowbar"}
    local players = player.GetAll()
    local playerNames = {}
    for _, ply in ipairs(players) do
        table.insert(playerNames, ply:Nick())
    end
    local prompt = "You are an NPC in Garry's Mod. You can perform actions: "..table.concat(actions, ", ")..". You have items: "..table.concat(items, ", ")..". Players nearby: "..table.concat(playerNames, ", ")..". Your position: "..tostring(self:GetPos())..". Your health: "..self:Health()..". Decide your next action and respond with one of the available commands."
    local data = {
        prompt = prompt
    }
    local url = "http://14.5.54.137:11434/generate"

    http.Post(url, data, function(result)
        local response = util.JSONToTable(result)
        if response and response.command then
            self:ExecuteCommand(response.command)
        end
    end)
end

function ENT:ExecuteCommand(command)
    print(command)
    if command == "Move to player" then
        local players = player.GetAll()
        if #players > 0 then
            local target = players[math.random(#players)]
            self:SetLastPosition(target:GetPos())
            self:SetSchedule(SCHED_FORCED_GO_RUN)
        end
    elseif command == "Move away" then
        local newPos = self:GetPos() + VectorRand() * 500
        self:SetLastPosition(newPos)
        self:SetSchedule(SCHED_FORCED_GO_RUN)
    elseif command == "Equip shotgun" then
        self:Give("weapon_shotgun")
    elseif command == "Random move" then
        local newPos = self:GetPos() + VectorRand() * 300
        self:SetLastPosition(newPos)
        self:SetSchedule(SCHED_FORCED_GO)
    elseif command == "Say hello" then
        self:EmitSound("vo/npc/male01/hi0"..math.random(1,2)..".wav")
    end
end