Skip to content

v0.4.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@zhudotexe zhudotexe released this 05 Oct 18:43
· 222 commits to main since this release

BREAKING CHANGES

  • Kani.full_round now emits every message generated during the round, not just assistant messages
    • This means that you will need to handle FUNCTION messages, and potentially SYSTEM messages from a function exception handler.
    • Kani.full_round_str's default behaviour is unchanged.
  • Kani.full_round_str now takes in a message_formatter rather than a function_call_formatter
    • By default, this handler only returns the contents of ASSISTANT messages.
  • Kani.do_function_call now returns a FunctionCallResult rather than a bool
    • To migrate any overriding functions, you should change the following:
    • Rather than calling Kani.add_to_history in the override, save the ChatMessage to a variable
    • Update the return value from a boolean to FunctionCallResult(is_model_turn=<old return value>, message=<message from above>)
  • Kani.handle_function_call_exception now returns a ExceptionHandleResult rather than a bool
    • To migrate any overriding functions, you should change the following:
    • Rather than calling Kani.add_to_history in the override, save the ChatMessage to a variable
    • Update the return value from a boolean to ExceptionHandleResult(should_retry=<old return value>, message=<message from above>)

Improvements

  • Added kani.utils.message_formatters
  • Added kani.ExceptionHandleResult and kani.FunctionCallResult
  • Documentation improvements

Fixes

  • Fixed an issue where ChatMessage.copy_with could cause unset values to appear in JSON serializations