Skip to content

Commit 4644bb9

Browse files
committed
Add API to irunner.h
1 parent a1cb4c2 commit 4644bb9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

extension/llm/runner/irunner.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,23 @@ class ET_EXPERIMENTAL IRunner {
121121
std::function<void(const std::string&)> token_callback,
122122
std::function<void(const Stats&)> stats_callback) = 0;
123123

124+
/**
125+
* Generate text based on the provided prompt and generation config, from a
126+
* given position in KV cache.
127+
*
128+
* @param prompt The input prompt to generate from
129+
* @param start_pos The starting position in KV cache of the input
130+
* @param config Generation configuration parameters
131+
* @param token_callback Callback function called for each generated token
132+
* @param stats_callback Callback function for generation statistics
133+
* @return Error::Ok if successful, an error otherwise
134+
*/
135+
virtual runtime::Error generate_from_pos(
136+
const std::string& prompt,
137+
int64_t start_pos,
138+
const GenerationConfig& config,
139+
std::function<void(const std::string&)> token_callback,
140+
std::function<void(const Stats&)> stats_callback) = 0;
124141
/**
125142
* Stop the generation process.
126143
*/

0 commit comments

Comments
 (0)