Skip to content

Test langchain v1#18802

Merged
B-Step62 merged 12 commits intomlflow:masterfrom
B-Step62:fix-lc-dev
Nov 21, 2025
Merged

Test langchain v1#18802
B-Step62 merged 12 commits intomlflow:masterfrom
B-Step62:fix-lc-dev

Conversation

@B-Step62
Copy link
Collaborator

@B-Step62 B-Step62 commented Nov 12, 2025

🛠 DevTools 🛠

Open in GitHub Codespaces

Install mlflow from this PR

# mlflow
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/18802/merge
# mlflow-skinny
pip install git+https://github.com/mlflow/mlflow.git@refs/pull/18802/merge#subdirectory=libs/skinny

For Databricks, use the following command:

%sh curl -LsSf https://raw.githubusercontent.com/mlflow/mlflow/HEAD/dev/install-skinny.sh | sh -s pull/18802/merge

What changes are proposed in this pull request?

Enable LangChain v1 tests and fix them.

How is this PR tested?

  • Existing unit/integration tests
  • New unit/integration tests
  • Manual tests

Does this PR require documentation update?

  • No. You can skip the rest of this section.
  • Yes. I've updated:
    • Examples
    • API references
    • Instructions

Release Notes

Is this a user-facing change?

  • No. You can skip the rest of this section.
  • Yes. Give a description of this change to be included in the release notes for MLflow users.

What component(s), interfaces, languages, and integrations does this PR affect?

Components

  • area/tracking: Tracking Service, tracking client APIs, autologging
  • area/models: MLmodel format, model serialization/deserialization, flavors
  • area/model-registry: Model Registry service, APIs, and the fluent client calls for Model Registry
  • area/scoring: MLflow Model server, model deployment tools, Spark UDFs
  • area/evaluation: MLflow model evaluation features, evaluation metrics, and evaluation workflows
  • area/gateway: MLflow AI Gateway client APIs, server, and third-party integrations
  • area/prompts: MLflow prompt engineering features, prompt templates, and prompt management
  • area/tracing: MLflow Tracing features, tracing APIs, and LLM tracing functionality
  • area/projects: MLproject format, project running backends
  • area/uiux: Front-end, user experience, plotting, JavaScript, JavaScript dev server
  • area/build: Build and test infrastructure for MLflow
  • area/docs: MLflow documentation pages

How should the PR be classified in the release notes? Choose one:

  • rn/none - No description will be included. The PR will be mentioned only by the PR number in the "Small Bugfixes and Documentation Updates" section
  • rn/breaking-change - The PR will be mentioned in the "Breaking Changes" section
  • rn/feature - A new user-facing feature worth mentioning in the release notes
  • rn/bug-fix - A user-facing bug fix worth mentioning in the release notes
  • rn/documentation - A user-facing documentation change worth mentioning in the release notes

Should this PR be included in the next patch release?

Yes should be selected for bug fixes, documentation updates, and other small changes. No should be selected for new features and larger changes. If you're unsure about the release classification of this PR, leave this unchecked to let the maintainers decide.

What is a minor/patch release?
  • Minor release: a release that increments the second part of the version number (e.g., 1.2.0 -> 1.3.0).
    Bug fixes, doc updates and new features usually go into minor releases.
  • Patch release: a release that increments the third part of the version number (e.g., 1.2.0 -> 1.2.1).
    Bug fixes and doc updates usually go into patch releases.
  • Yes (this PR will be cherry-picked and included in the next patch release)
  • No (this PR will be included in the next minor release)

@B-Step62 B-Step62 added the enable-dev-tests Enables cross-version tests for dev versions label Nov 12, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 12, 2025

Documentation preview for cd222c7 is available at:

More info
  • Ignore this comment if this PR does not change the documentation.
  • The preview is updated when a new commit is pushed to this PR.
  • This comment was created by this workflow run.
  • The documentation was built by this workflow run.

@B-Step62 B-Step62 force-pushed the fix-lc-dev branch 2 times, most recently from 38e3417 to 936fbac Compare November 14, 2025 18:05
@B-Step62 B-Step62 changed the title Test langchain v1 [WIP] Test langchain v1 Nov 14, 2025
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>

agent = create_openai_agent()
llm = FakeOpenAI()
agent = create_agent(llm, [add, multiply], system_prompt="You are a helpful assistant")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: AgentExecutor is removed and now create_agent returns a langgraph-based agent.


# NB: We run this test suite twice - once with langchain_community installed and once without.
try:
from langchain_community.chat_models import ChatOpenAI
Copy link
Collaborator Author

@B-Step62 B-Step62 Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: ChatOpenAI in the community version is deprecated since 0.0.10, we don't need to test

# So the expected output will be the prompt itself.
TEST_CONTENT = "What is MLflow?"

_SIMPLE_MODEL_CODE_PATH = "tests/langchain/sample_code/simple_runnable.py"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Serialization-based logging does not work with LangChain v1. Switching to code-based logging only. Will update the doc in a follow-up.

assert trace.data.spans[0].name == "always_fail"


def test_llmchain_autolog(async_logging_enabled):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: LLMChain has been deprecated since 0.1.17


@skip_when_testing_trace_sdk
@pytest.mark.parametrize("log_traces", [True, False])
def test_langchain_tracing_evaluate(log_traces):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Updated evaluation test to use the new GenAI evaluate and removed the legacy test_langchain_evaluation.py



def get_vector_search(
use_partner_package: bool,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: We only need to test the partner package (databricks-langchain). The community version has been deprecated long ago.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Duplicates to a test case in callback test.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: There are many tests that use chain classes deprecated long ago (0.1.x). Removed most of them.

Copy link
Member

@harupy harupy Nov 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can remove them first in a separate PR to reduce the amount of diff?

Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
@B-Step62 B-Step62 added team-review Trigger a team review request rn/none List under Small Changes in Changelogs. labels Nov 20, 2025
@github-actions github-actions bot added area/build Build and test infrastructure for MLflow and removed area/build Build and test infrastructure for MLflow labels Nov 20, 2025
@B-Step62 B-Step62 changed the title [WIP] Test langchain v1 Test langchain v1 Nov 20, 2025
Copy link
Member

@BenWilson2 BenWilson2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Quite the overhaul. All the legacy cleanup looks great!

Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
@B-Step62 B-Step62 added this pull request to the merge queue Nov 21, 2025
Merged via the queue into mlflow:master with commit 82edf51 Nov 21, 2025
69 checks passed
@B-Step62 B-Step62 deleted the fix-lc-dev branch November 21, 2025 11:30
jimilp7 pushed a commit to backspace-org/mlflow that referenced this pull request Nov 21, 2025
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Tian-Sky-Lan pushed a commit to Tian-Sky-Lan/mlflow that referenced this pull request Nov 24, 2025
Signed-off-by: B-Step62 <yuki.watanabe@databricks.com>
Signed-off-by: Tian Lan <sky.blue266000@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/build Build and test infrastructure for MLflow enable-dev-tests Enables cross-version tests for dev versions rn/none List under Small Changes in Changelogs. team-review Trigger a team review request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants