Debugging grammars by example
Hi,
is there a way to test a guidance grammar without using a LLM call? I'm trying to write a complex grammar, and it is very cumbersome to develop it as LLM calls take their time. I would like to check whether my guidance functions would accept a string that contains the output I want to get from the LLM. If e.g. I'm trying to implement the calculator example from the readme and an offline check of the string "1*1" does not fit my guidance grammar I don't have to use an LLM to see that my code can't work. Greetings!
Great idea. We should expose a nice API for this! (up for grabs if anyway wants to look into that) In the meantime you can check out the guidance.models.Mock class. It allows you to define a mock model that will output exactly what you specify (it is used in a lot of tests).
Hi @slundberg, I am new to this project and want to contribute to this. Can you please guide me on how to get started on this. We can have a quick chat whenever you are available.