add llms and make it easier to add new ones i think #1

Merged
flash merged 9 commits from Neeko/komeiji-senses:llmupdate into trunk 2025-06-06 19:46:30 +00:00
Contributor

hopefully this isn't totally dogass have fun!!

hopefully this isn't totally dogass have fun!!
Neeko added 1 commit 2025-06-06 14:25:47 +00:00
flash requested changes 2025-06-06 15:45:28 +00:00
flash left a comment
Owner

using the review feature for the first time ever whoa hope i did alright

i'll definitely follow up on your complaint about lacking functionality in Lua in chat last night by providing a library that contains a bunch of array macros and whatnot

using the review feature for the first time ever whoa hope i did alright i'll definitely follow up on your complaint about lacking functionality in Lua in chat last night by providing a library that contains a bunch of array macros and whatnot
gork/gork.lua Outdated
@ -123,2 +137,4 @@
local matchAt = msg.textClean:sub(2, spacePos - 1):lower()
local eightBall
local englishNames = { -- new LLMs are added every week, making this into a list allows you to add new ones easier, i think.
"grok", "chatgpt", "askperplexity", "gemini", "bard", "copilot", "deepseek", "supergrok", "gork", "siri"
Owner

maybe it'd be nicer to have this be a dictionary that contains = so like

local englishNames = {
    ["grok"] = 4,
    ["chatgpt"] = 5,
    -- etc
}

which would also leave the ability to specify per-phrase distances :D

you can still just use like length / 2 as the initial values for the ones that weren't there yet, rounded up or down whichever you feel like

maybe it'd be nicer to have this be a dictionary that contains <llm name> = <max distance> so like ```lua local englishNames = { ["grok"] = 4, ["chatgpt"] = 5, -- etc } ``` which would also leave the ability to specify per-phrase distances :D you can still just use like length / 2 as the initial values for the ones that weren't there yet, rounded up or down whichever you feel like
Author
Contributor

this is smarter than the original way i was thinking of adding arbitrary distances, would have to figure out how to actually access the keys in the value pair, im sure it's easy enough, though.

this is smarter than the original way i was thinking of adding arbitrary distances, would have to figure out how to actually access the keys in the value pair, im sure it's easy enough, though.
Owner

i think you'd have to use the ipairs iterator for that
for k,v in ipairs(englishNames) do , i'm not sure if that is the exact syntax though

i think you'd have to use the ipairs iterator for that `for k,v in ipairs(englishNames) do` , i'm not sure if that is the exact syntax though
flash marked this conversation as resolved
gork/gork.lua Outdated
@ -125,2 +142,3 @@
local frenchNames = {"gorque"} -- i don't speak french but i figure i should do this to both.
if matchAt == "gorque" then
if superLesbian(frenchNames, matchAt, false) then
Owner

its fine to just leave this as an exact match since its a one off gag and not have to bother with the if statement in the array lookup function

its fine to just leave this as an exact match since its a one off gag and not have to bother with the if statement in the array lookup function
Author
Contributor

i can do that easy, i thought it might be fun to add chatte gpt amongst other things - but if we only want groque to hit french 8ball that's fair.

i can do that easy, i thought it might be fun to add chatte gpt amongst other things - but if we only want groque to hit french 8ball that's fair.
flash marked this conversation as resolved
gork/gork.lua Outdated
@ -127,2 +144,3 @@
if superLesbian(frenchNames, matchAt, false) then
eightBall = bouleMagiqueNumeroHuit
elseif lesbian("grok", matchAt) < 4 or lesbian("askperplexity", matchAt) < 8 then
elseif superLesbian(englishNames, matchAt, true) then
Owner

following the comment on englishNames you could replace the superLesbian func entirely with a hashmap lookup, just something like

else
    local maxWeight = englishNames[matchAt]
    if maxWeight ~= nil then
        --
    end
end

somewhat unfortunate bc it was a great name 😭

following the comment on englishNames you could replace the `superLesbian` func entirely with a hashmap lookup, just something like ```lua else local maxWeight = englishNames[matchAt] if maxWeight ~= nil then -- end end ``` somewhat unfortunate bc it was a great name 😭
Author
Contributor

wouldn't a hashmap lookup require being exact - failing if message is grko instead of grok?
it would save a few (a lot) of cycles if the message was exact but otherwise wouldn't it still need the superLesbian func anyway to go through the list?

wouldn't a hashmap lookup require being exact - failing if message is grko instead of grok? it would save a few (a lot) of cycles if the message was exact but otherwise wouldn't it still need the superLesbian func anyway to go through the list?
Owner

wait no yeah you're absolutely right sorry i'm not sure what i was thinking, however you could still use the hashmap to keep the different specific distance values

wait no yeah you're absolutely right sorry i'm not sure what i was thinking, however you could still use the hashmap to keep the different specific distance values
flash marked this conversation as resolved
Neeko started working 2025-06-06 15:52:30 +00:00
Neeko canceled time tracking 2025-06-06 16:06:21 +00:00
flash added the
good first pull request
label 2025-06-06 17:39:07 +00:00
Neeko added 1 commit 2025-06-06 17:44:29 +00:00
Neeko added 1 commit 2025-06-06 17:45:23 +00:00
Neeko added 1 commit 2025-06-06 17:47:12 +00:00
Neeko added 1 commit 2025-06-06 17:48:19 +00:00
flash reviewed 2025-06-06 17:49:30 +00:00
gork/gork.lua Outdated
@ -58,1 +58,4 @@
local function superLesbian(stringTable, str1, leven)
for key, dist in stringTable do
if leven
Owner

Could you also remove this if and associated parameter? since its no longer being used without it

Could you also remove this if and associated parameter? since its no longer being used without it
flash marked this conversation as resolved
Owner

also bump the version in sense.toml to 1.1.0 if you wana, since added functionality

also bump the version in sense.toml to 1.1.0 if you wana, since added functionality
Neeko added 1 commit 2025-06-06 17:55:19 +00:00
flash requested changes 2025-06-06 17:59:41 +00:00
flash left a comment
Owner

other than these last few nitpicks this looks good to me, i'll test it in a bit!

other than these last few nitpicks this looks good to me, i'll test it in a bit!
gork/gork.lua Outdated
@ -59,0 +60,4 @@
for key, dist in stringTable do -- lame string chceker thing
if lesbian(key, str1) < dist then
return true
end
Owner

this feels extremely nitpicky on my part but this should have one less indent

this feels extremely nitpicky on my part but this should have one less indent
Author
Contributor

its not indentation is important

its not indentation is important
flash marked this conversation as resolved
gork/gork.lua Outdated
@ -127,2 +138,3 @@
eightBall = bouleMagiqueNumeroHuit
elseif lesbian("grok", matchAt) < 4 or lesbian("askperplexity", matchAt) < 8 then
elseif superLesbian(englishNames, matchAt) then
--elseif lesbian("grok", matchAt) < 4 or lesbian("askperplexity", matchAt) < 8 then
Owner

you may remove this comment

you may remove this comment
Author
Contributor

the past removed for the future.

the past removed for the future.
flash marked this conversation as resolved
Neeko added 1 commit 2025-06-06 18:01:51 +00:00
flash reviewed 2025-06-06 18:11:59 +00:00
gork/gork.lua Outdated
@ -59,0 +61,4 @@
if lesbian(key, str1) < dist then
return true
end
return false
Owner

Just noticed an oversight here, probably happened when reducing it from its previous implementation, the return false is within the for loop and the function itself doesn't have an end

Just noticed an oversight here, probably happened when reducing it from its previous implementation, the `return false` is within the for loop and the function itself doesn't have an end
Author
Contributor

whooops

whooops
flash marked this conversation as resolved
Neeko added 1 commit 2025-06-06 18:30:44 +00:00
flash requested changes 2025-06-06 19:18:22 +00:00
flash left a comment
Owner

Final set of requests before we should be good! Mostly Lua specific moments and one more style thingy.

Final set of requests before we should be good! Mostly Lua specific moments and one more style thingy.
gork/gork.lua Outdated
@ -56,6 +56,15 @@ local bouleMagiqueNumeroHuit = {
"Vous avez atteint notre limite de messages par 1 minute. Veuillez réessayer plus tard.",
}
local function superLesbian(stringTable, str1)
Owner

Can you move this function below lesbian? Apparently declaration order matters for local functions, I wasn't aware of this either 😎

Can you move this function below lesbian? Apparently declaration order matters for local functions, I wasn't aware of this either 😎
Author
Contributor

Whoops pt2

Whoops pt2
flash marked this conversation as resolved
gork/gork.lua Outdated
@ -57,2 +57,4 @@
}
local function superLesbian(stringTable, str1)
for key, dist in stringTable do -- lame string chceker thing
Owner

in stringTable do should be in pairs(stringTable) do

`in stringTable do` should be `in pairs(stringTable) do`
Author
Contributor

oh interesting, my apologies. my epic and awesome lua lsp server didn't catch or warn me about that.

oh interesting, my apologies. my epic and awesome lua lsp server didn't catch or warn me about that.
flash marked this conversation as resolved
gork/gork.lua Outdated
@ -122,10 +131,13 @@ kmj.satori.addMessageHandler(function(msg, isSelf)
local matchAt = msg.textClean:sub(2, spacePos - 1):lower()
local eightBall
local englishNames = { -- new LLMs are added every week, making this into a list allows you to add new ones easier, i think.
Owner

Can you move this above lesbian (so basically where superLesbian is currently)? I want to keep config type thingies at the top, somehow didn't realise it wasn't there until at the top already until now.

Can you move this above lesbian (so basically where superLesbian is currently)? I want to keep config type thingies at the top, somehow didn't realise it wasn't there until at the top already until now.
Author
Contributor

makes sense to me, will do

makes sense to me, will do
flash marked this conversation as resolved
Neeko added 1 commit 2025-06-06 19:27:07 +00:00
flash merged commit 513924b1bb into trunk 2025-06-06 19:46:30 +00:00
Owner

LGTM as they say

LGTM as they say
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: flashii/komeiji-senses#1
No description provided.