Skip to content

Commit 4bbbe32

Browse files
committed
Use pydantic 2.6+
1 parent 189ae64 commit 4bbbe32

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

libs/knowledge-graph/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ pytest-dotenv = "^0.5.2"
3636
pytest-rerunfailures = "^14.0"
3737
mypy = "^1.10.1"
3838
types-pyyaml = "^6.0.1"
39-
pydantic = "<2" # for compatibility between LangChain and pydantic-yaml type checking
39+
pydantic = "^2.6.0"
4040

4141
[build-system]
4242
requires = ["poetry-core"]

libs/knowledge-graph/ragstack_knowledge_graph/extraction.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@
3232
def _format_example(idx: int, example: Example) -> str:
3333
from pydantic_yaml import to_yaml_str
3434

35-
return f"Example {idx}:\n```yaml\n{to_yaml_str(example)}\n```"
35+
yaml_example = to_yaml_str(example) # type: ignore[arg-type]
36+
return f"Example {idx}:\n```yaml\n{yaml_example}\n```"
3637

3738

3839
class KnowledgeSchemaExtractor:

libs/knowledge-graph/ragstack_knowledge_graph/knowledge_schema.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,13 @@ def from_file(cls, path: str | Path) -> Self:
7575
"""
7676
from pydantic_yaml import parse_yaml_file_as
7777

78-
return parse_yaml_file_as(cls, path)
78+
return parse_yaml_file_as(cls, path) # type: ignore[type-var]
7979

8080
def to_yaml_str(self) -> str:
8181
"""Convert the schema to a YAML string."""
8282
from pydantic_yaml import to_yaml_str
8383

84-
return to_yaml_str(self)
84+
return to_yaml_str(self) # type: ignore[arg-type]
8585

8686

8787
class KnowledgeSchemaValidator:

0 commit comments

Comments
 (0)