Skip to content

Refactor Azure OpenAI Initialization and Model Handling #510

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

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions services/azureService.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AzureOpenAIService {
await writePromptToFile(systemPrompt, truncatedContent);

const response = await this.client.chat.completions.create({
model: model,
model: config.azure.deploymentName, //azure openai uses deployment name as model parameter
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Model = deploymentName here. See line 65

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but to make it consistent i used the configuration value here

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries. That was not meant in a bad way. You are absolutely right with your improvements.

It were only review comments for documentary reasons.

messages: [
{
role: "system",
Expand Down Expand Up @@ -228,7 +228,7 @@ class AzureOpenAIService {

// Make API request
const response = await this.client.chat.completions.create({
model: process.env.AZURE_DEPLOYMENT_NAME,
model: config.azure.deploymentName, //azure openai uses deployment name as model parameter
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It uses the deploymentName already here. Just loaded from ENV

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes but to make it consistent i used the configuration value here

messages: [
{
role: "system",
Expand Down
2 changes: 1 addition & 1 deletion services/setupService.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ class SetupService {
deploymentName: deploymentName,
apiVersion: apiVersion });
const response = await openai.chat.completions.create({
model: "gpt-4o-mini",
model: deploymentName, //azure openai uses deployment name as model parameter
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At this point your suggestion is correct.

messages: [{ role: "user", content: "Test" }],
});
const now = new Date();
Expand Down