MCPcopy Create free account
hub / github.com/davisking/dlib / context_manager

Method context_manager

examples/slm_advanced_train_ex.cpp:673–682  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671class context_manager {
672public:
673 context_manager(size_t max_context_tokens = 1024, size_t min_prompt_tokens = 100,
674 int padding_token = -1) : max_context_size_(max_context_tokens),
675 min_prompt_size_(min_prompt_tokens), padding_token_(padding_token) {
676
677 if (min_prompt_tokens >= max_context_tokens)
678 throw std::invalid_argument("Minimum prompt size must be smaller than maximum context size");
679
680 if (min_prompt_tokens < 10)
681 throw std::invalid_argument("Minimum prompt size must be at least 10");
682 }
683
684 // Add a single token to the context
685 void add_token(int token) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected