MCPcopy Create free account
hub / github.com/HKUDS/OpenSpace / build_skill_embedding_text

Function build_skill_embedding_text

openspace/cloud/embedding.py:67–81  ·  view source on GitHub ↗

Build text for skill embedding: ``name + description + SKILL.md body``. Unified strategy matching MCP search_skills and clawhub platform.

(
    name: str,
    description: str,
    readme_body: str,
    max_chars: int = SKILL_EMBEDDING_MAX_CHARS,
)

Source from the content-addressed store, hash-verified

65
66
67def build_skill_embedding_text(
68 name: str,
69 description: str,
70 readme_body: str,
71 max_chars: int = SKILL_EMBEDDING_MAX_CHARS,
72) -> str:
73 """Build text for skill embedding: ``name + description + SKILL.md body``.
74
75 Unified strategy matching MCP search_skills and clawhub platform.
76 """
77 header = "\n".join(filter(None, [name, description]))
78 raw = "\n\n".join(filter(None, [header, readme_body]))
79 if len(raw) <= max_chars:
80 return raw
81 return raw[:max_chars]
82
83
84def generate_embedding(text: str, api_key: Optional[str] = None) -> Optional[List[float]]:

Callers 1

build_local_candidatesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected