Skip to content

Replace deprecated run method with invoke

Tan Le requested to merge fix-deprecated-lang-chain-run into main

What does this merge request do and why?

Replace deprecated run method with invoke.

❯ poetry run promptlib code-suggestions eval --test-run --sample-size 1 --config-file data/config/codesuggestion_config.json
Requesting completions from claude-2.1: 0it [00:00, ?it/s]/Users/tanle/code/gitlab/ai-validation/prompt-library/.venv/lib/python3.11/site-packages/langchain_core/_api/deprecation.py:117: LangChainDeprecationWarning: The function `run` was deprecated in LangChain 0.1.0 and will be removed in 0.2.0. Use invoke instead.
  warn_deprecated(
--snip--

How to set up and validate locally

  1. Ensure GCP environment variables are setup.
  2. Check out to this merge request's branch.
  3. Run the follow command to kick off a Code Suggestions pipeline.
    poetry run promptlib code-suggestions eval --test-run --sample-size 1 --config-file data/config/codesuggestion_config.json
  4. Confirm the deprecation message no longer appears.

Merge request checklist

  • I've ran the affected pipeline(s) to validate that nothing is broken.
  • Tests added for new functionality. If not, please raise an issue to follow up.
  • Documentation added/updated, if needed.

Merge request reports