pushed semantic search to prod

This commit is contained in:
rahulpscraftech360 2025-09-09 15:57:48 +05:30
parent 760d2b5bde
commit e5fc8680ec
3 changed files with 20 additions and 4 deletions

View file

@ -866,3 +866,19 @@ TTS:
access_token: "U4YdYXVfpwWnk2t5Gp822zWPCuORyeJL" access_token: "U4YdYXVfpwWnk2t5Gp822zWPCuORyeJL"
voice: "OUeAo1mhq6IBExi" voice: "OUeAo1mhq6IBExi"
output_dir: tmp/ output_dir: tmp/
semantic_search:
# Enable semantic search for music (requires Qdrant and sentence-transformers)
enabled: true # Set to false to disable
# Qdrant vector database URL - using same instance as memory system
qdrant_url: "https://a2482b9f-2c29-476e-9ff0-741aaaaf632e.eu-west-1-0.aws.cloud.qdrant.io"
# Qdrant API key - using your reference code's API key
qdrant_api_key: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3MiOiJtIn0.zPBGAqVGy-edbbgfNOJsPWV496BsnQ4ELOFvsLNyjsk"
# Vector collection name for music embeddings
collection_name: "xiaozhi_music"
# Sentence transformer model for embeddings (fast and efficient)
embedding_model: "all-MiniLM-L6-v2"
# Number of search results to return
search_limit: 5
# Minimum similarity score threshold (0.5 = 50% similarity required)
min_score_threshold: 0.5

View file

@ -449,7 +449,7 @@ def initialize_multilingual_music_system(conn):
if SEMANTIC_SEARCH is None: if SEMANTIC_SEARCH is None:
try: try:
semantic_config = conn.config.get('semantic_search', {}) semantic_config = conn.config.get('semantic_search', {})
if semantic_config.get('enabled', False): if semantic_config.get('enabled', True):
SEMANTIC_SEARCH = SemanticMusicSearch(semantic_config) SEMANTIC_SEARCH = SemanticMusicSearch(semantic_config)
if SEMANTIC_SEARCH.initialize(): if SEMANTIC_SEARCH.initialize():
conn.logger.bind(tag=TAG).info("Semantic music search initialized successfully") conn.logger.bind(tag=TAG).info("Semantic music search initialized successfully")

View file

@ -53,8 +53,8 @@ class SemanticMusicSearch:
self.is_available = True self.is_available = True
# Qdrant configuration # Qdrant configuration
self.qdrant_url = self.config.get("qdrant_url", "https://localhost:6333") self.qdrant_url = self.config.get("qdrant_url", "https://a2482b9f-2c29-476e-9ff0-741aaaaf632e.eu-west-1-0.aws.cloud.qdrant.io")
self.qdrant_api_key = self.config.get("qdrant_api_key", None) self.qdrant_api_key = self.config.get("qdrant_api_key", "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhY2Nlc3MiOiJtIn0.zPBGAqVGy-edbbgfNOJsPWV496BsnQ4ELOFvsLNyjsk")
self.collection_name = self.config.get("collection_name", "xiaozhi_music") self.collection_name = self.config.get("collection_name", "xiaozhi_music")
# Embedding model configuration # Embedding model configuration