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
6c148b22
Unverified
Commit
6c148b22
authored
Aug 26, 2023
by
takatost
Committed by
GitHub
Aug 26, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: dataset query truncated (#1026)
parent
4b168f48
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
3 deletions
+28
-3
multi_dataset_router_agent.py
api/core/agent/agent/multi_dataset_router_agent.py
+7
-1
openai_function_call.py
api/core/agent/agent/openai_function_call.py
+7
-0
structed_multi_dataset_router_agent.py
api/core/agent/agent/structed_multi_dataset_router_agent.py
+7
-1
structured_chat.py
api/core/agent/agent/structured_chat.py
+7
-1
No files found.
api/core/agent/agent/multi_dataset_router_agent.py
View file @
6c148b22
...
...
@@ -60,7 +60,13 @@ class MultiDatasetRouterAgent(OpenAIFunctionsAgent):
return
AgentFinish
(
return_values
=
{
"output"
:
observation
},
log
=
observation
)
try
:
return
super
()
.
plan
(
intermediate_steps
,
callbacks
,
**
kwargs
)
agent_decision
=
super
()
.
plan
(
intermediate_steps
,
callbacks
,
**
kwargs
)
if
isinstance
(
agent_decision
,
AgentAction
):
tool_inputs
=
agent_decision
.
tool_input
if
isinstance
(
tool_inputs
,
dict
)
and
'query'
in
tool_inputs
:
tool_inputs
[
'query'
]
=
kwargs
[
'input'
]
agent_decision
.
tool_input
=
tool_inputs
return
agent_decision
except
Exception
as
e
:
new_exception
=
self
.
model_instance
.
handle_exceptions
(
e
)
raise
new_exception
...
...
api/core/agent/agent/openai_function_call.py
View file @
6c148b22
...
...
@@ -97,6 +97,13 @@ class AutoSummarizingOpenAIFunctionCallAgent(OpenAIFunctionsAgent, OpenAIFunctio
messages
,
functions
=
self
.
functions
,
callbacks
=
callbacks
)
agent_decision
=
_parse_ai_message
(
predicted_message
)
if
isinstance
(
agent_decision
,
AgentAction
)
and
agent_decision
.
tool
==
'dataset'
:
tool_inputs
=
agent_decision
.
tool_input
if
isinstance
(
tool_inputs
,
dict
)
and
'query'
in
tool_inputs
:
tool_inputs
[
'query'
]
=
kwargs
[
'input'
]
agent_decision
.
tool_input
=
tool_inputs
return
agent_decision
@
classmethod
...
...
api/core/agent/agent/structed_multi_dataset_router_agent.py
View file @
6c148b22
...
...
@@ -102,7 +102,13 @@ class StructuredMultiDatasetRouterAgent(StructuredChatAgent):
raise
new_exception
try
:
return
self
.
output_parser
.
parse
(
full_output
)
agent_decision
=
self
.
output_parser
.
parse
(
full_output
)
if
isinstance
(
agent_decision
,
AgentAction
):
tool_inputs
=
agent_decision
.
tool_input
if
isinstance
(
tool_inputs
,
dict
)
and
'query'
in
tool_inputs
:
tool_inputs
[
'query'
]
=
kwargs
[
'input'
]
agent_decision
.
tool_input
=
tool_inputs
return
agent_decision
except
OutputParserException
:
return
AgentFinish
({
"output"
:
"I'm sorry, the answer of model is invalid, "
"I don't know how to respond to that."
},
""
)
...
...
api/core/agent/agent/structured_chat.py
View file @
6c148b22
...
...
@@ -106,7 +106,13 @@ class AutoSummarizingStructuredChatAgent(StructuredChatAgent, CalcTokenMixin):
raise
new_exception
try
:
return
self
.
output_parser
.
parse
(
full_output
)
agent_decision
=
self
.
output_parser
.
parse
(
full_output
)
if
isinstance
(
agent_decision
,
AgentAction
)
and
agent_decision
.
tool
==
'dataset'
:
tool_inputs
=
agent_decision
.
tool_input
if
isinstance
(
tool_inputs
,
dict
)
and
'query'
in
tool_inputs
:
tool_inputs
[
'query'
]
=
kwargs
[
'input'
]
agent_decision
.
tool_input
=
tool_inputs
return
agent_decision
except
OutputParserException
:
return
AgentFinish
({
"output"
:
"I'm sorry, the answer of model is invalid, "
"I don't know how to respond to that."
},
""
)
...
...
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