Skip to content

fix: pin langchain-community<0.4 to restore ragas judge import#47

Merged
n0nuser merged 1 commit into
mainfrom
fix/ragas-langchain-community-pin
Jul 9, 2026
Merged

fix: pin langchain-community<0.4 to restore ragas judge import#47
n0nuser merged 1 commit into
mainfrom
fix/ragas-langchain-community-pin

Conversation

@n0nuser

@n0nuser n0nuser commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Summary

  • ragas 0.4.3 hard-imports langchain_community.chat_models.vertexai / .llms.VertexAI at module load time, even though LocalRAG's eval runner (evals/run_evals.py) only uses the OpenAI-compatible client against local Ollama and never touches LangChain
  • That vertexai submodule was dropped in langchain-community's 0.4 provider-split; ragas>=0.4.3 has no upper bound on langchain-community, so recent lockfile resolution picked 0.4.2 and broke the import (ModuleNotFoundError: No module named 'langchain_community.chat_models.vertexai')
  • This is the cause of the "RAGAS evaluation (offline, blocking)" CI check failing on PR refactor: dedupe LLM resilience/ingestion retries, type RAG source boundary #46 (unrelated refactor, merged via admin override)
  • Fix: pin langchain-community<0.4 in pyproject.toml, which resolves to 0.3.31 — still ships the vertexai submodule ragas needs

Test plan

  • Reproduced the ModuleNotFoundError locally before the fix
  • uv lock resolves cleanly with the new constraint (langchain-community 0.4.2 -> 0.3.31)
  • uv run python -c "import ragas" succeeds after uv sync
  • Full evals/run_evals.py --offline run against local Ollama judge (gemma3:4b) is slow on CPU-only inference on this machine (GPU passthrough not yet configured — separate follow-up) — import-level fix verified, full eval run not completed end-to-end locally. CI's "offline" RAGAS job should be the first full confirmation.

https://claude.ai/code/session_01NFJtv7kyDmx4W8u76WW9EC

ragas 0.4.3 hard-imports langchain_community.chat_models.vertexai and
langchain_community.llms.VertexAI at module load time (ragas/llms/base.py),
even though LocalRAG's eval runner only uses the openai-compatible client
against local Ollama and never touches LangChain directly. That vertexai
submodule was dropped in langchain-community's 0.4 provider-split, so any
resolution picking langchain-community>=0.4 (transitively pulled in by
ragas, which has no upper bound) breaks import at `from ragas.llms import
llm_factory` with ModuleNotFoundError.

Pinning langchain-community<0.4 resolves to 0.3.31, which still ships the
vertexai submodule ragas needs. Reproduced and verified fixed locally:
`uv run python -c "import ragas"` now succeeds.

Claude-Session: https://claude.ai/code/session_01NFJtv7kyDmx4W8u76WW9EC
@n0nuser n0nuser merged commit 67506f8 into main Jul 9, 2026
8 of 9 checks passed
@n0nuser n0nuser deleted the fix/ragas-langchain-community-pin branch July 9, 2026 04:55
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