Skip to content

Commit b1a244c

Browse files
authored
Fix imports & migrate to get-4o-mini (#14)
* Dependencies upgrades * Add imports so it's easier to create the file * Migrate to gpt-4o-mini
1 parent 90704a9 commit b1a244c

File tree

8 files changed

+20
-9
lines changed

8 files changed

+20
-9
lines changed

docs/sections/06-chat-api.md

+11
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,17 @@ To use the fallback, add the following code in the catch statement and return th
8888
> To use the local Ollama model, you need to create a new chat model producer. At the same location where you've created the `ChatLanguageModelAzureOpenAiProducer`, create a new class called `ChatLanguageModelOllamaProducer` with the following code
8989
>
9090
> ```java
91+
> package ai.azure.openai.rag.workshop.backend.configuration;
92+
>
93+
> import dev.langchain4j.model.chat.ChatLanguageModel;
94+
> import dev.langchain4j.model.ollama.OllamaChatModel;
95+
> import jakarta.enterprise.inject.Alternative;
96+
> import jakarta.enterprise.inject.Produces;
97+
> import static java.time.Duration.ofSeconds;
98+
> import org.eclipse.microprofile.config.inject.ConfigProperty;
99+
> import org.slf4j.Logger;
100+
> import org.slf4j.LoggerFactory;
101+
>
91102
> @Alternative
92103
> public class ChatLanguageModelOllamaProducer {
93104
>

docs/sections/_old/09-azure-llm.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ RESOURCE_GROUP="rg-$PROJECT"
4444
LOCATION="swedencentral"
4545
TAG="$PROJECT"
4646
AI_SERVICE="ai-$PROJECT"
47-
AI_MODEL="gpt-35-turbo"
47+
AI_MODEL="gpt-4o-mini"
4848
```
4949

5050
#### Creating the resource group
@@ -69,7 +69,7 @@ az cognitiveservices account create \
6969
--sku "S0"
7070
````
7171

72-
#### Deploying a gpt-35-turbo model
72+
#### Deploying a gpt-4o-mini model
7373

7474
```shell
7575
az cognitiveservices account deployment create \

scripts/setup-template.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ public class ChatLanguageModelAzureOpenAiProducer {
131131
@ConfigProperty(name = \"AZURE_OPENAI_URL\")
132132
String azureOpenAiEndpoint;
133133
134-
@ConfigProperty(name = \"AZURE_OPENAI_DEPLOYMENT_NAME\", defaultValue = \"gpt-35-turbo\")
134+
@ConfigProperty(name = \"AZURE_OPENAI_DEPLOYMENT_NAME\", defaultValue = \"gpt-4o-mini\")
135135
String azureOpenAiDeploymentName;
136136
137137
@Produces

src/backend/src/main/java/ai/azure/openai/rag/workshop/backend/configuration/ChatLanguageModelAzureOpenAiProducer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class ChatLanguageModelAzureOpenAiProducer {
2020
@ConfigProperty(name = "AZURE_OPENAI_URL")
2121
String azureOpenAiEndpoint;
2222

23-
@ConfigProperty(name = "AZURE_OPENAI_DEPLOYMENT_NAME", defaultValue = "gpt-35-turbo")
23+
@ConfigProperty(name = "AZURE_OPENAI_DEPLOYMENT_NAME", defaultValue = "gpt-4o-mini")
2424
String azureOpenAiDeploymentName;
2525

2626
@Produces

trainer/infra/main.bicep

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ param openAiCapacity int // Set in main.parameters.json
2626

2727
param chatGptDeploymentName string // Set in main.parameters.json
2828
param chatGptDeploymentCapacity int = openAiCapacity
29-
param chatGptModelName string = 'gpt-35-turbo'
29+
param chatGptModelName string = 'gpt-4o-mini'
3030
param chatGptModelVersion string = '0613'
3131
param embeddingDeploymentName string // Set in main.parameters.json
3232
param embeddingDeploymentCapacity int = openAiCapacity

trainer/infra/main.parameters.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"value": "${AZURE_OPENAI_CAPACITY=200}"
2222
},
2323
"chatGptDeploymentName": {
24-
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=gpt-35-turbo}"
24+
"value": "${AZURE_OPENAI_CHATGPT_DEPLOYMENT=gpt-4o-mini}"
2525
},
2626
"embeddingDeploymentName": {
2727
"value": "${AZURE_OPENAI_EMBEDDING_DEPLOYMENT=text-embedding-ada-002}"

trainer/src/plugins/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default fp(
2323
const config: AppConfig = {
2424
azureOpenAiService: process.env.AZURE_OPENAI_SERVICE || '',
2525
azureOpenAiChatGptDeployment: process.env.AZURE_OPENAI_CHATGPT_DEPLOYMENT || 'chat',
26-
azureOpenAiChatGptModel: process.env.AZURE_OPENAI_CHATGPT_MODEL || 'gpt-35-turbo',
26+
azureOpenAiChatGptModel: process.env.AZURE_OPENAI_CHATGPT_MODEL || 'gpt-4o-mini',
2727
azureOpenAiEmbeddingDeployment: process.env.AZURE_OPENAI_EMBEDDING_DEPLOYMENT || 'embedding',
2828
azureOpenAiEmbeddingModel: process.env.AZURE_OPENAI_EMBEDDING_MODEL || 'text-embedding-ada-002',
2929
};

trainer/test.http

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
@api_host = http://localhost:3000
77

88
# Chat with the bot
9-
POST {{api_host}}/openai/deployments/gpt-35-turbo/chat/completions?api-version=2024-02-01
9+
POST {{api_host}}/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-02-01
1010
Content-Type: application/json
1111
api-key: toto
1212

@@ -26,7 +26,7 @@ api-key: toto
2626
###
2727

2828
# Chat with the bot using streaming
29-
POST {{api_host}}/openai/deployments/gpt-35-turbo/chat/completions?api-version=2024-02-01
29+
POST {{api_host}}/openai/deployments/gpt-4o-mini/chat/completions?api-version=2024-02-01
3030
content-type: application/json
3131
api-key: toto
3232

0 commit comments

Comments
 (0)