Matthew pfp
Matthew
@matthew
Can any devs help me find a solution for this? Building a game and when a user guesses word X, I want to see if it's sufficiently similar to word Y. could I deploy some kind of mini, local LLM inside my codebase for this? ideally don't want to wait / pay each time for an openai api call.
7 replies
15 recasts
23 reactions

christopher pfp
christopher
@christopher
if you have a Postgres instance you could leverage ILIKE for semantic search unless you need it to be lexically similar.
2 replies
0 recast
5 reactions

Matthew pfp
Matthew
@matthew
yeah good idea. right now I have a dictionary of words and then use Levenshtein distance to determine it. the issue is that it's highly subjective. for example, for some questions, answering "dog" should translate to "pet", but in cases where there are other animals as answers, it should not be accepted. So I would pass the question and other answers in when asking the LLM.
1 reply
0 recast
1 reaction

redbeard pfp
redbeard
@hbrbssa.eth
Or you could pg-trgm, lot faster if you can make indexes https://www.postgresql.org/docs/current/pgtrgm.html
0 reply
0 recast
0 reaction