| 105 | } |
| 106 | |
| 107 | static const char * sample(struct llama_context * ctx_llama, gpt_params & params, int * n_past) { |
| 108 | int id = sample_id(ctx_llama, params); |
| 109 | static std::string ret; |
| 110 | if (id == llama_token_eos(llama_get_model(ctx_llama))) { |
| 111 | ret = "</s>"; |
| 112 | } else { |
| 113 | ret = llama_token_to_piece(ctx_llama, id); |
| 114 | } |
| 115 | eval_id(ctx_llama, id, n_past); |
| 116 | return ret.c_str(); |
| 117 | } |
| 118 | |
| 119 | static const char* IMG_BASE64_TAG_BEGIN = "<img src=\"data:image/jpeg;base64,"; |
| 120 | static const char* IMG_BASE64_TAG_END = "\">"; |
no test coverage detected