home / skills / lin-a1 / skills-agent / embedding_service
This skill converts input text into high-dimensional embeddings for semantic search, clustering, and downstream analytics, enabling powerful NLP insights.
npx playbooks add skill lin-a1/skills-agent --skill embedding_serviceReview the files below or copy the command above to add this skill to your agents.
---
name: embedding-service
description: 文本向量化(Embedding)基础服务。将自然语言转换为高维稠密向量,为语义搜索、聚类分析、推荐系统等下游任务提供核心数据支持。
---
## 功能
将输入文本转换为高维向量表示,用于语义相似度计算、聚类分析等下游任务。
## 调用方式
```python
from services.embedding_service.client import EmbeddingServiceClient
client = EmbeddingServiceClient()
# 单个文本向量化
vector = client.embed_query("人工智能") # -> list[float]
# 多个文本向量化
texts = ["机器学习", "深度学习", "自然语言处理"]
vectors = client.embed_documents(texts) # -> list[list[float]]
```
## 返回格式
```json
{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [-0.031, -0.016, -0.007, ...]
}
],
"model": "Qwen/Qwen3-Embedding-0.6B"
}
```
This skill provides a lightweight embedding service that converts natural language text into high-dimensional dense vectors. It generates consistent vector outputs suitable for semantic similarity, clustering, and recommendation pipelines. The implementation exposes simple client methods for single and batch embedding calls.
The service accepts text inputs and returns numeric vector representations produced by a specified embedding model. Responses include an indexed list of embedding objects and the model identifier to ensure traceability. Clients can call methods for a single query or batch documents and receive lists of float vectors ready for downstream indexing or distance computations.
What formats are returned by the service?
The service returns a JSON-like structure with an object list of embeddings, each containing an index and a float vector, along with the model name.
How do I embed multiple texts efficiently?
Use the batch embedding method to send a list of texts in one call; this reduces overhead and is more efficient than calling single-item embedding repeatedly.