Cargo Features

[dependencies]
misanthropic = { version = "0.5.1", default-features = false, features = ["image", "beta", "jpeg", "png", "gif", "webp", "prompt-caching", "log", "rustls-tls", "markdown", "html", "partial-eq", "langsan", "memsecurity"] }
default = langsan, rustls-tls

rustls because I am sick of getting Dependabot alerts for OpenSSL.

image gif? jpeg? png? webp?

Image crate support. Note that images are supported without this feature but you must handle encoding/decoding yourself. This is mostly for interop with the image crate.

Enables image

Affects message::ImageDecodeError, message::UnsupportedImageFormat

beta prompt-caching?

A beta has been enabled. It is not necessary to set this manually. Only one beta can be enabled at a time (for example, prompt-caching).

jpeg = image

Use the image crate to support JPEG images.

Enables jpeg of image

png = image

Use the image crate to support PNG images.

Enables png of image

gif = image

Use the image crate to support GIF images.

Enables gif of image

webp = image

Use the image crate to support WEBP images.

Enables webp of image

prompt-caching = beta

Enable prompt caching (recommended, however limits model choices)

Affects message::CacheControl, message::Usage.cache_creation_input_tokens, message::Usage.cache_read_input_tokens, tool::Tool.cache_control, tool::Use.cache_control, tool::Result.cache_control

log

Enable logging

Enables log

rustls-tls default

Use rustls instead of the system SSL, such as OpenSSL.

Enables rustls-tls of reqwest

rustls because I am sick of getting Dependabot alerts for OpenSSL.

markdown html?

Use pulldown-cmark for markdown parsing and pulldown-cmark-to-cmark for converting to CommonMark.

Enables pulldown-cmark and pulldown-cmark-to-cmark ^17

pulldown-cmark:

markdown support

Affects misanthropic::markdown

html = markdown, xml-rs

Utilities for converting prompts and messages to HTML. Enables markdown.

Affects misanthropic::html

partial-eq

Derive PartialEq for all structs and enums.

langsan default

Input and output sanitization

Enables langsan

memsecurity

Encrypted key in memory. Without this the key is still zeroed on drop, but is not encrypted. This is a more secure option for the paranoid. Does not build on wasm32.

Enables memsecurity

Features from optional dependencies

In crates that don't use the dep: syntax, optional dependencies automatically become Cargo features. These features may have been created by mistake, and this functionality may be removed in the future.

pulldown-cmark markdown?
xml-rs html?

Enables xml-rs

For HTML escaping