Skip to content

Commit

Permalink
Merge pull request #81 from JamesHWade/feat/azure-stream-chat
Browse files Browse the repository at this point in the history
Feat/azure stream chat and fix check_url
  • Loading branch information
JamesHWade authored Mar 2, 2024
2 parents e889229 + 23691a6 commit b9a34c0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
13 changes: 9 additions & 4 deletions R/harvest-docs.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ get_hyperlinks <- function(url) {

check_url <- function(url) {
status <-
httr2::request(url) |>
httr2::req_error(is_error = function(resp) FALSE) |>
httr2::req_perform() |>
httr2::resp_status()
try(
{
httr2::request(url) |>
httr2::req_error(is_error = function(resp) FALSE) |>
httr2::req_perform() |>
httr2::resp_status()
},
TRUE
)
status
}

Expand Down
2 changes: 1 addition & 1 deletion R/stream-azure-openai.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ stream_chat_azure_openai <- function(prompt = NULL,
messages = messages
)

token <- retrieve_azure_token()

response <-
httr2::request(Sys.getenv("AZURE_OPENAI_ENDPOINT")) |>
Expand All @@ -28,6 +27,7 @@ stream_chat_azure_openai <- function(prompt = NULL,
)

if (use_token) {
token <- retrieve_azure_token()
response <- response |> httr2::req_auth_bearer_token(token = token)
}

Expand Down

0 comments on commit b9a34c0

Please sign in to comment.