fix: name griptape instead of opik in griptape integration ImportError by BlueX888 · Pull Request #3033 · vibrantlabsai/ragas · GitHub
Skip to content

fix: name griptape instead of opik in griptape integration ImportError - #3033

Open
BlueX888 wants to merge 1 commit into
vibrantlabsai:mainfrom
BlueX888:fix/prep-griptape-importerror-says-opik
Open

BlueX888 wants to merge 1 commit into
vibrantlabsai:mainfrom
BlueX888:fix/prep-griptape-importerror-says-opik

Conversation

@BlueX888

Copy link
Copy Markdown

Issue Link / Problem Description

  • No existing issue tracked this; found while reading the integrations package.

src/ragas/integrations/griptape.py wraps from griptape.engines.rag import RagContext in a try/except whose message was copied verbatim from the Opik tracer, so a missing griptape install tells users to install the wrong package:

except ImportError:
    raise ImportError(
        "Opik is not installed. Please install it using `pip install opik` to use the Opik tracer."
    )

Reproduce with a plain install (no extras) and:

>>> import ragas.integrations.griptape
ImportError: Opik is not installed. Please install it using `pip install opik` to use the Opik tracer.

Changes Made

  • src/ragas/integrations/griptape.py: the ImportError now names the package that is actually missing (pip install griptape) and chains the original error with from e, matching the guard style in src/ragas/integrations/ag_ui.py.
  • tests/unit/integrations/test_griptape.py: regression test that simulates a missing griptape module and asserts the raised ImportError mentions griptape, not opik, and chains the original ImportError.

Testing

How to Test

  • Automated tests added/updated
  • Manual testing steps:
    1. uv run --active pytest tests/unit/integrations/test_griptape.py — passes (1 passed); fails on main with AssertionError: assert 'griptape' in 'opik is not installed. please install it using pip install opik to use the opik tracer.'
    2. uv run --active pytest tests/unit — 805 passed, 89 skipped; the 7 remaining failures (test_tracing.py::TestLangfuseIntegration ×2, test_experiment.py::TestVersionExperiment ×5) also fail on unpatched main and are unrelated to this change
    3. uv run --active ruff check src tests docs --exclude src/ragas/_version.py --config pyproject.toml — All checks passed!
    4. uv run --active ruff format --check src/ragas/integrations/griptape.py tests/unit/integrations/test_griptape.py --config pyproject.toml — 2 files already formatted
    5. PYRIGHT_PYTHON_FORCE_VERSION=latest uv run --active pyright -p pyproject.toml src/ragas/integrations/griptape.py — 0 errors, 0 warnings, 0 informations

References

  • Related issues: none found
  • Same guard pattern already used in src/ragas/integrations/ag_ui.py

Screenshots/Examples (if applicable)

Before:

ImportError: Opik is not installed. Please install it using `pip install opik` to use the Opik tracer.

After:

ImportError: Griptape is not installed. Please install it using `pip install griptape` to use the Griptape integration.

The except ImportError guard around `from griptape.engines.rag import
RagContext` re-raised with the message copied verbatim from opik.py, so a
missing griptape install told users to run `pip install opik`. Name the
package that is actually missing and chain the original ImportError with
`from e`, matching the ag_ui integration guard.

This branch has not been deployed

No deployments
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.

1 participant