get_num_tokens_from_messages(
self,
messages: Sequence[BaseMessage],
tools: Sequence[dict[Calculate num tokens for gpt-3.5-turbo and gpt-4 with tiktoken package.
You must have the pillow installed if you want to count image tokens if
you are specifying the image as a base64 string, and you must have both
pillow and httpx installed if you are specifying the image as a URL. If
these aren't installed image inputs will be ignored in token counting.
If provided, sequence of dict, BaseModel, function, or BaseTool
to be converted to tool schemas.
Whether to allow fetching images for token counting.