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

Fix #83 Read image data within the convo with the bot #87

Closed
wants to merge 17 commits into from

Conversation

gnuser
Copy link

@gnuser gnuser commented May 19, 2024

This pull request is indented to resolve #83

using this vision api

@seratch seratch marked this pull request as draft May 19, 2024 12:18
@seratch seratch added the enhancement New feature or request label May 19, 2024
@gnuser
Copy link
Author

gnuser commented May 19, 2024

@seratch , how can I add more commits to fix the check errors?

Copy link
Owner

@seratch seratch left a comment

Choose a reason for hiding this comment

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

I haven't checked the changes in detail but here are a few things I wanted to mention so far; I am feeling that this PR still needs more changes

) -> int:
"""Returns the number of tokens used by a list of messages."""
Copy link
Owner

Choose a reason for hiding this comment

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

I prefer less changes here. you can extract common parts for supporting new patterns but there is no need to completely rewrite.

Copy link
Author

Choose a reason for hiding this comment

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

ok, just use ai to help refactor, I think it's too long

def encode_and_count_tokens(value, encoding):
if isinstance(value, str):
return len(encoding.encode(value))
elif isinstance(value, list):
Copy link
Owner

Choose a reason for hiding this comment

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

this pattern is not consistent with calculate_num_tokens

requirements.txt Outdated
@@ -4,3 +4,5 @@ openai>=1.30.1,<2
tiktoken>=0.6,<0.7
# https://github.com/Yelp/elastalert/issues/2306
urllib3<2
# https://github.com/python-pillow/Pillow
pillow==0.4.0
Copy link
Owner

Choose a reason for hiding this comment

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

which code requires this?

Copy link
Author

Choose a reason for hiding this comment

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

sorry, updated, should be 9.4.0

@seratch
Copy link
Owner

seratch commented May 19, 2024

please resolve the lint errors on your branch first; you can do so with your fork as these validations do not require any extra settings

return None


def raise_not_supported_error(model: str):
Copy link
Owner

Choose a reason for hiding this comment

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

this change is not bad but please avoid introducing non-essential changes to your goal. we can do this separately. keep your diff as small as possible

@gnuser
Copy link
Author

gnuser commented May 19, 2024

@seratch Do you think we should use another PR for the refactor?

@seratch seratch changed the title Support read image Fix #83 Read and generate image data within the convo with the bot May 19, 2024
@seratch
Copy link
Owner

seratch commented May 19, 2024

@gnuser Thanks for updating the PR! Before doing refactoring, it seems your change still need updates. I will check the behavior and apply a few additional changes. As for refactoring work in general, I am open to any improvements, but it does not mean I always accept them.

@seratch seratch changed the title Fix #83 Read and generate image data within the convo with the bot Fix #83 Read image data within the convo with the bot May 20, 2024
@seratch
Copy link
Owner

seratch commented May 20, 2024

Closing this in favor of #88

@seratch seratch closed this May 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Read image data within the convo with the bot
2 participants