Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
1d91535b
Unverified
Commit
1d91535b
authored
Jan 17, 2024
by
takatost
Committed by
GitHub
Jan 17, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: azure customize model name duplicate (#2073)
parent
8799c888
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
llm.py
...ore/model_runtime/model_providers/azure_openai/llm/llm.py
+6
-4
text_embedding.py
...l_providers/azure_openai/text_embedding/text_embedding.py
+6
-4
No files found.
api/core/model_runtime/model_providers/azure_openai/llm/llm.py
View file @
1d91535b
import
copy
import
logging
from
typing
import
Generator
,
List
,
Optional
,
Union
,
cast
...
...
@@ -625,9 +626,10 @@ class AzureOpenAILargeLanguageModel(_CommonAzureOpenAI, LargeLanguageModel):
def
_get_ai_model_entity
(
base_model_name
:
str
,
model
:
str
)
->
AzureBaseModel
:
for
ai_model_entity
in
LLM_BASE_MODELS
:
if
ai_model_entity
.
base_model_name
==
base_model_name
:
ai_model_entity
.
entity
.
model
=
model
ai_model_entity
.
entity
.
label
.
en_US
=
model
ai_model_entity
.
entity
.
label
.
zh_Hans
=
model
return
ai_model_entity
ai_model_entity_copy
=
copy
.
deepcopy
(
ai_model_entity
)
ai_model_entity_copy
.
entity
.
model
=
model
ai_model_entity_copy
.
entity
.
label
.
en_US
=
model
ai_model_entity_copy
.
entity
.
label
.
zh_Hans
=
model
return
ai_model_entity_copy
return
None
api/core/model_runtime/model_providers/azure_openai/text_embedding/text_embedding.py
View file @
1d91535b
import
base64
import
copy
import
time
from
typing
import
Optional
,
Tuple
...
...
@@ -186,9 +187,10 @@ class AzureOpenAITextEmbeddingModel(_CommonAzureOpenAI, TextEmbeddingModel):
def
_get_ai_model_entity
(
base_model_name
:
str
,
model
:
str
)
->
AzureBaseModel
:
for
ai_model_entity
in
EMBEDDING_BASE_MODELS
:
if
ai_model_entity
.
base_model_name
==
base_model_name
:
ai_model_entity
.
entity
.
model
=
model
ai_model_entity
.
entity
.
label
.
en_US
=
model
ai_model_entity
.
entity
.
label
.
zh_Hans
=
model
return
ai_model_entity
ai_model_entity_copy
=
copy
.
deepcopy
(
ai_model_entity
)
ai_model_entity_copy
.
entity
.
model
=
model
ai_model_entity_copy
.
entity
.
label
.
en_US
=
model
ai_model_entity_copy
.
entity
.
label
.
zh_Hans
=
model
return
ai_model_entity_copy
return
None
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment