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

cookbook: competitors matrix example for image extraction #346

Merged
merged 11 commits into from
Feb 18, 2024

Conversation

fpingham
Copy link
Contributor

No description provided.

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Several improvements suggested.

Summary:

This PR adds a new example script that uses OpenAI's GPT-4 vision model to identify and categorize competitors from images, and saves the results in a JSON file.

Key points:

  • New example script competitors.py added.
  • Uses OpenAI's GPT-4 vision model to identify competitors from images.
  • Categorizes competitors by industry and extracts key features.
  • Results are saved in a JSON file.
  • Includes error handling for file reading and logging for process tracking.

Generated with ❤️ by ellipsis.dev

Comment on lines 34 to 36
competitor_list: List[Competitor] = Field(
description="A dict of competitors where each key is an industry"
)
Copy link
Contributor

Choose a reason for hiding this comment

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

The description for the 'competitor_list' field is misleading. It's not a dictionary but a list of 'Competitor' objects. Please update the description to accurately reflect the data structure.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The description for the 'competitor_list' field is misleading. It's not a dictionary but a list of 'Competitor' objects. Please update the description to accurately reflect the data structure.

you are right mr ellipsis, will fix asap

@jxnl
Copy link
Owner

jxnl commented Jan 16, 2024

wanna add a cookbook example?

@fpingham
Copy link
Contributor Author

wanna add a cookbook example?

Yeah, will make one - I take it it should be under docs/examples?

@jxnl
Copy link
Owner

jxnl commented Jan 18, 2024

yup and make sure to add it to mkdocs.yaml

@fpingham
Copy link
Contributor Author

yup and make sure to add it to mkdocs.yaml

will do

@fpingham
Copy link
Contributor Author

@jxnl cookbook added + added to mkdocs

fyi: will be OOO this week and without connection so will see any new messages next week

# Apply the patch to the OpenAI client
# enables response_model keyword
client = instructor.patch(
OpenAI(mode=instructor.Mode.MD_JSON)
Copy link
Owner

Choose a reason for hiding this comment

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

Suggested change
OpenAI(mode=instructor.Mode.MD_JSON)
OpenAI(), mode=instructor.Mode.MD_JSON

does this code run? lol

Copy link
Owner

Choose a reason for hiding this comment

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

Also why is it slides and not competitors? This is a different example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

honestly it seemed that 'slides' was a better name because its more generic, i.e. this example is about extracting anything from a slide, not specifically competitors

I changed the name of the .py file to slides to make it symmetric, let me know if you agree

@jxnl jxnl changed the title competitors matrix example for image extraction cookbook: competitors matrix example for image extraction Feb 6, 2024
examples/vision/slides.py Outdated Show resolved Hide resolved
examples/vision/slides.py Outdated Show resolved Hide resolved
examples/vision/slides.py Outdated Show resolved Hide resolved
@fpingham
Copy link
Contributor Author

hey @jxnl just in case you didn't see it, I resolved your comments a few days ago - this should be ready to merge

@jxnl
Copy link
Owner

jxnl commented Feb 14, 2024

can you run ruff and i'll merge

@fpingham
Copy link
Contributor Author

Ruff is passing

@jxnl jxnl merged commit 66a8285 into jxnl:main Feb 18, 2024
7 of 8 checks passed
@fpingham fpingham deleted the add_vision_tests branch March 8, 2024 15:05
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.

None yet

2 participants