Skip to content

Commit

Permalink
@hook classifai_openai_tokens_per_word
Browse files Browse the repository at this point in the history
  • Loading branch information
faisal-alvi committed Oct 24, 2023
1 parent bbeb762 commit 8ded044
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion includes/Classifai/Providers/OpenAI/Tokenizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ public function __construct( $max_tokens ) {
* @hook classifai_openai_characters_in_token
*
* @param int $characters_in_token How many characters in one token (roughly)
* @param int $max_tokens Maximum tokens the model supports.
*
* @return int
*/
$this->characters_in_token = apply_filters( 'classifai_openai_characters_in_token', $this->characters_in_token );
$this->characters_in_token = apply_filters( 'classifai_openai_characters_in_token', $this->characters_in_token, $max_tokens );

/**
* How many tokens a word will take (roughly)
*
* @since 0.1.0
* @hook classifai_openai_tokens_per_word
*
* @param int $tokens_per_word How many tokens a word will take (roughly)
* @param int $max_tokens Maximum tokens the model supports.
*
* @return int
*/
$this->tokens_per_word = apply_filters( 'classifai_openai_tokens_per_word', $this->tokens_per_word, $max_tokens );
}

/**
Expand Down

0 comments on commit 8ded044

Please sign in to comment.