Skip to content

Commit

Permalink
Prevent entity agents from continuing to talk beyond the end of a dir…
Browse files Browse the repository at this point in the history
…ect quote.

PiperOrigin-RevId: 655915134
Change-Id: I10950fabc11a2bb153de7fb057dac0430b042bbb
  • Loading branch information
jzleibo authored and copybara-github committed Jul 25, 2024
1 parent bec726c commit abb1375
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions concordia/components/agent/v2/concat_act_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,10 @@ def get_action_attempt(
call_to_action,
max_tokens=2200,
answer_prefix=output,
# This terminator protects against the model providing extra context
# after the end of a directly spoken response, since it normally
# puts a space after a quotation mark only in these cases.
terminators=('" ', '\n'),
)
self._log(output, prompt)
return output
Expand Down
4 changes: 4 additions & 0 deletions concordia/components/agent/v2/legacy_act_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ def get_action_attempt(
call_to_action,
max_tokens=2200,
answer_prefix=output,
# This terminator protects against the model providing extra context
# after the end of a directly spoken response, since it normally
# puts a space after a quotation mark only in these cases.
terminators=('" ', '\n'),
)
self._log(output, prompt)
return output
Expand Down

0 comments on commit abb1375

Please sign in to comment.