Beetmash
Docs > Beet > Guides > Llms

LLMs

A great starting point for the use of Large Language Models for behavior is Sentence Similarity. Fortunately this is a relatively cheap operation that can be run locally, even in-browser!

SentenceFlow

The SentenceFlow action is similar to the ScoreFlow. It uses a provided Sentence and runs the child with the most similar one.

This example will select the second child, run it, and return RunResult::Success.

main.rs
world.spawn((
SentenceFlow,
Sentence::new("I've been shot, help!")
))
.with_children(|parent| {
parent.spawn((
Sentence::new("attack"),
EndOnRun::failure()
));
parent.spawn((
Sentence::new("heal"),
EndOnRun::success()
));
})