-
Notifications
You must be signed in to change notification settings - Fork 190
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
Update openai sdk #422
Update openai sdk #422
Conversation
b2c7ba5
to
5da7360
Compare
17836be
to
3ecde82
Compare
3ecde82
to
783a643
Compare
@@ -32,7 +32,7 @@ class BasePromptDriver(ExponentialBackoffMixin, ABC): | |||
tokenizer: BaseTokenizer | |||
stream: bool = field(default=False, kw_only=True) | |||
|
|||
def max_output_tokens(self, text: str) -> int: | |||
def max_output_tokens(self, text: str | list) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated, just fixing pyright errors.
@@ -16,7 +17,7 @@ class BaseTokenizer(ABC): | |||
def max_tokens(self) -> int: | |||
... | |||
|
|||
def count_tokens_left(self, text: str) -> int: | |||
def count_tokens_left(self, text: str | list) -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore, just fixing pyright errors.
@@ -16,6 +16,7 @@ class OpenAiTokenizer(BaseTokenizer): | |||
TOKEN_OFFSET = 8 | |||
|
|||
MODEL_PREFIXES_TO_MAX_TOKENS = { | |||
"gpt-4-1106": 128000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't find anywhere online that documents the exact number. It's not a clean power of 2 like the other limits, so maybe it is exactly 128000
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -16,7 +16,7 @@ class PromptStack: | |||
|
|||
@dataclass | |||
class Input: | |||
content: str | |||
content: str | list[dict] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting up for other content types
575cc48
to
e57fbd1
Compare
@@ -16,6 +16,7 @@ class OpenAiTokenizer(BaseTokenizer): | |||
TOKEN_OFFSET = 8 | |||
|
|||
MODEL_PREFIXES_TO_MAX_TOKENS = { | |||
"gpt-4-1106": 128000, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
95213e8
to
28415ec
Compare
be34c52
to
bdd2b7b
Compare
bdd2b7b
to
f2462c3
Compare
Closes #420