Browse Source

Merge pull request #4263 from manticoresoftware/revert/feat-2286-conversational-rag-search

Revert: Add CLT tests for ConversationalRag plugin
Pavel Shilin 1 week ago
parent
commit
cdc1f06d64

+ 0 - 172
test/clt-tests/buddy-plugins/test-rag-conversational-advanced.rec

@@ -1,172 +0,0 @@
-––– comment –––
-This test verifies advanced ConversationalRag plugin features:
-- Multiple RAG models with different configurations
-- Multiple content fields handling
-- Conversation tracking across multiple queries
-- Complex document structures with multiple text fields
-––– input –––
-export SEARCHD_FLAGS="--iostats --cpustats"
-––– output –––
-––– block: ../base/start-searchd-with-buddy –––
-––– comment –––
-Clean up any existing data
-––– input –––
-mysql -h0 -P9306 -e "DROP TABLE IF EXISTS knowledge_base;"
-––– output –––
-––– comment –––
-Create a complex table with multiple text fields and auto-embeddings
-––– input –––
-mysql -h0 -P9306 << EOF
-CREATE TABLE knowledge_base (
-    id BIGINT,
-    title TEXT,
-    summary TEXT,
-    content TEXT,
-    category TEXT,
-    tags TEXT,
-    embedding_vector FLOAT_VECTOR
-    knn_type='hnsw'
-    hnsw_similarity='cosine'
-    model_name='sentence-transformers/all-MiniLM-L6-v2'
-    from='title,content'
-    api_key='\${OPENAI_API_KEY}'
-) TYPE='rt';
-EOF
-––– output –––
-––– comment –––
-Insert test documents with rich content
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-INSERT INTO knowledge_base (id, title, summary, content, category, tags)
-VALUES
-(1, 'Getting Started with Manticore', 'Quick start guide', 'Install Manticore Search and configure your first index', 'Tutorial', 'installation,quickstart'),
-(2, 'Vector Search Explained', 'Understanding vectors', 'Vector search uses embeddings to find semantically similar documents', 'Concepts', 'vectors,knn,similarity'),
-(3, 'Full-Text Search Guide', 'Text search basics', 'Use MATCH() operator for full-text search with ranking', 'Tutorial', 'fulltext,match,ranking'),
-(4, 'RAG Architecture', 'RAG pattern overview', 'Retrieval-Augmented Generation combines search with LLM for intelligent responses', 'Advanced', 'rag,llm,ai'),
-(5, 'Clustering Setup', 'Distributed search', 'Configure replication and sharding for high availability', 'Advanced', 'cluster,replication,sharding');
-EOF
-––– output –––
-––– comment –––
-Verify all documents are inserted
-––– input –––
-mysql -h0 -P9306 -e "SELECT COUNT(*) FROM knowledge_base;"
-––– output –––
-+----------+
-| count(*) |
-+----------+
-|        5 |
-+----------+
-––– comment –––
-Create multiple RAG models with different configurations
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL fast_assistant (llm_provider='openai', llm_model='gpt-3.5-turbo', settings='{\"temperature\":0.5, \"max_tokens\":1000, \"k_results\":3}');"
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL detailed_assistant (llm_provider='openai', llm_model='gpt-4o', style_prompt='You are an expert technical writer. Provide detailed, accurate explanations.', settings='{\"temperature\":0.3, \"max_tokens\":4000, \"k_results\":5}');"
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL creative_assistant (llm_provider='openai', llm_model='gpt-4o-mini', style_prompt='You are a helpful and friendly assistant. Use simple language.', settings='{\"temperature\":0.7, \"max_tokens\":2000, \"k_results\":4}');"
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– comment –––
-Verify all models are created (check count, order may vary)
-––– input –––
-mysql -h0 -P9306 -e "SHOW RAG MODELS;" | grep -c "openai"
-––– output –––
-3
-––– comment –––
-Test with single content field
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Tell me about vector search', 'knowledge_base', 'fast_assistant', 'content')\G;"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-         response: #!/.*[Vv]ector.*[Ss]earch.*/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test with two content fields (title, content)
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Explain vector search', 'knowledge_base', 'detailed_assistant', 'title,content')\G;"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-         response: #!/.*[Vv]ector.*[Ss]earch.*/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test with multiple content fields (title, summary, content)
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Tell me about RAG architecture', 'knowledge_base', 'creative_assistant', 'title,summary,content')\G;" | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-         response: #!/.*(RAG|[Rr]etrieval|[Gg]eneration).*/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test conversation tracking - first message in a new conversation
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('What is clustering?', 'knowledge_base', 'fast_assistant', 'title,content', 'conv-test-1234-5678-90ab-cdef12345678')\G;"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: conv-test-1234-5678-90ab-cdef12345678
-         response: #!/.*[Cc]luster.*/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test conversation tracking - follow-up message (should maintain context)
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('How do I configure it?', 'knowledge_base', 'fast_assistant', 'title,content', 'conv-test-1234-5678-90ab-cdef12345678')\G;"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: conv-test-1234-5678-90ab-cdef12345678
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test different model on same conversation
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('What are best practices?', 'knowledge_base', 'detailed_assistant', 'title,summary,content', 'conv-test-1234-5678-90ab-cdef12345678')\G;" | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: conv-test-1234-5678-90ab-cdef12345678
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test independent conversation - different context
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Show me tutorials', 'knowledge_base', 'creative_assistant', 'content', 'conv-other-aaaa-bbbb-cccc-dddddddddddd')\G;"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: conv-other-aaaa-bbbb-cccc-dddddddddddd
-         response: #!/.+/!#
-          sources: #!/\[.*\]/!#
-––– comment –––
-Cleanup - drop all models
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL fast_assistant;"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL detailed_assistant;"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL creative_assistant;"
-––– output –––
-––– comment –––
-Verify all models are dropped
-––– input –––
-mysql -h0 -P9306 -e "SHOW RAG MODELS;"
-––– output –––
-––– comment –––
-Cleanup table
-––– input –––
-mysql -h0 -P9306 -e "DROP TABLE IF EXISTS knowledge_base;"
-––– output –––

+ 0 - 204
test/clt-tests/buddy-plugins/test-rag-conversational-basic.rec

@@ -1,204 +0,0 @@
-––– comment –––
-This test verifies the basic functionality of the ConversationalRag plugin.
-It tests model creation, management, and conversational RAG queries.
-The plugin combines vector search with LLM capabilities for intelligent responses.
-Based on schema.sql and setup_rag_test.sh from issue #3978
-––– input –––
-export SEARCHD_FLAGS="--iostats --cpustats"
-––– output –––
-––– block: ../base/start-searchd-with-buddy –––
-––– comment –––
-Clean up any existing RAG data
-––– input –––
-mysql -h0 -P9306 -e "DROP TABLE IF EXISTS docs;"
-––– output –––
-––– comment –––
-Create a test table with vector embeddings for RAG search
-Note: knn_dims is NOT specified when using model_name - dimensions are auto-detected
-API_KEY is required for remote OpenAI embedding models
-––– input –––
-mysql -h0 -P9306 << EOF
-CREATE TABLE docs (
-    id BIGINT,
-    content TEXT,
-    title TEXT,
-    embedding_vector FLOAT_VECTOR
-    knn_type='hnsw'
-    hnsw_similarity='cosine'
-    model_name='sentence-transformers/all-MiniLM-L6-v2'
-    from='content,title'
-    api_key='\${OPENAI_API_KEY}'
-) TYPE='rt';
-EOF
-––– output –––
-––– comment –––
-Insert sample documents - vectors are generated automatically from content and title
-––– input –––
-mysql -h0 -P9306 -e "INSERT INTO docs (id, content, title) VALUES (1, 'Vector search uses embeddings to find semantically similar documents', 'Vector Search Guide');"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "INSERT INTO docs (id, content, title) VALUES (2, 'Full-text search and KNN capabilities for efficient retrieval', 'Manticore Features');"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "INSERT INTO docs (id, content, title) VALUES (3, 'Retrieval-Augmented Generation combines search with LLM for intelligent responses', 'RAG Introduction');"
-––– output –––
-––– comment –––
-Wait for auto-embeddings generation (async via Buddy)
-––– input –––
-mysql -h0 -P9306 -e "debug sleep 20;" > /dev/null 2>&1
-––– output –––
-––– comment –––
-Verify documents are inserted
-––– input –––
-mysql -h0 -P9306 -e "SELECT COUNT(*) FROM docs;"
-––– output –––
-+----------+
-| count(*) |
-+----------+
-|        3 |
-+----------+
-––– comment –––
-Test CREATE RAG MODEL - basic configuration
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-CREATE RAG MODEL test_assistant (
-    llm_provider='openai',
-    llm_model='gpt-4o-mini'
-);
-EOF
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– comment –––
-Test CREATE RAG MODEL - advanced configuration with custom settings
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-CREATE RAG MODEL advanced_assistant (
-    llm_provider='openai',
-    llm_model='gpt-4o',
-    style_prompt='You are a helpful assistant specializing in search technology',
-    settings='{"temperature":0.3, "max_tokens":2000, "k_results":5}'
-);
-EOF
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– comment –––
-Test SHOW RAG MODELS - should display created models
-––– input –––
-mysql -h0 -P9306 -e "SHOW RAG MODELS;"
-––– output –––
-+--------------------------------------+--------------------+--------------+-------------+------------+
-| uuid                                 | name               | llm_provider | llm_model   | created_at |
-+--------------------------------------+--------------------+--------------+-------------+------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# | advanced_assistant | openai       | gpt-4o      | %{NUMBER} |
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# | test_assistant     | openai       | gpt-4o-mini | %{NUMBER} |
-+--------------------------------------+--------------------+--------------+-------------+------------+
-––– comment –––
-Test DESCRIBE RAG MODEL - verify model configuration
-––– input –––
-mysql -h0 -P9306 -e "DESCRIBE RAG MODEL test_assistant\G"
-––– output –––
-*************************** 1. row ***************************
-property: id
-   value: %{NUMBER}
-*************************** 2. row ***************************
-property: llm_provider
-   value: openai
-*************************** 3. row ***************************
-property: llm_model
-   value: gpt-4o-mini
-*************************** 4. row ***************************
-property: style_prompt
-   value:
-*************************** 5. row ***************************
-property: uuid
-   value: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-*************************** 6. row ***************************
-property: name
-   value: test_assistant
-*************************** 7. row ***************************
-property: created_at
-   value: %{NUMBER}
-*************************** 8. row ***************************
-property: updated_at
-   value: %{NUMBER}
-––– input –––
-mysql -h0 -P9306 -e "DESCRIBE RAG MODEL advanced_assistant\G"
-––– output –––
-*************************** 1. row ***************************
-property: id
-   value: %{NUMBER}
-*************************** 2. row ***************************
-property: llm_provider
-   value: openai
-*************************** 3. row ***************************
-property: llm_model
-   value: gpt-4o
-*************************** 4. row ***************************
-property: style_prompt
-   value: You are a helpful assistant specializing in search technology
-*************************** 5. row ***************************
-property: uuid
-   value: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-*************************** 6. row ***************************
-property: name
-   value: advanced_assistant
-*************************** 7. row ***************************
-property: created_at
-   value: %{NUMBER}
-*************************** 8. row ***************************
-property: updated_at
-   value: %{NUMBER}
-––– comment –––
-Test CALL CONVERSATIONAL_RAG - basic query without conversation UUID
-This should succeed with OPENAI_API_KEY set
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('What is vector search?', 'docs', 'test_assistant', 'content')\G"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-         response: #!/.*[Vv]ector.*[Ss]earch.*/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test CALL CONVERSATIONAL_RAG - with multiple content fields
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Tell me about RAG', 'docs', 'test_assistant', 'title,content')\G"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: #!/[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}/!#
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test CALL CONVERSATIONAL_RAG - with conversation UUID for context tracking
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Can you explain more?', 'docs', 'test_assistant', 'content', 'test-conv-12345678-1234-1234-1234-123456789abc')\G"
-––– output –––
-*************************** 1. row ***************************
-conversation_uuid: test-conv-12345678-1234-1234-1234-123456789abc
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test DROP RAG MODEL - cleanup
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL test_assistant;"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL advanced_assistant;"
-––– output –––
-––– comment –––
-Verify models are dropped
-––– input –––
-mysql -h0 -P9306 -e "SHOW RAG MODELS;"
-––– output –––
-––– comment –––
-Cleanup test table
-––– input –––
-mysql -h0 -P9306 -e "DROP TABLE IF EXISTS docs;"
-––– output –––

+ 0 - 145
test/clt-tests/buddy-plugins/test-rag-conversational-intent.rec

@@ -1,145 +0,0 @@
-––– comment –––
-This test verifies intent classification and conversation flow in the ConversationalRag plugin.
-Tests various user intents: NEW_SEARCH, TOPIC_CHANGE, INTEREST, REJECTION, ALTERNATIVES.
-Based on issue #3978 - conversational RAG with intent classification.
-Uses rich document content based on internal test data (schema.sql).
-––– block: ../base/start-searchd-with-buddy –––
-––– comment –––
-Setup: Create test table with documents about AI, programming, and entertainment
-––– input –––
-mysql -h0 -P9306 << EOF
-CREATE TABLE docs (
-    id BIGINT,
-    content TEXT,
-    title TEXT,
-    category TEXT,
-    embedding_vector FLOAT_VECTOR
-    knn_type='hnsw'
-    hnsw_similarity='cosine'
-    model_name='sentence-transformers/all-MiniLM-L6-v2'
-    from='content'
-    api_key='\${OPENAI_API_KEY}'
-) TYPE='rt';
-EOF
-––– output –––
-––– comment –––
-Insert rich test documents based on internal test data (schema.sql)
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-INSERT INTO docs (id, content, title, category) VALUES
-(1, 'Artificial intelligence is the capability of computational systems to perform tasks typically associated with human intelligence such as learning, reasoning, problem-solving, perception and decision-making. High-profile applications include advanced web search engines, recommendation systems, virtual assistants, autonomous vehicles and generative AI tools. The field was founded as an academic discipline in 1956 and has gone through multiple cycles of optimism and disappointment known as AI winters.', 'Artificial Intelligence', 'AI'),
-(2, 'Machine learning is a field of study in artificial intelligence concerned with the development of statistical algorithms that can learn from data and generalize to unseen data. It finds application in natural language processing, computer vision, speech recognition, email filtering, agriculture and medicine. Deep learning, a subset of machine learning, has allowed neural networks to surpass many previous approaches in performance.', 'Machine Learning', 'AI'),
-(3, 'Retrieval-augmented generation (RAG) is a technique that enables large language models to retrieve and incorporate new information. RAG improves LLMs by incorporating information retrieval before generating responses, pulling relevant text from databases, uploaded documents or web sources. This method helps reduce AI hallucinations and allows LLMs to include sources in their responses for greater transparency.', 'Retrieval-Augmented Generation', 'AI'),
-(4, 'PHP is a general-purpose scripting language geared towards web development created by Rasmus Lerdorf in 1993. PHP code is usually processed on a web server by a PHP interpreter implemented as a module, a daemon or a Common Gateway Interface executable. The language has evolved without a written formal specification with the original implementation acting as the de facto standard.', 'PHP', 'Programming'),
-(5, 'Python is a high-level general-purpose programming language designed by Guido van Rossum. Its design philosophy emphasizes code readability with the use of significant indentation. Python supports multiple programming paradigms including structured, object-oriented and functional programming. It consistently ranks as one of the most popular programming languages and has gained widespread use in the machine learning community.', 'Python', 'Programming'),
-(6, 'Breaking Bad is an American neo-Western crime drama television series created by Vince Gilligan for AMC. The series follows Walter White, an underpaid high school chemistry teacher who turns to producing methamphetamine after being diagnosed with lung cancer. The show stars Bryan Cranston as Walter White, Aaron Paul as Jesse Pinkman, Anna Gunn as Skyler White, Dean Norris as Hank Schrader, and Bob Odenkirk as Saul Goodman. It premiered in 2008 and has been praised as one of the greatest television series of all time.', 'Breaking Bad', 'Entertainment'),
-(7, 'The Mandalorian is an American space Western television series created by Jon Favreau for Disney Plus. It is the first live-action series in the Star Wars franchise and follows Din Djarin, a lone bounty hunter played by Pedro Pascal, who protects a Force-sensitive child named Grogu. The series premiered with the launch of Disney Plus on November 12, 2019 and has received largely positive reviews from critics.', 'The Mandalorian', 'Entertainment'),
-(8, 'Stranger Things is an American television series created by the Duffer Brothers for Netflix. Set in the 1980s, the series centers on the residents of the fictional small town of Hawkins, Indiana, after a nearby facility opens a gateway to a hostile alternate dimension known as the Upside Down. The show stars Winona Ryder, David Harbour, Millie Bobby Brown and Finn Wolfhard.', 'Stranger Things', 'Entertainment'),
-(9, 'Game of Thrones is an American fantasy drama television series created by David Benioff for HBO. It is an adaptation of A Song of Ice and Fire novels. Set on the fictional continents of Westeros and Essos, the show follows several story arcs throughout eight seasons including the Iron Throne succession and the threat from the North.', 'Game of Thrones', 'Entertainment'),
-(10, 'The Office is an American mockumentary sitcom television series adapted for NBC by Greg Daniels. The show depicts the everyday work lives of office employees at the Scranton Pennsylvania branch of the fictional Dunder Mifflin Paper Company. It stars Steve Carell, Rainn Wilson, John Krasinski, Jenna Fischer and B.J. Novak.', 'The Office', 'Entertainment');
-EOF
-––– output –––
-––– comment –––
-Wait for auto-embeddings generation (async via Buddy)
-––– input –––
-mysql -h0 -P9306 -e "debug sleep 30;" > /dev/null 2>&1
-––– output –––
-––– comment –––
-Create RAG model
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL test_assistant (llm_provider='openai', llm_model='gpt-4o-mini');"
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– comment –––
-Test 1: Initial question about RAG (NEW_SEARCH intent)
-Expected: Search for RAG/AI-related documents, response contains RAG keywords
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('What is RAG?', 'docs', 'test_assistant', 'content', 'test-conv-intent-001')\G;" | tee /tmp/rag_intent_test1.txt | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-001
-         response: #!/.*(RAG|[Rr]etrieval|[Gg]eneration|[Aa]ugmented).*/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Verify sources contain AI category documents
-––– input –––
-grep -c '"category":"AI"' /tmp/rag_intent_test1.txt
-––– output –––
-#!/[1-9][0-9]*/!#
-––– comment –––
-Test 2: User expresses rejection (REJECTION intent - "Its boring")
-Expected: System acknowledges rejection, maintains conversation
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Its boring', 'docs', 'test_assistant', 'content', 'test-conv-intent-001')\G;" | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-001
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test 3: Topic change to movies (TOPIC_CHANGE intent)
-Expected: Search for Entertainment category
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('what about movies?', 'docs', 'test_assistant', 'content', 'test-conv-intent-001')\G;" | tee /tmp/rag_intent_test3.txt | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-001
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Verify sources contain Entertainment category after topic change
-––– input –––
-grep -c '"category":"Entertainment"' /tmp/rag_intent_test3.txt
-––– output –––
-#!/[1-9][0-9]*/!#
-––– comment –––
-Test 4: User shows interest in specific show (INTEREST intent)
-Expected: Should find Breaking Bad in sources
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('I like Breaking Bad', 'docs', 'test_assistant', 'content', 'test-conv-intent-001')\G;" | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-001
-         response: #!/.+/!#
-          sources: #!/.*Breaking Bad.*/!#
-––– comment –––
-Test 5: Emotional response (conversational)
-Expected: Responds conversationally, uses previous context
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('omg thats amazing', 'docs', 'test_assistant', 'content', 'test-conv-intent-001')\G;" | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-001
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test 6: Request for more content (ALTERNATIVES intent)
-Expected: Returns more entertainment results
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('show me more entertainment', 'docs', 'test_assistant', 'content', 'test-conv-intent-001')\G;" | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-001
-         response: #!/.+/!#
-          sources: #!/\[.*/!#
-––– comment –––
-Test 7: New independent conversation - Programming topic
-Expected: Fresh context, should find Python
-––– input –––
-mysql -h0 -P9306 -e "CALL CONVERSATIONAL_RAG('Tell me about Python', 'docs', 'test_assistant', 'content', 'test-conv-intent-002')\G;" | tee /tmp/rag_intent_test8.txt | grep -E "conversation_uuid:|response:|sources:"
-––– output –––
-conversation_uuid: test-conv-intent-002
-         response: #!/.*[Pp]ython.*/!#
-          sources: #!/.*Python.*/!#
-––– comment –––
-Verify sources contain Programming category (new conversation context)
-––– input –––
-grep -c '"category":"Programming"' /tmp/rag_intent_test8.txt
-––– output –––
-#!/[1-9][0-9]*/!#
-––– comment –––
-Cleanup
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL test_assistant;"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "DROP TABLE IF EXISTS docs;"
-––– output –––

+ 0 - 148
test/clt-tests/buddy-plugins/test-rag-conversational-negative.rec

@@ -1,148 +0,0 @@
-––– comment –––
-This test verifies error handling in the ConversationalRag plugin.
-It tests various invalid scenarios to ensure proper validation and error messages.
-––– input –––
-export SEARCHD_FLAGS="--iostats --cpustats"
-––– output –––
-––– block: ../base/start-searchd-with-buddy –––
-––– comment –––
-Setup: Create a test table with auto-embeddings for negative tests
-––– input –––
-mysql -h0 -P9306 << EOF
-CREATE TABLE test_docs (
-    id BIGINT,
-    content TEXT,
-    title TEXT,
-    embedding_vector FLOAT_VECTOR
-    knn_type='hnsw'
-    hnsw_similarity='cosine'
-    model_name='sentence-transformers/all-MiniLM-L6-v2'
-    from='content'
-    api_key='\${OPENAI_API_KEY}'
-) TYPE='rt';
-EOF
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "INSERT INTO test_docs (id, content, title) VALUES (1, 'Test document for error handling', 'Test Doc');"
-––– output –––
-––– comment –––
-Create a valid model for testing
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL valid_model (llm_provider='openai', llm_model='gpt-4o-mini');"
-––– output –––
-+--------------------------------------+
-| uuid                                 |
-+--------------------------------------+
-| #!/[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}/!# |
-+--------------------------------------+
-––– comment –––
-Test 1: CREATE RAG MODEL with invalid provider
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL invalid_provider_model (llm_provider='invalid_provider', llm_model='gpt-4o-mini');"
-––– output –––
-ERROR 1064 (42000) at line 1: Invalid LLM provider: invalid_provider. Only 'openai' is supported.
-––– comment –––
-Test 2: CREATE RAG MODEL with missing required parameter
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL incomplete_model (llm_provider='openai');"
-––– output –––
-ERROR 1064 (42000) at line 1: Required field 'llm_model' is missing or empty
-––– comment –––
-Test 3: CREATE RAG MODEL with duplicate name
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL valid_model (llm_provider='openai', llm_model='gpt-4o-mini');"
-––– output –––
-ERROR 1064 (42000) at line 1: RAG model 'valid_model' already exists
-––– comment –––
-Test 4: DESCRIBE RAG MODEL that doesn't exist
-––– input –––
-mysql -h0 -P9306 -e "DESCRIBE RAG MODEL nonexistent_model;"
-––– output –––
-ERROR 1064 (42000) at line 1: RAG model 'nonexistent_model' not found
-––– comment –––
-Test 5: CALL CONVERSATIONAL_RAG with non-existent model
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-CALL CONVERSATIONAL_RAG(
-    'test query',
-    'test_docs',
-    'nonexistent_model',
-    'content'
-);
-EOF
-––– output –––
-ERROR 1064 (42000) at line 1: RAG model 'nonexistent_model' not found
-––– comment –––
-Test 6: CALL CONVERSATIONAL_RAG with non-existent table
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-CALL CONVERSATIONAL_RAG(
-    'test query',
-    'nonexistent_table',
-    'valid_model',
-    'content'
-);
-EOF
-––– output –––
-ERROR 1064 (42000) at line 1: Schema detection failed: no such table 'nonexistent_table'
-––– comment –––
-Test 8: CALL CONVERSATIONAL_RAG with missing required parameters (too few arguments)
-––– input –––
-mysql -h0 -P9306 << 'EOF'
-CALL CONVERSATIONAL_RAG(
-    'test query',
-    'test_docs'
-);
-EOF
-––– output –––
-ERROR 1064 (42000) at line 1: content_fields parameter is required (position 4)
-––– comment –––
-Test 9: DROP non-existent RAG MODEL
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL nonexistent_model;"
-––– output –––
-ERROR 1064 (42000) at line 1: RAG model 'nonexistent_model' not found
-––– comment –––
-Test 10: CREATE RAG MODEL with invalid temperature (below 0)
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL invalid_temp_low_model (llm_provider='openai', llm_model='gpt-4o-mini', temperature='-0.5');"
-––– output –––
-ERROR 1064 (42000) at line 1: Temperature must be between 0 and 2
-––– comment –––
-Test 11: CREATE RAG MODEL with out-of-range temperature (above 2)
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL invalid_temp_model (llm_provider='openai', llm_model='gpt-4o-mini', temperature='3.0');"
-––– output –––
-ERROR 1064 (42000) at line 1: Temperature must be between 0 and 2
-––– comment –––
-Test 12: CREATE RAG MODEL with invalid max_tokens (above 32768)
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL invalid_tokens_model (llm_provider='openai', llm_model='gpt-4o-mini', max_tokens='100000');"
-––– output –––
-ERROR 1064 (42000) at line 1: max_tokens must be between 1 and 32768
-––– comment –––
-Test 13: CREATE RAG MODEL without llm_provider parameter
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL no_provider_model (llm_model='gpt-4o-mini');"
-––– output –––
-ERROR 1064 (42000) at line 1: Required field 'llm_provider' is missing or empty
-––– comment –––
-Test 14: CREATE RAG MODEL with k_results less than 1
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL invalid_k_low_model (llm_provider='openai', llm_model='gpt-4o-mini', k_results='0');"
-––– output –––
-ERROR 1064 (42000) at line 1: k_results must be between 1 and 50
-––– comment –––
-Test 15: CREATE RAG MODEL with k_results greater than 50
-––– input –––
-mysql -h0 -P9306 -e "CREATE RAG MODEL invalid_k_high_model (llm_provider='openai', llm_model='gpt-4o-mini', k_results='51');"
-––– output –––
-ERROR 1064 (42000) at line 1: k_results must be between 1 and 50
-––– comment –––
-Cleanup
-––– input –––
-mysql -h0 -P9306 -e "DROP RAG MODEL valid_model;"
-––– output –––
-––– input –––
-mysql -h0 -P9306 -e "DROP TABLE IF EXISTS test_docs;"
-––– output –––

File diff suppressed because it is too large
+ 0 - 0
test/clt-tests/http-interface/cli-json-endpoint.rec


Some files were not shown because too many files changed in this diff