embed
Skill này làm gì
Skill tạo các dấu vân tay số, gọi là embedding, cho các mục trong đồ thị tri thức Semantica. Skill dành cho người muốn tìm các mục tương tự hoặc ước tính những kết nối mới nào có khả năng.
Khi nào nên dùng
- ✓Khi bạn muốn tìm các mục trong đồ thị tương tự với một mục đã chọn.
- ✓Khi bạn muốn ước tính những liên kết còn thiếu giữa các mục nào có khả năng.
- ✓Khi bạn muốn so sánh nhiều cặp mục cùng lúc về độ tương đồng.
Liên kết skill
https://github.com/semantica-agi/semantica/blob/main/plugins/skills/embed/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Bạn có thể tìm 10 nút trong đồ thị tri thức của tôi giống nhất với bản ghi khách hàng Acme không?”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent tính embedding cho các nút bằng phương pháp đi ngẫu nhiên, có thể lưu chúng lại vào các nút, rồi so sánh để tìm các kết quả gần nhau hoặc liên kết có khả năng. Kết quả trả về dưới dạng danh sách xếp hạng.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
/semantica:embed
Generate and inspect graph embeddings. Usage: /semantica:embed <sub-command> [args]
$ARGUMENTS = sub-command + arguments.
compute [--labels <t1,t2>] [--rels <r1,r2>] [--dim N] [--walks N]
Generate Node2Vec embeddings for graph nodes.
from semantica.kg.node_embeddings import NodeEmbedder
from semantica.context import ContextGraph
graph = ContextGraph()
embedder = NodeEmbedder()
node_labels = labels_arg.split(",") if labels_arg else graph.get_all_node_types()
rel_types = rels_arg.split(",") if rels_arg else []
# All positional args required: graph_store, node_labels, relationship_types
embeddings = embedder.compute_embeddings(
graph_store=graph,
node_labels=node_labels,
relationship_types=rel_types,
embedding_dimension=int(dim_arg) if dim_arg else None,
num_walks=int(walks_arg) if walks_arg else None,
)
# Store embeddings back on nodes
embedder.store_embeddings(
graph_store=graph,
embeddings=embeddings,
property_name="node2vec_embedding",
)
Output:
Embeddings computed and stored.
Nodes embedded: N
Embedding dim: 128
Node types covered: [type1, type2, ...]
Sample (first 5 nodes):
| Node | Type | Embedding dim | Stored |
similar <node_id> [--top N]
Find the most similar nodes to a given node in embedding space.
from semantica.kg.node_embeddings import NodeEmbedder
from semantica.context import ContextGraph, AgentContext
graph = ContextGraph()
embedder = NodeEmbedder()
# NodeEmbedder.find_similar_nodes uses the stored node2vec_embedding property
neighbors = embedder.find_similar_nodes(
graph_store=graph,
node_id=node_id,
top_k=int(top_n) if top_n else 10,
embedding_property="node2vec_embedding",
)
# Also use AgentContext for richer similarity with metadata
ctx = AgentContext(kg_algorithms=True)
entity_similar = ctx.find_similar_entities(
entity_id=node_id,
similarity_type="content", # or "structural", "hybrid"
top_k=int(top_n) if top_n else 10,
)
Return: | Rank | Node ID | Type | Cosine Similarity | Shared Properties |
similarity <n1> <n2> [--method cosine|euclidean|manhattan|correlation]
Compute pairwise similarity between two nodes.
from semantica.kg.similarity_calculator import SimilarityCalculator
from semantica.kg.node_embeddings import NodeEmbedder
from semantica.context import ContextGraph
graph = ContextGraph()
embedder = NodeEmbedder()
calc = SimilarityCalculator()
# Get embeddings for both nodes
v1 = embedder.find_similar_nodes(graph, n1, top_k=1) # placeholder — use stored embedding
v2 = embedder.find_similar_nodes(graph, n2, top_k=1)
method = method_arg or "cosine"
if method == "cosine":
score = calc.cosine_similarity(vector1=v1, vector2=v2)
elif method == "euclidean":
score = calc.euclidean_distance(v1, v2)
elif method == "manhattan":
score = calc.manhattan_distance(v1, v2)
elif method == "correlation":
score = calc.correlation_similarity(v1, v2)
Output:
Similarity: "<n1>" ↔ "<n2>"
Method: cosine
Score: 0.847
Interpretation: HIGH similarity (>0.8)
Shared neighbors: K
Common node types: [types]
predict-link <n1> <n2> [--method cosine|jaccard|adamic-adar|common-neighbors]
Score the likelihood of a relationship between two nodes.
from semantica.kg.link_predictor import LinkPredictor
from semantica.context import ContextGraph
graph = ContextGraph()
predictor = LinkPredictor()
# score_link(graph_store, node_id1, node_id2, method=)
score = predictor.score_link(
graph_store=graph,
node_id1=n1,
node_id2=n2,
method=method_arg or None,
)
Output:
Link Prediction: "<n1>" → "<n2>"
Method: cosine
Score: 0.723 (threshold: 0.5 → LIKELY)
Recommendation: This link is LIKELY to be meaningful.
top-links <node_id> [--top N] [--method <method>]
Find the top-N most likely new connections for a node.
from semantica.kg.link_predictor import LinkPredictor
from semantica.context import ContextGraph
graph = ContextGraph()
predictor = LinkPredictor()
top = predictor.predict_top_links(
graph_store=graph,
node_id=node_id,
top_k=int(top_n) if top_n else 10,
method=method_arg or None,
)
Return: | Rank | Target Node | Type | Score | Existing Link? |
batch <query_node> [--against <n1,n2,...>] [--top N]
Score similarity between a query node and a set of target nodes (or all
Câu hỏi thường gặp
Embedding là gì?
Đó là một danh sách số biểu diễn một mục, sao cho các mục giống nhau có các số giống nhau.
Nó có lưu embedding không?
Có. Kết quả có thể được lưu lại vào từng nút để dùng sau.
Nó có chấm điểm liên kết chưa tồn tại không?
Có. Skill có thể chấm điểm các liên kết mới có thể có giữa các nút.
Chi tiết
Mô tả gốc của tác giả
Generate, inspect, and use node/text embeddings in Semantica — compute Node2Vec embeddings, find similar nodes, score link predictions, batch similarity, and pairwise similarity. Uses NodeEmbedder, SimilarityCalculator, LinkPredictor, and AgentContext. Sub-commands: compute, similar, similarity, predict-link, top-links, batch, pairwise.
repo: semantica-agi/semantica
Độ phổ biến
- Sao GitHub
- 14k
- Vị trí xếp hạng
- #11146
- Giấy phép
- MIT
- Cập nhật
- 2/11/2026
Bình luận
- …
Thêm skill từ kho mã này
semantica
14kCung cấp cho agent của bạn một bộ công cụ đầy đủ cho đồ thị tri thức, gồm trích xuất, suy luận, nguồn gốc, ontology, chính sách và xuất dữ liệu.
causal
14kGiúp agent của bạn truy vết các liên kết nhân quả trong đồ thị tri thức, gồm chuỗi nguyên nhân, kịch bản nếu-thì và điểm ảnh hưởng.
change
14kCho agent của bạn thấy một đồ thị tri thức trông như thế nào vào một ngày trước đó, và điều gì đã thay đổi giữa hai ngày hoặc hai phiên bản ontology.
decision
14kGiúp agent của bạn ghi lại, tìm kiếm, giải thích và rà soát các quyết định trong đồ thị tri thức, từ ghi chú đầu tiên đến kết quả của nó.
Skill tương tự
pytorch-patterns
280kGiúp agent của bạn dùng PyTorch cho các mô hình học máy. Áp dụng thực hành tốt nhất để huấn luyện mô hình hiệu quả và đảm bảo kết quả có thể lặp lại.
evm-token-decimals
280kGiúp agent tránh lỗi về số thập phân khi làm việc với các mạng blockchain khác nhau. Đảm bảo giá trị token chính xác trong giao dịch và phép tính.
ito-inference
280kGiúp agent kiểm tra xem các mô hình AI đã sẵn sàng để dùng chưa. Kết nối yêu cầu tài nguyên tính toán với dịch vụ mô hình đã sẵn sàng.