MCPcopy
hub / github.com/FoundationAgents/MetaGPT / from_path

Method from_path

metagpt/document.py:74–81  ·  view source on GitHub ↗

Create a Document instance from a file path.

(cls, path: Path)

Source from the content-addressed store, hash-verified

72
73 @classmethod
74 def from_path(cls, path: Path):
75 """
76 Create a Document instance from a file path.
77 """
78 if not path.exists():
79 raise FileNotFoundError(f"File {path} not found.")
80 content = path.read_text()
81 return cls(content=content, path=path)
82
83 @classmethod
84 def from_text(cls, text: str, path: Optional[Path] = None):

Callers

nothing calls this directly

Calls 1

existsMethod · 0.45

Tested by

no test coverage detected