Macro prompt_args

Source
macro_rules! prompt_args {
    ( $($key:expr => $value:expr),* $(,)? ) => { ... };
}
Expand description

prompt_args! is a utility macro used for creating a std::collections::HashMap<String, serde_json::Value>. This HashMap can then be passed as arguments to a function or method.

§Usage

In this macro, the keys are &str and values are arbitrary types that get serialized into serde_json::Value:

prompt_args! {
    "input" => "Who is the writer of 20,000 Leagues Under the Sea, and what is my name?",
    "history" => vec![
        Message::new_human_message("My name is: Luis"),
        Message::new_ai_message("Hi Luis"),
    ],
}

§Arguments

  • key - A &str that will be used as the key in the resulting HashMap.
  • value - An arbitrary type that will be serialized into serde_json::Value and associated with the corresponding key.

The precise keys and values are dependent on your specific use case. In this example, “input” and “history” are keys, and