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