Skip to content

add image indexing tests #4477

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

Merged
merged 16 commits into from
Apr 11, 2025
Merged

add image indexing tests #4477

merged 16 commits into from
Apr 11, 2025

Conversation

pablonyx
Copy link
Contributor

@pablonyx pablonyx commented Apr 8, 2025

Description

Fixes https://linear.app/danswer/issue/DAN-1768/image-indexing-flow-tests

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

Copy link

vercel bot commented Apr 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
internal-search ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 11, 2025 8:48pm

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

This PR adds an image indexing integration test while updating settings API endpoints, file upload utilities, and test models to support image extraction and analysis.

  • Modified /backend/tests/integration/common_utils/managers/settings.py to remove outdated endpoint prefixes.
  • Added /backend/tests/integration/common_utils/connectors.py to handle file uploads with robust error handling.
  • Updated /backend/tests/integration/common_utils/test_models.py by adding new boolean fields in DATestSettings.
  • Changed REST endpoint in /backend/onyx/server/settings/api.py from PUT to PATCH for partial updates.
  • Introduced /backend/tests/integration/tests/image_indexing/indexing_images.py for end-to-end image indexing verification.

5 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines 30 to 32
test_file_dir = "tests/integration/common_utils/test_data"
os.makedirs(test_file_dir, exist_ok=True)
test_file_path = os.path.join(test_file_dir, "sample.pdf")
Copy link
Contributor

Choose a reason for hiding this comment

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

logic: Test assumes sample.pdf exists. Verify file presence or handle missing file scenarios.

Suggested change
test_file_dir = "tests/integration/common_utils/test_data"
os.makedirs(test_file_dir, exist_ok=True)
test_file_path = os.path.join(test_file_dir, "sample.pdf")
test_file_dir = "tests/integration/common_utils/test_data"
os.makedirs(test_file_dir, exist_ok=True)
test_file_path = os.path.join(test_file_dir, "sample.pdf")
assert os.path.exists(test_file_path), f"Test file {test_file_path} not found"

Copy link
Contributor

@evan-danswer evan-danswer left a comment

Choose a reason for hiding this comment

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

lgtm with a few nits

and default_provider.default_vision_model
and model_supports_image_input(
if default_provider and default_provider.default_vision_model:
if model_supports_image_input(
Copy link
Contributor

Choose a reason for hiding this comment

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

prefer keeping these if's together with and

# Safely get groups - handle detached instance case
try:
groups = [group.id for group in llm_provider_model.groups]
except Exception:
Copy link
Contributor

Choose a reason for hiding this comment

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

would prefer catching the exact exception described in the comment, but all good if you really don't want errors here

connector_id=connector.id,
access_type=AccessType.PUBLIC,
user_performing_action=admin_user,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should really have a utility that simplifies creating and linking credentials and connectors, more of a TODO item though

@pablonyx pablonyx force-pushed the image_indexing_tests branch from 7937c6d to 62d3f92 Compare April 11, 2025 20:41
@pablonyx pablonyx added this pull request to the merge queue Apr 11, 2025
Merged via the queue into main with commit 65fd8b9 Apr 11, 2025
10 of 11 checks passed
@pablonyx pablonyx deleted the image_indexing_tests branch April 11, 2025 22:53
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