MCPcopy Create free account
hub / github.com/KnowledgeXLab/LeanRAG / embedding

Function embedding

build_graph.py:85–96  ·  view source on GitHub ↗
(texts: list[str])

Source from the content-addressed store, hash-verified

83
84
85def embedding(texts: list[str]) -> np.ndarray: #vllm serve
86 model_name = EMBEDDING_MODEL
87 client = OpenAI(
88 api_key=EMBEDDING_MODEL,
89 base_url=EMBEDDING_URL
90 )
91 embedding = client.embeddings.create(
92 input=texts,
93 model=model_name,
94 )
95 final_embedding = [d.embedding for d in embedding.data]
96 return np.array(final_embedding)
97def embedding_init(entities:list[dict])-> list[dict]:
98 texts=[truncate_text(i['description']) for i in entities]
99 model_name = EMBEDDING_MODEL

Callers 1

hierarchical_clusteringFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected