Skip to content

Commit 9e6e103

Browse files
committed
Fix generate(string) docstring and initialize cur_token
- Update docstring: empty prompt is allowed after prefill() - Initialize cur_token = 0 to silence compiler warnings This PR was authored with the assistance of Claude.
1 parent e068f7e commit 9e6e103

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

extension/llm/runner/multimodal_runner.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ Error MultimodalRunner::generate(
261261
// Reset internal state and start inference
262262
stats_->inference_start_ms = time_in_ms();
263263

264-
uint64_t cur_token;
264+
uint64_t cur_token = 0;
265265
if (!inputs.empty()) {
266266
// Echo the last text input if enabled
267267
if (config.echo && inputs.back().is_text()) {

extension/llm/runner/multimodal_runner.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,9 @@ class ET_EXPERIMENTAL MultimodalRunner : public IRunner {
111111

112112
/**
113113
* Generate tokens from a text prompt. Wraps the prompt as a MultimodalInput
114-
* and delegates to generate(vector).
115-
* @param prompt The text prompt to generate from. Must be non-empty.
114+
* and delegates to generate(vector). Empty prompt is allowed if prefill()
115+
* was called beforehand.
116+
* @param prompt The text prompt to generate from.
116117
* @param config Generation configuration parameters.
117118
* @param token_callback Callback function called for each generated token.
118119
* @param stats_callback Callback function for generation statistics.

0 commit comments

Comments
 (0)