Skip to content

ValidationError: 1 validation error for Document metadata Input should be a valid dictionary #118

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arthberman opened this issue Sep 18, 2024 · 1 comment

Comments

@arthberman
Copy link

arthberman commented Sep 18, 2024

Since LangChain 0.3 and within LangGraph Studio container, have the following error :
ValidationError: 1 validation error for Document metadata Input should be a valid dictionary [type=dict_type, input_value=Fragment(buf=b'{"name": "...name"}'), input_type=Fragment] For further information visit https://errors.pydantic.dev/2.9/v/dict_type
When running the following query :

results = self.vector_store.similarity_search(
            query=name,
            k=1,
            filter={"id": {"$eq": id}, "name": {"$eq": name}},
)

It happens when running vector_store.similarity_search query with metadata filters.
Seems to be linked to switch to Pydantic V2?

@arthberman
Copy link
Author

pyproject.toml

`[project]
name = ""
version = "0.0.1"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.12"
dependencies = [
"python-dotenv>=1.0.1",
"langchain>=0.3.0",
"langchain-community>=0.3.0",
"langchainhub>=0.1.21",
"langchain-anthropic>=0.2.1",
"langchain-groq>=0.2.0",
"langchain-core>=0.3.1",
"langgraph>=0.2.22",
"langchain-openai>=0.2.0",
"pydantic>=2.9.2",
"temporalio>=1.7.1",
"toml>=0.10.2",
"packaging>=24.1",
"ipykernel>=6.29.5",
"langgraph-checkpoint-postgres>=1.0.7",
"langgraph-sdk>=0.1.30",
"langchain-postgres>=0.0.12",
"psycopg2-binary>=2.9.9",
]

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[tool.uv]
dev-dependencies = ["ipykernel>=6.29.5"]

[tool.hatch.build.targets.wheel]
packages = ["src/app", "src/parser", "src/utils"]
`

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

No branches or pull requests

1 participant