Spaces:
Running
Running
Download multi_llm_chatbot_backend/app/llm/embedding_client.py from BrainForge/Cybersecurity-Panel: direct link, hf CLI and curl.
- Browser
- Download file 403 Bytes
-
https://huggingface.co/spaces/BrainForge/Cybersecurity-Panel/resolve/main/multi_llm_chatbot_backend/app/llm/embedding_client.py
- Command line
-
hf download hf://spaces/BrainForge/Cybersecurity-Panel/multi_llm_chatbot_backend/app/llm/embedding_client.py
-
curl -L -o embedding_client.py https://huggingface.co/spaces/BrainForge/Cybersecurity-Panel/resolve/main/multi_llm_chatbot_backend/app/llm/embedding_client.py
403 Bytes
| from sentence_transformers import SentenceTransformer | |
| from app.config import get_settings | |
| settings = get_settings() | |
| # Using a compact, fast model good for semantic search — model name from config | |
| model = SentenceTransformer(settings.rag.embedding_model) | |
| def get_embedding(text: str) -> list[float]: | |
| embedding = model.encode(text, convert_to_numpy=True) | |
| return embedding.tolist() | |