Vector Search RaG
1.0.0
使用矢量搜索和抹布(检索增强生成)功能的复杂电影推荐系统,由Huggingface的句子Transformers和MongoDB Atlas提供支持。
Vector-Search-RaG/
├── apps/
│ └── semantic_search/
│ ├── __init__.py
│ ├── hf_connection.py # HuggingFace API connection
│ ├── mongo_connection.py # MongoDB connection handler
│ └── movie_recs.py # Movie recommendation logic
├── ragenv/ # Virtual environment
├── LICENSE
└── README.md
git clone https://github.com/yourusername/Vector-Search-RaG.git
cd Vector-Search-RaGpython -m venv ragenv
source ragenv/bin/activate # On Windows: ragenvScriptsactivatepip install pymongo requests python-decouple.env文件: MONGODB_URI = your_mongodb_connection_string
HUGGING_FACE_TOKEN = your_huggingface_token hf_connection.py )sentence-transformers/all-MiniLM-L6-v2模型生成嵌入mongo_connection.py )movie_recs.py ) from apps . semantic_search . movie_recs import search_movies
# Search for movies with a specific plot description
query = "A group of bandits stage a brazen train hold-up"
search_movies ( query ) from apps . semantic_search . movie_recs import fetch_and_update_movies
# Fetch and update movie information
fetch_and_update_movies ()该系统使用MongoDB的$vectorSearch聚合进行语义搜索:
.env文件安全,永远不要将其用于版本控制numCandidates: 100用于广泛的搜索范围git checkout -b feature/AmazingFeature )git commit -m 'Add some AmazingFeature' )git push origin feature/AmazingFeature )该项目是根据存储库中包含的许可证文件的条款许可的。