zhudotexe / kani

kani (カニ) is a highly hackable microframework for chat-based language models with tool use/function calling. (NLP-OSS @ EMNLP 2023)
https://kani.readthedocs.io
MIT License
557 stars 30 forks source link

String prompt builder / concrete HuggingEngine #32

Closed zhudotexe closed 7 months ago

zhudotexe commented 8 months ago

I began some investigation into a concrete HuggingEngine in the hf-concrete-base branch with the release of Chat Templates in Transformers v4.34 but found that it was pretty difficult to work with in the Kani model:

Instead, I think it's possible to make a more generic ChatMessage[] -> str prompt builder, which would make the lives of anyone who wants to implement a HuggingEngine easier and allow us to refactor the existing example HuggingEngine implementations. Some considerations: