(texts: list[str])
| 83 | |
| 84 | |
| 85 | def 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) |
| 97 | def embedding_init(entities:list[dict])-> list[dict]: |
| 98 | texts=[truncate_text(i['description']) for i in entities] |
| 99 | model_name = EMBEDDING_MODEL |
no outgoing calls
no test coverage detected