Skip to content

Commit

Permalink
Delete unused function
Browse files Browse the repository at this point in the history
  • Loading branch information
hadley committed Sep 23, 2024
1 parent 9dcaa27 commit d0ec0e9
Showing 1 changed file with 0 additions and 30 deletions.
30 changes: 0 additions & 30 deletions R/open-ai.R
Original file line number Diff line number Diff line change
Expand Up @@ -70,36 +70,6 @@ openai_result_message <- function(result, streaming) {
}
}

openai_stream_messages <- coro::generator(function(response) {

result <- list()
any_content <- FALSE

for (chunk in response) {
result <- merge_dicts(result, chunk)

if (!is.null(chunk$choices[[1]]$delta$content)) {
yield(chunk$choices[[1]]$delta$content)
any_content <- TRUE
}
}

list(
handle_event = function(chunk) {
},
done = function() {
if (any_content) {
emit("\n")
yield("\n")
}
},
message = function() {
result$choices[[1]]$delta
}
)

})

openai_key <- function() {
key <- Sys.getenv("OPENAI_API_KEY")
if (identical(key, "")) {
Expand Down

0 comments on commit d0ec0e9

Please sign in to comment.