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
2f120786
Unverified
Commit
2f120786
authored
Jan 05, 2024
by
takatost
Committed by
GitHub
Jan 05, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: reorder togetherai (#1951)
parent
6075fee5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
37 additions
and
30 deletions
+37
-30
ai_model.py
api/core/model_runtime/model_providers/__base/ai_model.py
+3
-1
_position.yaml
api/core/model_runtime/model_providers/_position.yaml
+20
-19
model_provider_factory.py
...e/model_runtime/model_providers/model_provider_factory.py
+3
-1
_position.yaml
...e/model_runtime/model_providers/openai/llm/_position.yaml
+11
-9
No files found.
api/core/model_runtime/model_providers/__base/ai_model.py
View file @
2f120786
...
@@ -148,7 +148,9 @@ class AIModel(ABC):
...
@@ -148,7 +148,9 @@ class AIModel(ABC):
position_map
=
{}
position_map
=
{}
if
os
.
path
.
exists
(
position_file_path
):
if
os
.
path
.
exists
(
position_file_path
):
with
open
(
position_file_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
position_file_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
position_map
=
yaml
.
safe_load
(
f
)
positions
=
yaml
.
safe_load
(
f
)
# convert list to dict with key as model provider name, value as index
position_map
=
{
position
:
index
for
index
,
position
in
enumerate
(
positions
)}
# traverse all model_schema_yaml_paths
# traverse all model_schema_yaml_paths
for
model_schema_yaml_path
in
model_schema_yaml_paths
:
for
model_schema_yaml_path
in
model_schema_yaml_paths
:
...
...
api/core/model_runtime/model_providers/_position.yaml
View file @
2f120786
openai
:
0
-
openai
anthropic
:
1
-
anthropic
azure_openai
:
2
-
azure_openai
google
:
3
-
google
replicate
:
4
-
replicate
huggingface_hub
:
5
-
huggingface_hub
cohere
:
6
-
cohere
zhipuai
:
7
-
togetherai
baichuan
:
8
-
zhipuai
spark
:
9
-
baichuan
minimax
:
10
-
spark
tongyi
:
11
-
minimax
wenxin
:
12
-
tongyi
jina
:
13
-
wenxin
chatglm
:
14
-
jina
xinference
:
15
-
chatglm
openllm
:
16
-
xinference
localai
:
17
-
openllm
openai_api_compatible
:
18
-
localai
\ No newline at end of file
-
openai_api_compatible
\ No newline at end of file
api/core/model_runtime/model_providers/model_provider_factory.py
View file @
2f120786
...
@@ -217,7 +217,9 @@ class ModelProviderFactory:
...
@@ -217,7 +217,9 @@ class ModelProviderFactory:
position_map
=
{}
position_map
=
{}
if
os
.
path
.
exists
(
position_file_path
):
if
os
.
path
.
exists
(
position_file_path
):
with
open
(
position_file_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
with
open
(
position_file_path
,
'r'
,
encoding
=
'utf-8'
)
as
f
:
position_map
=
yaml
.
safe_load
(
f
)
positions
=
yaml
.
safe_load
(
f
)
# convert list to dict with key as model provider name, value as index
position_map
=
{
position
:
index
for
index
,
position
in
enumerate
(
positions
)}
# traverse all model_provider_dir_paths
# traverse all model_provider_dir_paths
for
model_provider_dir_path
in
model_provider_dir_paths
:
for
model_provider_dir_path
in
model_provider_dir_paths
:
...
...
api/core/model_runtime/model_providers/openai/llm/_position.yaml
View file @
2f120786
gpt-4
:
0
-
gpt-4
gpt-4-32k
:
1
-
gpt-4-32k
gpt-4-1106-preview
:
2
-
gpt-4-1106-preview
gpt-4-vision-preview
:
3
-
gpt-4-vision-preview
gpt-3.5-turbo
:
4
-
gpt-3.5-turbo
gpt-3.5-turbo-16k
:
5
-
gpt-3.5-turbo-16k
gpt-3.5-turbo-1106
:
6
-
gpt-3.5-turbo-16k-0613
gpt-3.5-turbo-instruct
:
7
-
gpt-3.5-turbo-1106
text-davinci-003
:
8
-
gpt-3.5-turbo-0613
\ No newline at end of file
-
gpt-3.5-turbo-instruct
-
text-davinci-003
\ No newline at end of file
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