mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 02:50:31 +00:00
Fix loading of ImagePromptTemplate (#16868)
We didn't override the namespace of the ImagePromptTemplate, so it is listed as being in langchain.schema This updates the mapping to let the loader deserialize. Alternatively, we could make a slight breaking change and update the namespace of the ImagePromptTemplate since we haven't broadly publicized/documented it yet..
This commit is contained in:
@@ -40,8 +40,21 @@ def import_all_modules(package_name: str) -> dict:
|
||||
|
||||
|
||||
def test_serializable_mapping() -> None:
|
||||
# This should have had a different namespace, as it was never
|
||||
# exported from the langchain module, but we keep for whoever has
|
||||
# already serialized it.
|
||||
to_skip = {
|
||||
("langchain", "prompts", "image", "ImagePromptTemplate"): (
|
||||
"langchain_core",
|
||||
"prompts",
|
||||
"image",
|
||||
"ImagePromptTemplate",
|
||||
),
|
||||
}
|
||||
serializable_modules = import_all_modules("langchain")
|
||||
missing = set(SERIALIZABLE_MAPPING).difference(serializable_modules)
|
||||
missing = set(SERIALIZABLE_MAPPING).difference(
|
||||
set(serializable_modules).union(to_skip)
|
||||
)
|
||||
assert missing == set()
|
||||
extra = set(serializable_modules).difference(SERIALIZABLE_MAPPING)
|
||||
assert extra == set()
|
||||
|
Reference in New Issue
Block a user