Closed kratosok closed 3 months ago
So I'm gonna try to take a crack at this myself It would seem. I'm adding "grammar_json_functions" and "grammar" attribute to the "ChatCompletion" class in agixt/Models.py
. Next I will need to check the custom provider options to see how ChatCompletions are used and providing the grammar attributes and make some if they done.. Ultimately since the grammar would impact the responses coming back, I think I will add custom prompts for my custom provider so that I can have some sort of embedded grammar instruction in the prompts.
Hey @kratosok ! I actually haven't used the grammars. I found an approach the worked before those started being implemented and stuck with it. I am open to moving to grammars since they're trending towards being the standard for that, but I don't currently have any data formatting issues with AGiXT that I am aware of.
Feature/Improvement Description
I've been using Localai (as an openai replacement) to serve multiple local models for inferencing and came across the idea of BNF grammars in llamacpp. I recall some talk here about the challenges of getting consistent responses from opensource models.
Adopting BNF grammars to constrain responses (See BNF grammars in llamacpp and other projects), or the new DSPy work from Stanford (You might be able to provide a good working conversation flow/examples from say GPT4, to give the DSPy compiler targets to learn how to use any given open source model the same or a similar type response) might be the solution to reliable responses.
One or both of these approaches would push AGIxt to the next level of usability and reliability, in my opinion.
Proposed Solution
See the BNF conversation here: https://www.reddit.com/r/LocalLLaMA/comments/16wf3w5/ggml_bnf_grammar_the_key_to_autonomous_agents/
Or: https://github.com/stanfordnlp/dspy
Acknowledgements