Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for o1 models #19

Merged
merged 2 commits into from
Oct 12, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/EncoderProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
'pat' => '/[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]*[\p{Ll}\p{Lm}\p{Lo}\p{M}]+(?i:\'s|\'t|\'re|\'ve|\'m|\'ll|\'d)?|[^\r\n\p{L}\p{N}]?[\p{Lu}\p{Lt}\p{Lm}\p{Lo}\p{M}]+[\p{Ll}\p{Lm}\p{Lo}\p{M}]*(?i:\'s|\'t|\'re|\'ve|\'m|\'ll|\'d)?|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n\/]*|\s*[\r\n]+|\s+(?!\S)|\s+/u',
],
];
private const MODEL_PREFIX_TO_ENCODING = [

Check failure on line 49 in src/EncoderProvider.php

View workflow job for this annotation

GitHub Actions / Static Analysis

ParseError

src/EncoderProvider.php:49:46: ParseError: Array element cannot be empty (see https://psalm.dev/173)
"o1-": "o200k_base",

Check failure on line 50 in src/EncoderProvider.php

View workflow job for this annotation

GitHub Actions / Static Analysis

ParseError

src/EncoderProvider.php:50:14: ParseError: Syntax error, unexpected ':', expecting ',' or ']' or ')' on line 50 (see https://psalm.dev/173)
iamarsenibragimov marked this conversation as resolved.
Show resolved Hide resolved
'gpt-4o-' => 'o200k_base',
'gpt-4-' => 'cl100k_base',
'gpt-3.5-turbo-' => 'cl100k_base',
Expand Down Expand Up @@ -119,7 +120,7 @@
}

foreach (self::MODEL_PREFIX_TO_ENCODING as $prefix => $modelEncoding) {
if (str_starts_with($model, $prefix)) {

Check failure on line 123 in src/EncoderProvider.php

View workflow job for this annotation

GitHub Actions / Static Analysis

PossiblyInvalidArgument

src/EncoderProvider.php:123:41: PossiblyInvalidArgument: Argument 2 of str_starts_with expects string, but possibly different type 'gpt-3.5-turbo-'|'gpt-4-'|'gpt-4o-'|0 provided (see https://psalm.dev/092)
return $this->get($modelEncoding);
}
}
Expand Down
Loading