Skip to main content

ContextValue

Derive Macro ContextValue 

Source
#[derive(ContextValue)]
{
    // Attributes available to this derive:
    #[context]
}
Available on crate feature derive only.
Expand description

Derives rig_core::tool::ContextValue with the type name as its default key. #[context(key = "...")] overrides the key. The type must support serde serialization and deserialization.

use rig_derive::ContextValue;

#[derive(serde::Serialize, serde::Deserialize, ContextValue)]
#[context(key = "session.id")]
struct SessionId(String);