From bbeb762e127b7ee8f6a2cbf61dc944f164b00ac9 Mon Sep 17 00:00:00 2001 From: faisal-alvi Date: Tue, 24 Oct 2023 14:57:06 +0530 Subject: [PATCH] @hook classifai_openai_characters_in_token --- includes/Classifai/Providers/OpenAI/Tokenizer.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/includes/Classifai/Providers/OpenAI/Tokenizer.php b/includes/Classifai/Providers/OpenAI/Tokenizer.php index 70663a570..b588b3cc7 100644 --- a/includes/Classifai/Providers/OpenAI/Tokenizer.php +++ b/includes/Classifai/Providers/OpenAI/Tokenizer.php @@ -35,6 +35,18 @@ class Tokenizer { */ public function __construct( $max_tokens ) { $this->max_tokens = $max_tokens; + + /** + * How many characters in one token (roughly) + * + * @since 0.1.0 + * @hook classifai_openai_characters_in_token + * + * @param int $characters_in_token How many characters in one token (roughly) + * + * @return int + */ + $this->characters_in_token = apply_filters( 'classifai_openai_characters_in_token', $this->characters_in_token ); } /**