Function openai_func_enums::get_tool_chat_completion_args
source · pub fn get_tool_chat_completion_args(
tool_func: impl Fn() -> (Value, usize)
) -> Result<(Vec<ChatCompletionTool>, usize), OpenAIError>Expand description
A function to get the chat completion arguments for a tool.
§Arguments
tool_func- A function that returns a JSON representation of a tool and the count of tokens in the representation.
§Returns
- A
Resultwhich isOkif the tool chat completion arguments were successfully obtained, andErrotherwise. TheOkvariant contains a tuple where the first element is aChatCompletionToolrepresenting the chat completion arguments for the tool, and the second element is ausizerepresenting the total count of tokens in the tool’s JSON representation.