feat: Integrate LLM-based reranking in KnowledgeSearchTool
- Added optional chat model to KnowledgeSearchTool for enhanced reranking using LLM prompt scoring. - Updated rerankResults method to prioritize LLM-based reranking over traditional rerank model. - Implemented new functions for LLM scoring and parsing scores from responses, improving search result relevance. - Enhanced migration script to handle database versioning and dirty state checks more robustly.
This commit is contained in:
@@ -3,11 +3,20 @@
|
||||
|
||||
BEGIN;
|
||||
|
||||
-- Add web_search_config column to tenants table
|
||||
ALTER TABLE tenants
|
||||
ADD COLUMN web_search_config JSONB DEFAULT NULL;
|
||||
-- Add web_search_config column to tenants table (if not exists)
|
||||
-- Note: PostgreSQL 9.6+ supports IF NOT EXISTS
|
||||
DO $$
|
||||
BEGIN
|
||||
IF NOT EXISTS (
|
||||
SELECT 1 FROM information_schema.columns
|
||||
WHERE table_name = 'tenants' AND column_name = 'web_search_config'
|
||||
) THEN
|
||||
ALTER TABLE tenants
|
||||
ADD COLUMN web_search_config JSONB DEFAULT NULL;
|
||||
END IF;
|
||||
END $$;
|
||||
|
||||
-- Add comment
|
||||
-- Add or update comment
|
||||
COMMENT ON COLUMN tenants.web_search_config IS 'Web search configuration for the tenant';
|
||||
|
||||
COMMIT;
|
||||
|
||||
Reference in New Issue
Block a user