beer-sakthai/sak-family-agent/sakthai-hf-inference-client-embeddings-patterns
Claude Code and agent skill by beer-sakthai/sak-family-agent
- community
Checking that the SKILL.md file is still in the repository.
name: SakThai-hf-inference-client-embeddings-patterns
Install
npx vskill@latest install beer-sakthai/sak-family-agent/sakthai-hf-inference-client-embeddings-patternsSKILL.md
HF Inference Client — Embeddings Patterns (Serverless)
Overview
Generate text embeddings via the Hugging Face Inference API at zero cost using InferenceClient.feature_extraction() and InferenceClient.sentence_similarity(). Covers the serverless (hf-inference) provider, OpenAI-compatible endpoints, and practical patterns for semantic search, clustering, and RAG on a budget.
Key capabilities:
| Method | Returns | Use Case | |
|---|---|---|---|
feature_extraction(text) | np.ndarray (float32) | Raw embeddings for vector DBs, clustering, similarity | |
sentence_similarity(sentence, other_sentences) | list[float] (scores) | Direct pairwise similarity comparison |
Zero-cost: Serverless inference via hf-inference provider is free with a HF token. No GPU needed. See references/hf-learnings.md for full API reference, provider routing details, and advanced patterns.
Quick Start
Best Practices
- Specify model explicitly — don't rely on default (currently
facebook/bart-base); useBAAI/bge-small-en-v1.5orsentence-transformers/all-MiniLM-L6-v2for quality - Pool embeddings — most sentence-transformers output per-token vectors; use
meanorclspooling for sentence-level embeddings - Normalize — set
normalize=Truefor cosine similarity - Batch — pass
list[str]to batch efficiently within payload size limits (check model max tokens) - Use `sentence_similarity` instead of manual cosine for direct comparison — it's handled server-side
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingpersonas/sakthai/skills/SakThai-hf-inference-client-embeddings-patterns/SKILL.md
Popularity
- Repository stars
- 1
- Repository forks
- 1
- 7-day trend score
- 8
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/beer-sakthai/sak-family-agent/sakthai-hf-inference-client-embeddings-patterns)