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 isOk
if the function chat completion arguments were successfully obtained, andErr
otherwise. TheOk
variant contains a tuple where the first element is aChatCompletionFunctions
representing the chat completion arguments for the function, and the second element is ausize
representing the total count of tokens in the function’s JSON representation.