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,
)
| 65 | |
| 66 | |
| 67 | def 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 | |
| 84 | def generate_embedding(text: str, api_key: Optional[str] = None) -> Optional[List[float]]: |
no outgoing calls
no test coverage detected