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
e52448b8
Unverified
Commit
e52448b8
authored
Mar 14, 2024
by
呆萌闷油瓶
Committed by
GitHub
Mar 14, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:add api-version selection for azure openai APIs (#2821)
parent
1f92b55f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
2 deletions
+18
-2
_common.py
...ore/model_runtime/model_providers/azure_openai/_common.py
+2
-1
_constant.py
...e/model_runtime/model_providers/azure_openai/_constant.py
+0
-1
azure_openai.yaml
...el_runtime/model_providers/azure_openai/azure_openai.yaml
+16
-0
No files found.
api/core/model_runtime/model_providers/azure_openai/_common.py
View file @
e52448b8
...
...
@@ -15,10 +15,11 @@ from core.model_runtime.model_providers.azure_openai._constant import AZURE_OPEN
class
_CommonAzureOpenAI
:
@
staticmethod
def
_to_credential_kwargs
(
credentials
:
dict
)
->
dict
:
api_version
=
credentials
.
get
(
'openai_api_version'
,
AZURE_OPENAI_API_VERSION
)
credentials_kwargs
=
{
"api_key"
:
credentials
[
'openai_api_key'
],
"azure_endpoint"
:
credentials
[
'openai_api_base'
],
"api_version"
:
AZURE_OPENAI_API_VERSION
,
"api_version"
:
api_version
,
"timeout"
:
Timeout
(
315.0
,
read
=
300.0
,
write
=
10.0
,
connect
=
5.0
),
"max_retries"
:
1
,
}
...
...
api/core/model_runtime/model_providers/azure_openai/_constant.py
View file @
e52448b8
...
...
@@ -16,7 +16,6 @@ from core.model_runtime.entities.model_entities import (
AZURE_OPENAI_API_VERSION
=
'2024-02-15-preview'
def
_get_max_tokens
(
default
:
int
,
min_val
:
int
,
max_val
:
int
)
->
ParameterRule
:
rule
=
ParameterRule
(
name
=
'max_tokens'
,
...
...
api/core/model_runtime/model_providers/azure_openai/azure_openai.yaml
View file @
e52448b8
...
...
@@ -46,6 +46,22 @@ model_credential_schema:
placeholder
:
zh_Hans
:
在此输入您的 API Key
en_US
:
Enter your API key here
-
variable
:
openai_api_version
label
:
zh_Hans
:
API 版本
en_US
:
API Version
type
:
select
required
:
true
options
:
-
label
:
en_US
:
2024-02-15-preview
value
:
2024-02-15-preview
-
label
:
en_US
:
2023-12-01-preview
value
:
2023-12-01-preview
placeholder
:
zh_Hans
:
在此选择您的 API 版本
en_US
:
Select your API Version here
-
variable
:
base_model_name
label
:
en_US
:
Base Model
...
...
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