Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Anything Llm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
Mintplex Labs
Anything Llm
Commits
a5ee6121
Commit
a5ee6121
authored
1 month ago
by
timothycarambat
Browse files
Options
Downloads
Patches
Plain Diff
Add patch for `o#` models on Azure
connect #3023 Note: depends on user naming the deployment correctly.
parent
694aa85e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
server/utils/AiProviders/azureOpenAi/index.js
+14
-3
14 additions, 3 deletions
server/utils/AiProviders/azureOpenAi/index.js
with
14 additions
and
3 deletions
server/utils/AiProviders/azureOpenAi/index.js
+
14
−
3
View file @
a5ee6121
...
@@ -38,6 +38,16 @@ class AzureOpenAiLLM {
...
@@ -38,6 +38,16 @@ class AzureOpenAiLLM {
);
);
}
}
/**
* Check if the model is an o# type model.
* NOTE: This is HIGHLY dependent on if the user named their deployment "o1" or "o3-mini" or something else to match the model name.
* It cannot be determined by the model name alone since model deployments can be named arbitrarily.
* @returns {boolean}
*/
get
isOTypeModel
()
{
return
this
.
model
.
startsWith
(
"
o
"
);
}
#log
(
text
,
...
args
)
{
#log
(
text
,
...
args
)
{
console
.
log
(
`\x1b[32m[AzureOpenAi]\x1b[0m
${
text
}
`
,
...
args
);
console
.
log
(
`\x1b[32m[AzureOpenAi]\x1b[0m
${
text
}
`
,
...
args
);
}
}
...
@@ -55,6 +65,7 @@ class AzureOpenAiLLM {
...
@@ -55,6 +65,7 @@ class AzureOpenAiLLM {
}
}
streamingEnabled
()
{
streamingEnabled
()
{
if
(
this
.
isOTypeModel
&&
this
.
model
!==
"
o3-mini
"
)
return
false
;
return
"
streamGetChatCompletion
"
in
this
;
return
"
streamGetChatCompletion
"
in
this
;
}
}
...
@@ -110,7 +121,7 @@ class AzureOpenAiLLM {
...
@@ -110,7 +121,7 @@ class AzureOpenAiLLM {
attachments
=
[],
// This is the specific attachment for only this prompt
attachments
=
[],
// This is the specific attachment for only this prompt
})
{
})
{
const
prompt
=
{
const
prompt
=
{
role
:
"
system
"
,
role
:
this
.
isOTypeModel
?
"
user
"
:
"
system
"
,
content
:
`
${
systemPrompt
}${
this
.
#appendContext
(
contextTexts
)}
`
,
content
:
`
${
systemPrompt
}${
this
.
#appendContext
(
contextTexts
)}
`
,
};
};
return
[
return
[
...
@@ -131,7 +142,7 @@ class AzureOpenAiLLM {
...
@@ -131,7 +142,7 @@ class AzureOpenAiLLM {
const
result
=
await
LLMPerformanceMonitor
.
measureAsyncFunction
(
const
result
=
await
LLMPerformanceMonitor
.
measureAsyncFunction
(
this
.
openai
.
getChatCompletions
(
this
.
model
,
messages
,
{
this
.
openai
.
getChatCompletions
(
this
.
model
,
messages
,
{
temperature
,
...(
this
.
isOTypeModel
?
{}
:
{
temperature
})
,
})
})
);
);
...
@@ -161,7 +172,7 @@ class AzureOpenAiLLM {
...
@@ -161,7 +172,7 @@ class AzureOpenAiLLM {
const
measuredStreamRequest
=
await
LLMPerformanceMonitor
.
measureStream
(
const
measuredStreamRequest
=
await
LLMPerformanceMonitor
.
measureStream
(
await
this
.
openai
.
streamChatCompletions
(
this
.
model
,
messages
,
{
await
this
.
openai
.
streamChatCompletions
(
this
.
model
,
messages
,
{
temperature
,
...(
this
.
isOTypeModel
?
{}
:
{
temperature
})
,
n
:
1
,
n
:
1
,
}),
}),
messages
messages
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment