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
7936d8dd
Commit
7936d8dd
authored
Jul 19, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/universal-chat' into deploy/dev
parents
aa840903
58d6b9be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
azure_provider.py
api/core/llm/provider/azure_provider.py
+7
-4
No files found.
api/core/llm/provider/azure_provider.py
View file @
7936d8dd
...
...
@@ -9,6 +9,9 @@ from core.llm.provider.errors import ValidateFailedError
from
models.provider
import
ProviderName
AZURE_OPENAI_API_VERSION
=
'2023-06-01-preview'
class
AzureProvider
(
BaseProvider
):
def
get_models
(
self
,
model_id
:
Optional
[
str
]
=
None
,
credentials
:
Optional
[
dict
]
=
None
)
->
list
[
dict
]:
credentials
=
self
.
get_credentials
(
model_id
)
if
not
credentials
else
credentials
...
...
@@ -61,7 +64,7 @@ class AzureProvider(BaseProvider):
except
:
config
=
{
'openai_api_type'
:
'azure'
,
'openai_api_version'
:
'2023-03-15-preview'
,
'openai_api_version'
:
AZURE_OPENAI_API_VERSION
,
'openai_api_base'
:
''
,
'openai_api_key'
:
''
}
...
...
@@ -70,7 +73,7 @@ class AzureProvider(BaseProvider):
if
not
config
.
get
(
'openai_api_key'
):
config
=
{
'openai_api_type'
:
'azure'
,
'openai_api_version'
:
'2023-03-15-preview'
,
'openai_api_version'
:
AZURE_OPENAI_API_VERSION
,
'openai_api_base'
:
''
,
'openai_api_key'
:
''
}
...
...
@@ -92,7 +95,7 @@ class AzureProvider(BaseProvider):
raise
ValueError
(
'Config must be a object.'
)
if
'openai_api_version'
not
in
config
:
config
[
'openai_api_version'
]
=
'2023-03-15-preview'
config
[
'openai_api_version'
]
=
AZURE_OPENAI_API_VERSION
models
=
self
.
get_models
(
credentials
=
config
)
...
...
@@ -131,7 +134,7 @@ class AzureProvider(BaseProvider):
"""
return
json
.
dumps
({
'openai_api_type'
:
'azure'
,
'openai_api_version'
:
'2023-03-15-preview'
,
'openai_api_version'
:
AZURE_OPENAI_API_VERSION
,
'openai_api_base'
:
config
[
'openai_api_base'
],
'openai_api_key'
:
self
.
encrypt_token
(
config
[
'openai_api_key'
])
})
...
...
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