Anyone here knows how I can make an AI output things based on memory?

Hi there!

I have an memory for the AI with example usage, definition etc. But how can I create something that checks which words/numbers/punctuations to use in the output based on the input?

Currently I only have something that makes the AI learn new things:

local AImemory = {}


AImemory.categories = {
	numbers = {
		
		["1"] = {
			definition = {"one", "a number representing a single or the only entity", "numerical digit", "represents a single unit of counting or measurement"},
			
			usage = {
				input = "1+1?",
				output = "2"
			},
			__ID_ = 0110
		},
		["2"] = {
			definition = {"two", "a number representing a single or the only entity", "numerical digit", "represents a single unit of counting or measurement"},
			
			usage = {
				input = "2+2?",
				output = "4"
			},
			__ID_ = 01101
		}
	},
	operators = {
		["+"] = {
			definition = {"mathematical symbol used to add 2 numerical digits together"},
			
			usage = {
				input = "1+1?",
				output = "2"
			},
			__ID_= 101
		}
	},
	punctuations = {
		["?"] = {
			definition = {"a punctuation mark indicating a question"},
			
			usage = {
				input = "1+1?",
				output = "2"
			},
			
			__ID_ = 003
		}
	}
}

function AImemory.addKnowledge(category, word, definition, input, output)

	if category == nil then
		print("No category given")
		return -- Early return if no category is provided
	end


	if not AImemory.categories[category] then
		AImemory.categories[category] = {} 
	end


	AImemory.categories[category][word] = {
		definition = definition,
		usage = {
			input = input,
			output = output
		}
	}
	
end




return AImemory

I thought it would be a good idea to use ID’s to identify each word and so it better knows what to use?

Any help would be appreciated! All I need to know is how I can make the AI output stuff based from it’s memory.

So if it did learn what + does/is, 5 is and 6 is and 11 is then it has to be able to know that the answer is 11 from it’s memory even though he never learned that 5+6 is 11.

Sorry, but I don’t quite understand the problem here. What are you trying to make the AI do here based on given inputs? I need some more context on why you create this AI and what’s its functionality.

I want to know how I can make the AI geberate dynamic responses and not responses set in the code.