Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
transformers
Commits
42017d82
Unverified
Commit
42017d82
authored
May 10, 2023
by
Sylvain Gugger
Committed by
GitHub
May 10, 2023
Browse files
Fix new line bug in chat mode for agents (#23267)
parent
f93509b1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
3 deletions
+1
-3
src/transformers/tools/agents.py
src/transformers/tools/agents.py
+1
-3
No files found.
src/transformers/tools/agents.py
View file @
42017d82
...
@@ -264,9 +264,7 @@ class Agent:
...
@@ -264,9 +264,7 @@ class Agent:
"""
"""
prompt
=
self
.
format_prompt
(
task
,
chat_mode
=
True
)
prompt
=
self
.
format_prompt
(
task
,
chat_mode
=
True
)
result
=
self
.
generate_one
(
prompt
,
stop
=
[
"Human:"
,
"====="
])
result
=
self
.
generate_one
(
prompt
,
stop
=
[
"Human:"
,
"====="
])
self
.
chat_history
=
prompt
+
result
self
.
chat_history
=
prompt
+
result
.
strip
()
+
"
\n
"
if
not
self
.
chat_history
.
endswith
(
"
\n
"
):
self
.
chat_history
+=
"
\n
"
explanation
,
code
=
clean_code_for_chat
(
result
)
explanation
,
code
=
clean_code_for_chat
(
result
)
print
(
f
"==Explanation from the agent==
\n
{
explanation
}
"
)
print
(
f
"==Explanation from the agent==
\n
{
explanation
}
"
)
...
...
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