Function get_function_chat_completion_args

Source
pub fn get_function_chat_completion_args(
    func: impl Fn() -> (Value, usize),
) -> Result<(Vec<FunctionObject>, usize), OpenAIError>
Expand description

A function to get the chat completion arguments for a function.

§Arguments

  • func - A function that returns a JSON representation of a function and the count of tokens in the representation.

§Returns

  • A Result which is Ok if the function chat completion arguments were successfully obtained, and Err otherwise. The Ok variant contains a tuple where the first element is a ChatCompletionFunctions representing the chat completion arguments for the function, and the second element is a usize representing the total count of tokens in the function’s JSON representation.