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

Update openai sdk #422

Merged
merged 13 commits into from
Nov 10, 2023
Merged

Update openai sdk #422

merged 13 commits into from
Nov 10, 2023

Conversation

collindutter
Copy link
Member

Closes #420

@collindutter collindutter force-pushed the collindutter/openai-updates branch 8 times, most recently from b2c7ba5 to 5da7360 Compare November 7, 2023 19:22
collindutter added a commit to griptape-ai/griptape-docs that referenced this pull request Nov 7, 2023
@collindutter collindutter force-pushed the collindutter/openai-updates branch 3 times, most recently from 17836be to 3ecde82 Compare November 7, 2023 23:30
@collindutter collindutter force-pushed the collindutter/openai-updates branch from 3ecde82 to 783a643 Compare November 7, 2023 23:34
@@ -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:
Copy link
Member Author

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:
Copy link
Member Author

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,
Copy link
Member Author

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?

Copy link
Member

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]
Copy link
Member Author

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

@collindutter collindutter marked this pull request as ready for review November 8, 2023 00:34
@collindutter collindutter force-pushed the collindutter/openai-updates branch 2 times, most recently from 575cc48 to e57fbd1 Compare November 8, 2023 22:03
@@ -16,6 +16,7 @@ class OpenAiTokenizer(BaseTokenizer):
TOKEN_OFFSET = 8

MODEL_PREFIXES_TO_MAX_TOKENS = {
"gpt-4-1106": 128000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@collindutter collindutter requested a review from vasinov November 9, 2023 20:24
@collindutter collindutter force-pushed the collindutter/openai-updates branch from 95213e8 to 28415ec Compare November 9, 2023 20:26
collindutter added a commit to griptape-ai/griptape-docs that referenced this pull request Nov 9, 2023
@collindutter collindutter force-pushed the collindutter/openai-updates branch 2 times, most recently from be34c52 to bdd2b7b Compare November 9, 2023 20:32
collindutter added a commit to griptape-ai/griptape-docs that referenced this pull request Nov 9, 2023
@collindutter collindutter force-pushed the collindutter/openai-updates branch from bdd2b7b to f2462c3 Compare November 9, 2023 22:54
@collindutter collindutter merged commit 1790cfd into dev Nov 10, 2023
collindutter added a commit to griptape-ai/griptape-docs that referenced this pull request Nov 10, 2023
@collindutter collindutter deleted the collindutter/openai-updates branch November 14, 2023 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants