Skip to content

Commit c460ef4

Browse files
authored
Merge pull request #39 from zioproto/gpt4o
Make the completion model configurable
2 parents 48d732b + b5934c8 commit c460ef4

File tree

5 files changed

+32
-13
lines changed

5 files changed

+32
-13
lines changed

infra/installation_script.tftpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ data:
2727
OPENAI_API_TYPE=azuread
2828
OPENAI_API_VERSION=2023-05-15
2929
OPENAI_API_BASE=${endpoint}
30+
CHAT_MODEL_NAME=${chat_model_name}
3031
---
3132
apiVersion: v1
3233
kind: Pod

infra/openai.tf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ module "openai" {
1717
}
1818
deployment = {
1919
"chat_model" = {
20-
name = "gpt-35-turbo"
20+
name = var.chat_model_name
2121
model_format = "OpenAI"
22-
model_name = "gpt-35-turbo"
23-
model_version = "0301"
24-
scale_type = "Standard"
25-
capacity = 120
22+
model_name = var.chat_model_name
23+
model_version = var.chat_model_version
24+
scale_type = var.scale_type
25+
capacity = 30
2626
},
2727
"embedding_model" = {
2828
name = "text-embedding-ada-002"

infra/output.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
output "installation-script" {
22
value = templatefile("installation_script.tftpl",
3-
{ resourceGroup = azurerm_resource_group.this.name,
4-
aksName = module.aks.aks_name,
5-
registry = azurerm_container_registry.acr.name,
6-
endpoint = module.openai.openai_endpoint,
7-
clientid = azurerm_user_assigned_identity.chatbot.client_id,
8-
oidc_url = module.aks.oidc_issuer_url,
3+
{ resourceGroup = azurerm_resource_group.this.name,
4+
aksName = module.aks.aks_name,
5+
registry = azurerm_container_registry.acr.name,
6+
endpoint = module.openai.openai_endpoint,
7+
clientid = azurerm_user_assigned_identity.chatbot.client_id,
8+
oidc_url = module.aks.oidc_issuer_url,
9+
chat_model_name = var.chat_model_name
910
}
1011
)
1112
}

infra/variables.tf

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
11
variable "region" {
22
type = string
33
default = "eastus"
4-
}
4+
}
5+
6+
variable "chat_model_name" {
7+
type = string
8+
default = "gpt-4o"
9+
}
10+
11+
variable "chat_model_version" {
12+
type = string
13+
default = "2024-08-06"
14+
}
15+
16+
variable "scale_type" {
17+
type = string
18+
description = "values: GlobalStandard, Standard"
19+
default = "GlobalStandard"
20+
}

sample-application/chatbot.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
OPENAI_API_VERSION = 2023-05-15
99
OPENAI_API_BASE = 'https://eastus.api.cognitive.microsoft.com/' # Replace with the URL of an Azure OpenAI
1010
OPENAI_API_KEY = '' # Replace with the corresponding API key
11+
CHAT_MODEL_NAME = gpt-4o
1112
1213
To run the application, use the following command:
1314
streamlit run chatbot.py
@@ -81,7 +82,7 @@ def send_click():
8182
Settings.context_window = 4096
8283
# Create the chat llm
8384
Settings.llm = AzureChatOpenAI(
84-
deployment_name="gpt-35-turbo",
85+
deployment_name=st.session_state.config["CHAT_MODEL_NAME"],
8586
openai_api_key=st.session_state.config["OPENAI_API_KEY"],
8687
openai_api_base=st.session_state.config["OPENAI_API_BASE"],
8788
openai_api_type=st.session_state.config["OPENAI_API_TYPE"],

0 commit comments

Comments
 (0)