-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
708 move logic for detecting output defence bot filtering (#740)
* Renamed method to be clear what defences are being checked * Moved detection of output defences * Using await rather than then * Clearer use of the input defence report * WIP: openai file doesn't know about the defence report * WIP: Using new pushMessageToHistory method * Fixed chat history * Simpler combining of defence reports * Consistent blocking rules * Not mutating chatResponse in the performToolCalls method * Better loop * Not mutating chatResponse in the chatGptChatCompletion method * Simplified return * Method to add the user messages to chat history * Better output defence report * Moved combineChatDefenceReports to chat controller * No longer exporting getFilterList and detectFilterList * Fixed test build errors * detectTriggeredOutputDefences unit tests * Fixed chat controller tests * Removed output filtering integration tests This code is now covered by the unit tests * Moved utils method to new file * Fixed remaining tests * pushMessageToHistory unit tests * WIP: Now using the updated chat response * WIP: Fixed chat utils tests * WIP: Fixed remaining tests * Fix for response not being set properly * No longer adding transformed messae twice * Nicer chat while loop * Only sending back sent emails, not total emails * Fixed tests * Using flatMap * const updatedChatHistory in low level chat * Constructing chat response at the end of high level chat Like what is done in low level chat * Removed wrong comment * Fixed tests * Better function name * Better promise name * Not setting sent emails if the message was blocked * refactor chathistory code to reduce mutation * change test names and add comment * adds history check to first test * added second history check * removed some comments * correct some tests in integration/chatController.test * adds unit test for chatController to make sure history is updated properly * fixes defence trigger tests that were broken by mocks * refactors reused mocking code * added unit test to check history update in sandbox * update first test to include existing history * makes second test use existing history * adds comment that points out some weirdness * polishes off those tests * fixes weirdness about combining the empty defence report * fixes problem of not getting updated chat history * respond to chris - makes chatHistoryWithNewUsermessages more concise * respond to chris - adds back useful comment * simplify transformed message ternary expression * refactors transformMessage and only calls combineTransformedMessage once --------- Co-authored-by: Peter Marsh <[email protected]>
- Loading branch information
1 parent
45e2a41
commit b2f1a42
Showing
12 changed files
with
907 additions
and
367 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.