mirror of
https://github.com/microsoft/autogen.git
synced 2025-08-19 14:12:12 +00:00

## Why are these changes needed? This PR fixes a `400 - invalid_request_error` that occurs when using Anthropic models and the **final message is from the assistant and ends with trailing whitespace**. Example error: ``` Error code: 400 - {'error': {'code': 'invalid_request_error', 'message': 'messages: final assistant content cannot end with trailing whitespace', ...}} ``` To unblock ongoing internal usage, this patch introduces an **ad-hoc fix** that strips trailing whitespace if the model is Anthropic and the last message is from the assistant. ## Related issue number Ad-hoc fix for issue discussed here: https://github.com/microsoft/autogen/issues/6167 Follow-up structural proposal here: https://github.com/microsoft/autogen/issues/6167 https://github.com/microsoft/autogen/issues/6167#issuecomment-2768592840
AutoGen Extensions
AutoGen is designed to be extensible. The autogen-ext
package contains many different component implementations maintained by the AutoGen project. However, we strongly encourage others to build their own components and publish them as part of the ecosytem.