| 1219 | }; |
| 1220 | |
| 1221 | struct server_slot { |
| 1222 | int id; |
| 1223 | int id_task = -1; |
| 1224 | |
| 1225 | // only used for completion/embedding/infill/rerank |
| 1226 | server_task_type task_type = SERVER_TASK_TYPE_COMPLETION; |
| 1227 | |
| 1228 | llama_batch batch_spec = {}; |
| 1229 | |
| 1230 | llama_context * ctx = nullptr; |
| 1231 | llama_context * ctx_dft = nullptr; |
| 1232 | |
| 1233 | // multimodal |
| 1234 | mtmd_context * mctx = nullptr; |
| 1235 | |
| 1236 | common_speculative * spec = nullptr; |
| 1237 | |
| 1238 | std::vector<common_adapter_lora_info> lora; |
| 1239 | |
| 1240 | // the index relative to completion multi-task request |
| 1241 | size_t index = 0; |
| 1242 | |
| 1243 | struct slot_params params; |
| 1244 | |
| 1245 | slot_state state = SLOT_STATE_IDLE; |
| 1246 | |
| 1247 | // used to determine the slot that has been used the longest |
| 1248 | int64_t t_last_used = -1; |
| 1249 | |
| 1250 | // generation props |
| 1251 | int32_t n_ctx = 0; // context size per slot |
| 1252 | int32_t n_past = 0; |
| 1253 | int32_t n_decoded = 0; |
| 1254 | int32_t n_remaining = -1; |
| 1255 | int32_t i_batch = -1; |
| 1256 | int32_t n_predict = -1; // TODO: disambiguate from params.n_predict |
| 1257 | |
| 1258 | // n_prompt_tokens may not be equal to prompt_tokens.size(), because prompt maybe truncated |
| 1259 | int32_t n_prompt_tokens = 0; |
| 1260 | int32_t n_prompt_tokens_processed = 0; |
| 1261 | |
| 1262 | // input prompt tokens |
| 1263 | server_tokens prompt_tokens; |
| 1264 | |
| 1265 | size_t last_nl_pos = 0; |
| 1266 | |
| 1267 | std::string generated_text; |
| 1268 | llama_tokens generated_tokens; |
| 1269 | common_chat_msg chat_msg; |
| 1270 | |
| 1271 | server_tokens cache_tokens; |
| 1272 | |
| 1273 | std::vector<completion_token_output> generated_token_probs; |
| 1274 | |
| 1275 | bool has_next_token = true; |
| 1276 | bool has_new_line = false; |
| 1277 | bool truncated = false; |
| 1278 | stop_type stop; |
nothing calls this directly
no test coverage detected