Skip to content

Commit 7d91bc7

Browse files
authored
Merge pull request #260 from stevegbrooks/bugfix/azure-skeleton
Bugfix for chat app crashing when using azure service
2 parents d314f96 + 8f34914 commit 7d91bc7

File tree

5 files changed

+26
-7
lines changed

5 files changed

+26
-7
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: gptstudio
33
Title: Use Large Language Models Directly in your Development Environment
4-
Version: 0.4.0.9017
4+
Version: 0.4.0.9018
55
Authors@R: c(
66
person("Michel", "Nivard", , "[email protected]", role = c("aut", "cph")),
77
person("James", "Wade", , "[email protected]", role = c("aut", "cre", "cph"),

NEWS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# gptstudio (development version)
22

3+
- Fixed a bug in Azure OpenAI service that prevented the chat app from working. #260
34
- Added Chinese translation for all the text elements of the UI.
45
- Fixed a bug in read_docs.R that wasn't correctly referencing the help docs of packages that contain a period (".") in their name. The code now deals with all valid R package names as defined by [CRAN](https://cran.r-project.org/doc/manuals/R-exts.html#The-DESCRIPTION-file)
56
- Fixed a bug that showed the message "ChatGPT responded" even when other service was being used in "Chat in source" related addins. #213

R/api_perform_request.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,9 @@ ellmer_chat.gptstudio_request_cohere <- function(skeleton, all_turns) {
208208
#' @export
209209
ellmer_chat.gptstudio_request_azure_openai <- function(skeleton, all_turns) {
210210
# Extract Azure-specific configuration from skeleton
211-
endpoint <- skeleton$endpoint
212-
deployment_id <- skeleton$deployment_id
213-
api_version <- skeleton$api_version %||% "2024-10-21"
211+
endpoint <- skeleton$extras$extras$endpoint
212+
deployment_id <- skeleton$extras$extras$deployment_name
213+
api_version <- skeleton$extras$extras$api_version %||% "2024-10-21"
214214

215215
chat <- ellmer::chat_azure_openai(
216216
endpoint = endpoint,

R/api_skeletons.R

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,22 @@ gptstudio_request_skeleton.azure_openai <- function(
160160
content = "You are an R chat assistant"
161161
)
162162
),
163-
stream = FALSE) {
163+
stream = FALSE,
164+
deployment_name = Sys.getenv("AZURE_OPENAI_DEPLOYMENT_NAME"),
165+
api_version = Sys.getenv("AZURE_OPENAI_API_VERSION"),
166+
endpoint = Sys.getenv("AZURE_OPENAI_ENDPOINT")) {
164167
new_gpstudio_request_skeleton(url,
165168
api_key,
166169
model,
167170
prompt,
168171
history,
169172
stream,
170-
class = "gptstudio_request_azure_openai"
173+
class = "gptstudio_request_azure_openai",
174+
extras = list(
175+
deployment_name = deployment_name,
176+
api_version = api_version,
177+
endpoint = endpoint
178+
)
171179
)
172180
}
173181

tests/testthat/_snaps/api_skeletons.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,17 @@
317317
[1] TRUE
318318
319319
$extras
320-
list()
320+
$extras$extras
321+
$extras$extras$deployment_name
322+
[1] ""
323+
324+
$extras$extras$api_version
325+
[1] ""
326+
327+
$extras$extras$endpoint
328+
[1] ""
329+
330+
321331
322332
attr(,"class")
323333
[1] "gptstudio_request_azure_openai" "gptstudio_request_skeleton"

0 commit comments

Comments
 (0)