MCPcopy Create free account
hub / github.com/VectifyAI/OpenKB / _read_references_preview

Function _read_references_preview

openkb/skill/evaluator.py:166–183  ·  view source on GitHub ↗

Concatenate references/*.md, capped per-file, for the eval LLM. The cap keeps token use bounded for large reference sets. Each file contributes its first N bytes (text is markdown so a byte cap is a reasonable proxy for tokens).

(skill_dir: Path)

Source from the content-addressed store, hash-verified

164
165
166def _read_references_preview(skill_dir: Path) -> str:
167 """Concatenate references/*.md, capped per-file, for the eval LLM.
168
169 The cap keeps token use bounded for large reference sets. Each file
170 contributes its first N bytes (text is markdown so a byte cap is a
171 reasonable proxy for tokens).
172 """
173 refs_dir = skill_dir / "references"
174 if not refs_dir.is_dir():
175 return ""
176 chunks: list[str] = []
177 for ref in sorted(refs_dir.rglob("*.md")):
178 rel = ref.relative_to(skill_dir)
179 text = ref.read_text(encoding="utf-8", errors="replace")
180 if len(text) > REFERENCES_PREVIEW_BYTES:
181 text = text[:REFERENCES_PREVIEW_BYTES] + "\n…[truncated]\n"
182 chunks.append(f"--- {rel} ---\n{text}")
183 return "\n\n".join(chunks)
184
185
186def _skill_content_block(skill_dir: Path) -> str:

Callers 1

_skill_content_blockFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected