-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem accessing azure opeani #60
Comments
Please let me know if you are able to get the Azure OpenAI working with the latest version. You'll need to change the name of the environmental variables in your example to match those listed here https://jameshwade.github.io/gpttools/articles/azure.html. |
Thanks James. Do you have a direct way(function) to check access, please? |
The best approach for now is to use Please let me know if it doesn't work. It's difficult for me to do much testing with Azure OpenAI since I don't have constant access to it. |
Hey @JamesHWade Thanks, This slipped my mind for a day or two. |
Any progress on this? |
Not really. I don't have the ability to test Azure OpenAI, so it's very difficult for me to debug. I'm working on getting access but don't have it yet. |
Sure. Maybe i can help if there is something specific you would need for testing, or point me out some direction. Dont really have the time to figure all ins and out of thep ackage. |
Can you please give it another try. It now works for me (I got access to Azure OpenAI). |
I tried these functions
Then I tried running the addin but it did not work. Listening on http://127.0.0.1:4475 |
Can you share your environmental variable names? For Azure OpenAI we use environmental variables to define the model name. Thanks for your persistence! This is tricky to debug. |
No thank you! Does your Azure setup work for you? If this does not work I might dig into the source code myself as it is difficult for you with our weird naming and god knows what is happening behind the scenes here as it is our private azure instance. See my setup below. |
I think the issue might be with your endpoint environmental variable. That should be a url. Something like this: https://YOUR_RESOURCE_NAME.openai.azure.com/ I'm also realizing that I don't have embedding models setup to sure Azure OpenAI. The only two options are OpenAI and local embeddings. |
like this? |
That is much longer than my url, but I don't have access to see the backend at all, unfortunately. You can see the httr2 calls here: https://github.com/JamesHWade/gpttools/blob/main/R/stream-azure-openai.R You can try something like this to help you debug. The should print to the console the call it will make just before it makes it. debug_azure_openai <- function(prompt = NULL, use_token = Sys.getenv("AZURE_OPENAI_USE_TOKEN")) {
messages <- list(
list(
role = "user",
content = prompt
)
)
body <- list(
stream = TRUE,
messages = messages
)
response <-
httr2::request(Sys.getenv("AZURE_OPENAI_ENDPOINT")) |>
httr2::req_url_path_append("openai/deployments") |>
httr2::req_url_path_append(Sys.getenv("AZURE_OPENAI_DEPLOYMENT_NAME")) |>
httr2::req_url_path_append(Sys.getenv("AZURE_OPENAI_TASK")) |>
httr2::req_url_query("api-version" = Sys.getenv("AZURE_OPENAI_API_VERSION")) |>
httr2::req_headers(
"api-key" = Sys.getenv("AZURE_OPENAI_KEY"),
"Content-Type" = "application/json"
)
if (use_token) {
token <- retrieve_azure_token()
response <- response |> httr2::req_auth_bearer_token(token = token)
}
response <-
response |>
httr2::req_body_json(data = body) |>
httr2::req_retry(max_tries = 3) |>
httr2::req_error(is_error = function(resp) FALSE)
response |> httr2::req_dry_run()
response <- response |> httr2::req_verbose() |> httr2::req_perform()
invisible(response)
} |
Apologies for the long delay.
I don't have those variables.
The problem is again the URL creation |
Just a kind reminder on this issue. :) |
I am trying to use your package but it is not possible for me as we have a private instance for my company. It would be very helpful if you could adapt the way URLs are created. The code below provides an example of how I can construct a URL for chat (I have not implemented the version for embeddings yet). It should be possible to have different versions.
In your implementation, it seems like the problem is how the [URL construction](https://github.com/JamesHWade/gpttools/bThe code below provides an lob/42f140acd7d91c439bd04dad7f5e23ac67c7fc42/R/azure_openai.R)
The code below provides an example of how I construct a URL for chat (I have not implemented the version for embeddings yet).
The text was updated successfully, but these errors were encountered: