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
e6690e6c
Commit
e6690e6c
authored
Jul 15, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: remove agent mode llm params
parent
9c5cdd7d
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
8 additions
and
11 deletions
+8
-11
orchestrator_rule_parser.py
api/core/orchestrator_rule_parser.py
+2
-1
model.py
api/models/model.py
+1
-1
app_model_config_service.py
api/services/app_model_config_service.py
+5
-9
No files found.
api/core/orchestrator_rule_parser.py
View file @
e6690e6c
...
...
@@ -39,11 +39,12 @@ class OrchestratorRuleParser:
return
None
agent_mode_config
=
self
.
app_model_config
.
agent_mode_dict
model_dict
=
self
.
app_model_config
.
model_dict
chain
=
None
if
agent_mode_config
and
agent_mode_config
.
get
(
'enabled'
):
tool_configs
=
agent_mode_config
.
get
(
'tools'
,
[])
agent_model_name
=
agent_mode_config
.
get
(
'model_
name'
,
'gpt-4'
)
agent_model_name
=
model_dict
.
get
(
'
name'
,
'gpt-4'
)
# add agent callback to record agent thoughts
agent_callback
=
AgentLoopGatherCallbackHandler
(
...
...
api/models/model.py
View file @
e6690e6c
...
...
@@ -128,7 +128,7 @@ class AppModelConfig(db.Model):
@
property
def
agent_mode_dict
(
self
)
->
dict
:
return
json
.
loads
(
self
.
agent_mode
)
if
self
.
agent_mode
else
{
"enabled"
:
False
,
"tools"
:
[]}
return
json
.
loads
(
self
.
agent_mode
)
if
self
.
agent_mode
else
{
"enabled"
:
False
,
"
strategy"
:
None
,
"
tools"
:
[]}
class
RecommendedApp
(
db
.
Model
):
...
...
api/services/app_model_config_service.py
View file @
e6690e6c
import
re
import
uuid
from
core.agent.agent_executor
import
PlanningStrategy
from
core.constant
import
llm_constant
from
models.account
import
Account
from
services.dataset_service
import
DatasetService
...
...
@@ -288,16 +289,11 @@ class AppModelConfigService:
if
not
isinstance
(
config
[
"agent_mode"
][
"enabled"
],
bool
):
raise
ValueError
(
"enabled in agent_mode must be of boolean type"
)
# provider
if
'model_provider'
not
in
config
[
"agent_mode"
]
or
config
[
"agent_mode"
][
"model_provider"
]
!=
"openai"
:
raise
ValueError
(
"agent_mode.model_provider must be 'openai'"
)
if
"strategy"
not
in
config
[
"agent_mode"
]
or
not
config
[
"agent_mode"
][
"strategy"
]:
config
[
"agent_mode"
][
"strategy"
]
=
PlanningStrategy
.
ROUTER
.
value
# model.name
if
'model_name'
not
in
config
[
"agent_mode"
]:
raise
ValueError
(
"agent_mode.model_name is required"
)
if
config
[
"agent_mode"
][
"model_name"
]
not
in
SUPPORT_AGENT_MODELS
:
raise
ValueError
(
"agent_mode.model_name must be in the specified model list"
)
if
config
[
"agent_mode"
][
"strategy"
]
not
in
PlanningStrategy
.
__members__
:
raise
ValueError
(
"strategy in agent_mode must be in the specified strategy list"
)
if
"tools"
not
in
config
[
"agent_mode"
]
or
not
config
[
"agent_mode"
][
"tools"
]:
config
[
"agent_mode"
][
"tools"
]
=
[]
...
...
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