Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.5.0 Release #11

Merged
merged 20 commits into from
Nov 14, 2024
Merged

v0.5.0 Release #11

merged 20 commits into from
Nov 14, 2024

Conversation

mdegans
Copy link
Owner

@mdegans mdegans commented Nov 13, 2024

This release is mostly minor breaking changes and bug fixes. The features being added are mostly Markdown rendering enhancements and a ToHtml trait for anything implementing ToMarkdown.

- The `Options` are now copy and all call sites take by value. There are too many cases where it's useful to modify the options within a call to a `ToMarkdown` method and it's small enough to be faster this way.
- Option for `heading_level` added.
- Option for `attrs` added. This adds a `role` attr to the header. Mostly useful for conversion from the markdown stream to HTML.
- `Key` encryption is now an optional feature. The `Key` is still always zeroized.
- Conversion from a `Vec<u8>` and array has been removed because it would allow bypassing the invariant that the inner value is utf-8, causing a panic on display.
- Use `Zeroizing` wrapper for input to make it impossible to forget to `zeroize()`.
- The `key::Arr` type is no longer useful in the public interface because our only constructor is from a `String`.
- Fix any broken doc links
- add `doc-scrape-examples = true` for all examples.
- Remove a few unused things the compiler would have elided anyway.
- Add `html` feature and module for rendering the prompt and messages to `Html`. The same options as `markdown` are used and it requires this feature.
- For the moment, base64 encoded images are not converted to HTML because `pulldown_cmark` does not officially support this. This crate implements the images in markdown with our own markdown rendering for that bit and will require special handling of the stream or some other solution. Images will still be included, but as markdown *in* html. Whether this is rendered or not depends on what the caller does with the Html.
- Move the unencrypted and encrypted implementations of `Key` into the `key` module.
- The `len` method on `Content` and `Message` now returns the number of bytes in the text and images. It does not include metadata or tool calls. This is mostly to help detect `Message`s which before was more cumbersome.
- Merging deltas is easy because they're strings but appending them to content is not so easy because tool use's input type is a `serde_json::Value`. This allows such merges **so long as the delta is a complete json object**.  We do this to guarantee input is always valid json. However Anthropic does not currently guarantee this. Therefore it's recommended to merge such deltas manually or add complete json objects. Additions to `Stream` may be made to streamline this.
- Add more coverage. It should be around 97% now.
- Fix `Deserialize` for `Tool`. It was previously possible to deserialize an invalid `Tool` struct.
This is very important.
- The crate is now tested with no features, each feature individually, and all features together. Some breakage was fixed in testing.
- `prompt-caching` feature now works without the `image` feature which was a bug. With CI this shouldn't be possible again.
- It was not a good idea to override it. Rendering attributes should be optional.
- Which causes CI to fail because we fail on warnings. Removed conditional compilation gates when `prompt-caching` feature is enabled. The API will return an error if it doesn't work anyway.
Fix "len without is_empty" errors.
Which fails to format when there is trailing whitespace, which is very very silly.
@mdegans mdegans merged commit e91e6cc into main Nov 14, 2024
3 checks passed
@mdegans mdegans deleted the dev branch November 14, 2024 00:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant