cli[minor]: Fix bug to account for name changes (#20948)

* Fix bug to account for name changes / aliases
* Generate migration list from langchain to langchain_core
This commit is contained in:
Eugene Yurtsev
2024-04-26 15:45:11 -04:00
committed by GitHub
parent 989e4a92c2
commit 8ed150b2fe
6 changed files with 5760 additions and 26 deletions

View File

@@ -1,11 +1,14 @@
from langchain_cli.namespaces.migrate.generate.langchain import (
from langchain_cli.namespaces.migrate.generate.generic import (
generate_simplified_migrations,
generate_raw_migrations,
)
def test_create_json_agent_migration() -> None:
"""Test the migration of create_json_agent from langchain to langchain_community."""
raw_migrations = generate_simplified_migrations()
raw_migrations = generate_simplified_migrations(
from_package="langchain", to_package="langchain_community"
)
json_agent_migrations = [
migration for migration in raw_migrations if "create_json_agent" in migration[0]
]
@@ -23,3 +26,20 @@ def test_create_json_agent_migration() -> None:
"langchain_community.agent_toolkits.create_json_agent",
),
]
def test_create_single_store_retriever_db() -> None:
"""Test migration from langchain to langchain_core"""
raw_migrations = generate_simplified_migrations(
from_package="langchain", to_package="langchain_core"
)
# SingleStore was an old name for VectorStoreRetriever
single_store_migration = [
migration for migration in raw_migrations if "SingleStore" in migration[0]
]
assert single_store_migration == [
(
"langchain.vectorstores.singlestoredb.SingleStoreDBRetriever",
"langchain_core.vectorstores.VectorStoreRetriever",
),
]