Skip to content

griptape integration: ImportError raised when griptape is missing tells the user to install opik #3032

Open

Description

@BlueX888

[x] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug

Importing ragas.integrations.griptape without the griptape package installed raises an ImportError that says Opik is not installed and tells the user to run pip install opik. The import that actually fails is from griptape.engines.rag import RagContext (src/ragas/integrations/griptape.py:6), so a user who follows the message installs an unrelated package and stays broken — the same error persists until griptape itself is installed.

Ragas version: 0.4.4.dev8+g298b68274 (main @ 298b682)
Python version: 3.13.15
OS: macOS 15 (arm64)

Code to Reproduce

# venv with ragas installed from main; griptape is an optional integration and is not installed
python -c "from ragas.integrations.griptape import transform_to_ragas_dataset"

Error trace

Traceback (most recent call last):
  File "/Users/admin/.claude/oss-contributor/work/ragas.tree/src/ragas/integrations/griptape.py", line 6, in <module>
    from griptape.engines.rag import RagContext  # type: ignore
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ModuleNotFoundError: No module named 'griptape'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
    from ragas.integrations.griptape import transform_to_ragas_dataset
  File "/Users/admin/.claude/oss-contributor/work/ragas.tree/src/ragas/integrations/griptape.py", line 8, in <module>
    raise ImportError(
        "Opik is not installed. Please install it using `pip install opik` to use the Opik tracer."
    )
ImportError: Opik is not installed. Please install it using `pip install opik` to use the Opik tracer.

Verified independently in two environments: after pip install opik (following the message) the exact same error persists; after pip install griptape the import succeeds (checked with griptape 1.13.0 and 1.9.4).

Expected behavior

The message should name the package that is actually missing, e.g. "Griptape is not installed. Please install it using pip install griptape to use the Griptape integration."

Basis:

  • The guarded import is from griptape.engines.rag import RagContext (src/ragas/integrations/griptape.py:5-10).
  • Every sibling integration guard names the real missing package: src/ragas/integrations/opik.py:14-16 guards from opik.integrations.langchain import OpikTracer and says opik; src/ragas/integrations/llama_index.py:149-151 says "Please install the llama_index package"; src/ragas/integrations/langsmith.py:17-19 says langsmith; src/ragas/integrations/ag_ui.py:167-170 says ag-ui-protocol.
  • The repo's own docs for this integration install griptape, not opik: docs/howtos/integrations/griptape.md runs %pip install "griptape[all]" ragas -q.

Additional context

Root cause: the except ImportError block at src/ragas/integrations/griptape.py:8-10 is a copy-paste from src/ragas/integrations/opik.py:14-16 — the file arrived with commit 51b989d carrying the opik.py message verbatim, while the import it guards is griptape.

Happy to open a PR with the one-line fix (griptape-specific message, chained with from e as ag_ui.py:170 does) — happy to be assigned.

Related: #2021 added the Griptape integration. I found no existing issue or PR reporting this (searched issues/PRs for "griptape" and "Opik is not installed").

Activity

  1. BlueX888 commented on Sep 25, 2026

    @BlueX888
    Author

    Reproduced this. Root cause: src/ragas/integrations/griptape.py:8-10 — the except ImportError handler re-raises with the message copied verbatim from src/ragas/integrations/opik.py:14-16, so the guard around the griptape import names the wrong package.

    Minimal reproduction:

    python -c "from ragas.integrations.griptape import transform_to_ragas_dataset"
    

    Observed output:

    from griptape.engines.rag import RagContext  # type: ignore
    ModuleNotFoundError: No module named 'griptape'
    During handling of the above exception, another exception occurred:
    ImportError: Opik is not installed. Please install it using `pip install opik` to use the Opik tracer.
    

    Happy to open a PR with this fix, or to be assigned if you prefer to take it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions