Function 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 Result which is Ok if the tool chat completion arguments were successfully obtained, and Err otherwise. The Ok variant contains a tuple where the first element is a ChatCompletionTool representing the chat completion arguments for the tool, and the second element is a usize representing the total count of tokens in the tool’s JSON representation.