MCPcopy
hub / github.com/langroid/langroid / Document

Class Document

langroid/mytypes.py:106–132  ·  view source on GitHub ↗

Interface for interacting with a document.

Source from the content-addressed store, hash-verified

104
105
106class Document(BaseModel):
107 """Interface for interacting with a document."""
108
109 content: str
110 metadata: DocMetaData
111
112 def id(self) -> str:
113 return self.metadata.id
114
115 @staticmethod
116 def from_string(
117 content: str,
118 source: str = "context",
119 is_chunk: bool = True,
120 ) -> "Document":
121 return Document(
122 content=content,
123 metadata=DocMetaData(source=source, is_chunk=is_chunk),
124 )
125
126 def __str__(self) -> str:
127 return dedent(
128 f"""
129 CONTENT: {self.content}
130 SOURCE:{str(self.metadata)}
131 """
132 )
133
134
135class NonToolAction(str, Enum):

Callers 15

get_docMethod · 0.90
get_doc_chunksMethod · 0.90

Calls

no outgoing calls

Used in the wild real call sites across dependent graphs

searching dependent graphs…