MCPcopy Create free account
hub / github.com/Lap-Platform/LAP / load

Method load

sdks/python/lap/middleware.py:30–57  ·  view source on GitHub ↗

Load LAP file as LangChain Document objects.

(self)

Source from the content-addressed store, hash-verified

28 self._client = LAPClient()
29
30 def load(self):
31 """Load LAP file as LangChain Document objects."""
32 doc = self._client.load(self.path)
33 documents = []
34
35 # One document per endpoint
36 for ep in doc.endpoints:
37 content = f"{ep.method} {ep.path}"
38 if ep.summary:
39 content += f"\n{ep.summary}"
40 if ep.required_params:
41 params = ", ".join(f"{p.name}: {p.type}" for p in ep.required_params)
42 content += f"\nRequired: {params}"
43 if ep.optional_params:
44 params = ", ".join(f"{p.name}: {p.type}" for p in ep.optional_params)
45 content += f"\nOptional: {params}"
46
47 documents.append(Document(
48 page_content=content,
49 metadata={
50 "source": self.path,
51 "api": doc.api_name,
52 "method": ep.method,
53 "path": ep.path,
54 },
55 ))
56
57 return documents
58
59 def load_full(self):
60 """Load as a single document with full context."""

Callers 1

test_load_documentsMethod · 0.95

Calls 2

DocumentClass · 0.85
loadMethod · 0.45

Tested by 1

test_load_documentsMethod · 0.76