Error in `(function (data) 
{
    if (!data$is_final && data$position == 2) {
        stop("Test error")
    }
    return(TRUE)
})(list(token = "\n", position = 2L, is_final = FALSE, total_tokens = 2L))`: Test error

"Prompt must be a single character string"
edge_stream_completion(mock_ctx, c("a", "b"), function(x) TRUE),
list(role = "system", content = "You are helpful")
expect_true(grepl("System: You are helpful", result1))
list(role = "system", content = "You are helpful"),
list(role = "assistant", content = "Hi there!")
expect_true(grepl("System: You are helpful", result2))
test_that("edge_stream_completion works with real model", {
ctx <- edge_load_model(model_path, n_ctx = 256)
expect_true(callback_calls > 1)  # Should have multiple calls
expect_true(length(tokens_received) > 0)  # Should receive tokens
expect_true(!is.null(final_data))  # Should receive final data
expect_true(is.list(result))  # Should return result
skip("No test model available for streaming tests")
test_that("edge_stream_completion supports early stopping", {
tokens_before_stop <<- tokens_before_stop + 1
skip("No test model available for early stopping tests")
test_that("edge_stream_completion handles callback errors", {
if (!data$is_final && data$position == 2) {
skip("No test model available for callback error tests")
test_that("edge_stream_completion with various parameters", {
# Test with different temperature values
skip("No test model available for parameter tests")
test_that("Streaming with special text", {
skip("No test model available for special text tests")
result <- edge_stream_completion(ctx, paste("Test", i),
# Test with callback that always returns FALSE (immediate stop)
skip("No test model available for streaming stress tests")

"edge_stream_completion works with real model"
"No test model available for streaming tests"
"No test model available for early stopping tests"
"No test model available for callback error tests"
"No test model available for parameter tests"
"No test model available for special text tests"
"No test model available for streaming stress tests"