Skip to content

Commit

Permalink
update version, Closes #225
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHWade committed Aug 31, 2024
1 parent 111dd7a commit db9630e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 40 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: gptstudio
Title: Use Large Language Models Directly in your Development Environment
Version: 0.4.0.9004
Version: 0.4.0.9005
Authors@R: c(
person("Michel", "Nivard", , "m.g.nivard@vu.nl", role = c("aut", "cph")),
person("James", "Wade", , "github@jameshwade.com", role = c("aut", "cre", "cph"),
Expand Down
22 changes: 0 additions & 22 deletions R/service-ollama.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ body_to_json_str <- function(x) {


ollama_perform_stream <- function(request, parser) {
<<<<<<< HEAD
req_perform_stream(
request,
callback = function(x) {
Expand All @@ -58,27 +57,6 @@ ollama_perform_stream <- function(request, parser) {
},
buffer_kb = 0.01,
round = "line"
=======
request_body <- request |>
purrr::pluck("body")

request_url <- request |>
purrr::pluck("url")

request_handle <- curl::new_handle() |>
curl::handle_setopt(postfields = body_to_json_str(request_body))

curl_response <- curl::curl_fetch_stream(
url = request_url,
handle = request_handle,
fun = function(x) parser$parse_ndjson(rawToChar(x))
)

response_json(
url = curl_response$url,
method = "POST",
body = list(response = parser$lines)
>>>>>>> 2a5751d (%>% to |>, R >=4.1, update news)
)
}

Expand Down
17 changes: 0 additions & 17 deletions R/service-openai_streaming.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ stream_chat_completion <-
"messages" = messages
)

<<<<<<< HEAD
request(url) %>%
req_headers(
"Content-Type" = "application/json",
Expand All @@ -43,22 +42,6 @@ stream_chat_completion <-
round = "line",
buffer_kb = 0.01
)
=======
# Create a new curl handle object
handle <- curl::new_handle() |>
curl::handle_setheaders(.list = headers) |>
curl::handle_setopt(postfields = jsonlite::toJSON(body, auto_unbox = TRUE)) # request body

# Make the streaming request using curl_fetch_stream()
curl::curl_fetch_stream(
url = url,
fun = function(x) {
element <- rawToChar(x)
element_callback(element) # Do whatever element_callback does
},
handle = handle
)
>>>>>>> 2a5751d (%>% to |>, R >=4.1, update news)
}

openai_handler <- function(x) {
Expand Down

0 comments on commit db9630e

Please sign in to comment.