Commit Graph

20 Commits

Author SHA1 Message Date
projectmoon 6fff4ecacd Allow limiting of values on derive(Gbnf) structs.
With the new helper attribute #[gbnf_limit] on a field of a struct
that has #[derive(Gbnf)], it is now possible to constrain the output
of the LLM to a specific set of values for that field. This is
extremely useful, for example, when asking the LLM to put a specific
ID in a field.

This commit also addresses numerous shortcomings of the original
implementation of the derive macro.

Deserialization of certain LLM responses currently broken as of this
commit, due to different field names in the LLM output vs what serde
expects (camelCase vs snake_case issues).
2024-03-05 20:28:00 +01:00
projectmoon 64209738de GBNF: const generics for arrays; lock derive to owned data.
Remove the trait impl macros for arrays, as we can use const generics
for it instead.

Add DeserializeOwned trait bound to the blanket trait impls and
clarify the panic message that the derive macro only works with
structs that have owned data (no borrows).
2024-02-05 21:25:01 +01:00
projectmoon de2fcdbd6c Only compute GBNF grammar once. 2024-02-05 21:19:49 +01:00
projectmoon f7df8af068 Remove some unnecessary clones in the GBNF derive macro. 2024-02-05 16:33:53 +01:00
projectmoon 1e80ae508e Implement derive macro to convert structs to GBNF rules.
This is the initial implementation of a derive macro implementation
that converts structs into GBNF grammars. This simplies the code by
allowing us to get rid of all the hardcoded GBNF strings, prevents
errors from manually editing or copying said strings, and other
benefits.

The main purpose of this implementation is to lay the foundation for
generating hyper-specific GBNF rules that will allow us to limit LLM
output to specific UUIDs. LLM can't generate a weird response for an
exit or entity ID if it is only allowed to generate a specific list of
UUIDs in its response.
2024-02-05 16:12:05 +01:00
projectmoon c6f10f7a61 Switch to one event output per command execution. Simplify coherence. 2024-01-31 13:01:13 +01:00
projectmoon d23f09295e Move cmd coherence result partitioning to macro.
Because we're not cool enough to know what arcane type signature is
needed to add an extension method to the stream itself.
2024-01-30 22:42:27 +01:00
projectmoon c2551ac4ed Small typo fixes 2024-01-30 22:25:16 +01:00
projectmoon 1d78d05d7a Look at people and items in a scene. Non-LLM coherence.
Adds the ability to inspect people or items in a scene. Also
technically props, but they are not first class entities (i.e. stored
in DB with an ID), so the LLM will behave oddly if you attempt to look
at a prop.

Also adds the foundation of non-LLM + LLM command coherence to fix up
LLM responses from LLM command execution. CommandEvents that are
recognized as incoherent will attempt to be fixed by the command
coherence layer. Currently only non-LLM coherence checks are done
(normalizing IDs, making sure they are right, etc).

Also many changes to command execution prompt to make it more
intelligent and correct.

Many foundational pieces for building actual game mechanics and
in-depth coherence are also added.
2024-01-30 22:21:04 +01:00
projectmoon ce89b61c19 Implement support for translating common commands into pre-parsed commands. 2024-01-17 10:53:56 +01:00
projectmoon c4d0397fb5 Lifetime not necessary on CommandExecutor 2024-01-17 10:36:44 +01:00
projectmoon b82b87345e Support the built-in command: look 2024-01-17 10:36:20 +01:00
projectmoon 82001b99b7 Bunch of refactoring and renaming to support built-in commands. 2024-01-17 10:34:24 +01:00
projectmoon 001e15e594 Move command conversion to its own module file. 2024-01-17 09:54:50 +01:00
projectmoon 773f3a1a47 Better naming and some documentation of command process. 2024-01-17 09:31:38 +01:00
projectmoon bdf5b4da08 Rename AiClient to AiGenerator 2024-01-17 09:28:53 +01:00
projectmoon 336a4231a0 Move the AI logic to its own module file. 2024-01-17 09:28:13 +01:00
projectmoon d2ed246b8b Add GitHub mirror 2024-01-15 09:40:52 +01:00
projectmoon b1cd8c64dd Add readme and license 2024-01-15 09:35:01 +01:00
projectmoon 00fe3650a8 Initial commit of opening the AI game code.
Now that it is somewhat presentable.
2024-01-15 09:13:12 +01:00