Skip to content

Langraph Integration#411

Draft
mohitcek wants to merge 10 commits into
cvs-health:developfrom
mohitcek:mc/langraph_integration
Draft

Langraph Integration#411
mohitcek wants to merge 10 commits into
cvs-health:developfrom
mohitcek:mc/langraph_integration

Conversation

@mohitcek

Copy link
Copy Markdown
Contributor

Description

Adds a new uqlm.integrations package that lets any UQLM scorer be dropped into agent frameworks—starting with LangGraph—without modifying the scorers themselves.

The design follows composition over inheritance:

  • integrations/base.py — defines the ScorerAdapter protocol and a global adapter registry (register_adapter/ resolve_adapter). Scorer classes are never touched.
  • integrations/langgraph/node.pyUQLMNode, an async-capable LangGraph node that reads a prompt (and optional response / precomputed scoring inputs) from the graph state, resolves the correct adapter for the wrapped scorer, runs it, and writes a uniform {output_key: payload} update back to the state. Includes a make_uqlm_node factory that returns a bare coroutine for direct use in StateGraph.add_node. Supports two modes: "score" (score precomputed responses, falling back to generation) and "generate_and_score".
  • integrations/langgraph/adapters/ — one adapter per scorer family, auto-registered on import:
    • shortform.py — BlackBoxUQ, WhiteBoxUQ, LLMPanel, UQEnsemble, SemanticEntropy
    • longform.py — LongTextUQ, LongTextQA, LongTextGraph (surfaces claims_data / refined_response in extra)
    • codegen.py — CodeGenUQ

Each adapter normalizes its scorer's native sync/async API into a uniform {"scores", "responses", "extra"} payload.

Also includes:

  • UQLMNode and make_uqlm_node exported from the top-level uqlm package.
  • An optional langgraph extra in pyproject.toml (langgraph>=0.2) plus nbconvert in the dev group.
  • Documentation: uqlm/integrations/README.md describing the architecture and state contract.
  • Examples: a LangGraph demo notebook and a full RAG-agent demo (examples/integration/RagAgent/) with corpus/retriever helpers and workflow diagram.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update
  • Dependency update

Checklist

  • Tests added or updated for all changed behavior
  • Docstrings updated for any new or modified public API
  • Type annotations added for any new or modified functions
  • ruff check and ruff format pass locally

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