Skip to content

Commit

Permalink
fix: only get token if use_token is true
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesHWade committed Mar 2, 2024
1 parent d0eaf41 commit e126ab0
Showing 1 changed file with 1 addition and 1 deletion.
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()

Check warning on line 30 in R/stream-azure-openai.R

View check run for this annotation

Codecov / codecov/patch

R/stream-azure-openai.R#L30

Added line #L30 was not covered by tests
response <- response |> httr2::req_auth_bearer_token(token = token)
}

Expand Down

0 comments on commit e126ab0

Please sign in to comment.