@@ -46,6 +46,9 @@ class PyLLAMA {
46
46
void update_input (const std::string& text) {
47
47
llama_update_input (*ctx_ptr, text);
48
48
}
49
+ void update_input_tokens (const std::vector<gpt_vocab::id>& ids) {
50
+ llama_update_input (*ctx_ptr, ids);
51
+ }
49
52
bool is_finished () {
50
53
return llama_context_is_finished (*ctx_ptr);
51
54
}
@@ -146,7 +149,8 @@ PYBIND11_MODULE(llamacpp, m) {
146
149
.def (py::init<gpt_params>())
147
150
.def (" prepare_context" , &PyLLAMA::prepare_context, " Prepare the LLaMA context" )
148
151
.def (" add_bos" , &PyLLAMA::add_bos, " Add a BOS token to the input" )
149
- .def (" update_input" , &PyLLAMA::update_input, " Update input" )
152
+ .def (" update_input" , &PyLLAMA::update_input, " Update input as text" )
153
+ .def (" update_input_tokens" , &PyLLAMA::update_input_tokens, " Update input tokens" )
150
154
.def (" is_finished" , &PyLLAMA::is_finished, " Check if the model is finished" )
151
155
.def (" has_unconsumed_input" , &PyLLAMA::has_unconsumed_input, " Check if the model has unconsumed input" )
152
156
// ingest_all_pending_input. Does not print to stdout by default
0 commit comments