Instructions to use Navaneeth-14/rag-hackathon-app with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- llama.cpp
How to use Navaneeth-14/rag-hackathon-app with llama.cpp:
Install (macOS, Linux)
curl -LsSf https://llama.app/install.sh | sh # Start a local OpenAI-compatible server with a web UI: llama serve -hf Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: llama cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama serve -hf Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: llama cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf Navaneeth-14/rag-hackathon-app:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf Navaneeth-14/rag-hackathon-app:Q4_K_M
Use Docker
docker model run hf.co/Navaneeth-14/rag-hackathon-app:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use Navaneeth-14/rag-hackathon-app with Ollama:
ollama run hf.co/Navaneeth-14/rag-hackathon-app:Q4_K_M
- Unsloth Studio
How to use Navaneeth-14/rag-hackathon-app with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Navaneeth-14/rag-hackathon-app to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for Navaneeth-14/rag-hackathon-app to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for Navaneeth-14/rag-hackathon-app to start chatting
- Docker Model Runner
How to use Navaneeth-14/rag-hackathon-app with Docker Model Runner:
docker model run hf.co/Navaneeth-14/rag-hackathon-app:Q4_K_M
- Lemonade
How to use Navaneeth-14/rag-hackathon-app with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull Navaneeth-14/rag-hackathon-app:Q4_K_M
Run and chat with the model
lemonade run user.rag-hackathon-app-Q4_K_M
List all available models
lemonade list
- Atomic Chat
| """ | |
| Test file for Query Parser | |
| Checks if query_parser.py is working correctly with various test cases | |
| """ | |
| import sys | |
| import os | |
| from datetime import datetime | |
| def test_query_parser_import(): | |
| """Test if query parser can be imported without errors""" | |
| print("π§ͺ Testing Query Parser Import") | |
| print("="*40) | |
| try: | |
| from query_parser import AdvancedQueryParser, ParsedQuery, QueryEntity | |
| print("β Query parser imported successfully") | |
| return True | |
| except Exception as e: | |
| print(f"β Error importing query parser: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| return False | |
| def test_query_parser_initialization(): | |
| """Test if query parser can be initialized""" | |
| print("\nπ§ͺ Testing Query Parser Initialization") | |
| print("="*50) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| # Test initialization with default parameters | |
| print("π Initializing query parser...") | |
| parser = AdvancedQueryParser(use_gpu=False) # Use CPU for testing | |
| print("β Query parser initialized successfully") | |
| # Test basic attributes | |
| print("π Checking parser attributes...") | |
| assert hasattr(parser, 'lemmatizer'), "Lemmatizer not found" | |
| assert hasattr(parser, 'stop_words'), "Stop words not found" | |
| assert hasattr(parser, 'insurance_entities'), "Insurance entities not found" | |
| assert hasattr(parser, 'query_types'), "Query types not found" | |
| print("β All required attributes present") | |
| return True | |
| except Exception as e: | |
| print(f"β Error initializing query parser: {e}") | |
| import traceback | |
| traceback.print_exc() | |
| return False | |
| def test_basic_query_parsing(): | |
| """Test basic query parsing functionality""" | |
| print("\nπ§ͺ Testing Basic Query Parsing") | |
| print("="*40) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| parser = AdvancedQueryParser(use_gpu=False) | |
| # Test queries | |
| test_queries = [ | |
| "Is heart surgery covered?", | |
| "How do I file a claim?", | |
| "What's the waiting period?", | |
| "Can I claim for dental treatment?", | |
| "What documents are needed?" | |
| ] | |
| results = [] | |
| for i, query in enumerate(test_queries): | |
| print(f"\nπ Test Query {i+1}: {query}") | |
| try: | |
| parsed = parser.parse_query(query) | |
| # Check if parsed query has required attributes | |
| assert hasattr(parsed, 'original_query'), "Missing original_query" | |
| assert hasattr(parsed, 'enhanced_query'), "Missing enhanced_query" | |
| assert hasattr(parsed, 'query_type'), "Missing query_type" | |
| assert hasattr(parsed, 'entities'), "Missing entities" | |
| assert hasattr(parsed, 'intent'), "Missing intent" | |
| assert hasattr(parsed, 'confidence'), "Missing confidence" | |
| assert hasattr(parsed, 'keywords'), "Missing keywords" | |
| assert hasattr(parsed, 'synonyms'), "Missing synonyms" | |
| assert hasattr(parsed, 'context'), "Missing context" | |
| assert hasattr(parsed, 'timestamp'), "Missing timestamp" | |
| print(f" β Parsed successfully") | |
| print(f" π Type: {parsed.query_type}") | |
| print(f" π― Intent: {parsed.intent}") | |
| print(f" π Confidence: {parsed.confidence:.2f}") | |
| print(f" π Keywords: {parsed.keywords[:3]}") | |
| print(f" π·οΈ Entities: {list(parsed.entities.keys())}") | |
| results.append(True) | |
| except Exception as e: | |
| print(f" β Failed to parse: {e}") | |
| results.append(False) | |
| success_count = sum(results) | |
| total_count = len(results) | |
| print(f"\nπ Basic Parsing Results: {success_count}/{total_count} successful") | |
| return success_count == total_count | |
| except Exception as e: | |
| print(f"β Error in basic query parsing: {e}") | |
| return False | |
| def test_entity_extraction(): | |
| """Test entity extraction functionality""" | |
| print("\nπ§ͺ Testing Entity Extraction") | |
| print("="*40) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| parser = AdvancedQueryParser(use_gpu=False) | |
| # Test queries with specific entities | |
| test_cases = [ | |
| { | |
| 'query': "Is heart surgery covered under my policy?", | |
| 'expected_entities': ['medical_condition', 'coverage_type'] | |
| }, | |
| { | |
| 'query': "Can I claim $5000 for dental treatment?", | |
| 'expected_entities': ['amount', 'medical_condition'] | |
| }, | |
| { | |
| 'query': "What's the 30-day waiting period for pre-existing conditions?", | |
| 'expected_entities': ['time_period'] | |
| }, | |
| { | |
| 'query': "Do I need a doctor's report for this claim?", | |
| 'expected_entities': ['document_type'] | |
| } | |
| ] | |
| results = [] | |
| for i, test_case in enumerate(test_cases): | |
| query = test_case['query'] | |
| expected_entities = test_case['expected_entities'] | |
| print(f"\nπ Test Case {i+1}: {query}") | |
| try: | |
| parsed = parser.parse_query(query) | |
| extracted_entities = list(parsed.entities.keys()) | |
| print(f" π·οΈ Extracted entities: {extracted_entities}") | |
| print(f" π― Expected entities: {expected_entities}") | |
| # Check if any expected entities were found | |
| found_entities = [entity for entity in expected_entities if entity in extracted_entities] | |
| if found_entities: | |
| print(f" β Found expected entities: {found_entities}") | |
| results.append(True) | |
| else: | |
| print(f" β οΈ No expected entities found") | |
| results.append(False) | |
| except Exception as e: | |
| print(f" β Error: {e}") | |
| results.append(False) | |
| success_count = sum(results) | |
| total_count = len(results) | |
| print(f"\nπ Entity Extraction Results: {success_count}/{total_count} successful") | |
| return success_count > 0 # At least some entities should be found | |
| except Exception as e: | |
| print(f"β Error in entity extraction: {e}") | |
| return False | |
| def test_query_classification(): | |
| """Test query type classification""" | |
| print("\nπ§ͺ Testing Query Classification") | |
| print("="*40) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| parser = AdvancedQueryParser(use_gpu=False) | |
| # Test queries for different types | |
| test_cases = [ | |
| { | |
| 'query': "How do I file a claim?", | |
| 'expected_type': 'claim_inquiry' | |
| }, | |
| { | |
| 'query': "What is covered under my policy?", | |
| 'expected_type': 'coverage_check' | |
| }, | |
| { | |
| 'query': "What are the policy terms?", | |
| 'expected_type': 'policy_review' | |
| }, | |
| { | |
| 'query': "Is dental treatment covered?", | |
| 'expected_type': 'medical_coverage' | |
| }, | |
| { | |
| 'query': "What is this document about?", | |
| 'expected_type': 'general_inquiry' | |
| } | |
| ] | |
| results = [] | |
| for i, test_case in enumerate(test_cases): | |
| query = test_case['query'] | |
| expected_type = test_case['expected_type'] | |
| print(f"\nπ Test Case {i+1}: {query}") | |
| try: | |
| parsed = parser.parse_query(query) | |
| actual_type = parsed.query_type | |
| print(f" π― Expected type: {expected_type}") | |
| print(f" π Actual type: {actual_type}") | |
| print(f" π Confidence: {parsed.confidence:.2f}") | |
| if actual_type == expected_type: | |
| print(f" β Classification correct") | |
| results.append(True) | |
| else: | |
| print(f" β οΈ Classification mismatch") | |
| results.append(False) | |
| except Exception as e: | |
| print(f" β Error: {e}") | |
| results.append(False) | |
| success_count = sum(results) | |
| total_count = len(results) | |
| print(f"\nπ Classification Results: {success_count}/{total_count} correct") | |
| return success_count > 0 # At least some classifications should work | |
| except Exception as e: | |
| print(f"β Error in query classification: {e}") | |
| return False | |
| def test_query_suggestions(): | |
| """Test query suggestion functionality""" | |
| print("\nπ§ͺ Testing Query Suggestions") | |
| print("="*40) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| parser = AdvancedQueryParser(use_gpu=False) | |
| # Test queries for suggestions | |
| test_queries = [ | |
| "claim", | |
| "coverage", | |
| "medical", | |
| "policy", | |
| "documents" | |
| ] | |
| results = [] | |
| for i, query in enumerate(test_queries): | |
| print(f"\nπ Test Query {i+1}: {query}") | |
| try: | |
| suggestions = parser.get_query_suggestions(query) | |
| print(f" π‘ Suggestions: {len(suggestions)} found") | |
| for j, suggestion in enumerate(suggestions[:2]): | |
| print(f" {j+1}. {suggestion}") | |
| if suggestions: | |
| print(f" β Suggestions generated successfully") | |
| results.append(True) | |
| else: | |
| print(f" β οΈ No suggestions generated") | |
| results.append(False) | |
| except Exception as e: | |
| print(f" β Error: {e}") | |
| results.append(False) | |
| success_count = sum(results) | |
| total_count = len(results) | |
| print(f"\nπ Suggestion Results: {success_count}/{total_count} successful") | |
| return success_count > 0 # At least some suggestions should work | |
| except Exception as e: | |
| print(f"β Error in query suggestions: {e}") | |
| return False | |
| def test_error_handling(): | |
| """Test error handling with invalid inputs""" | |
| print("\nπ§ͺ Testing Error Handling") | |
| print("="*40) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| parser = AdvancedQueryParser(use_gpu=False) | |
| # Test with invalid inputs | |
| invalid_inputs = [ | |
| "", # Empty string | |
| " ", # Whitespace only | |
| "a", # Single character | |
| "123", # Numbers only | |
| "!@#$%", # Special characters only | |
| None # None value | |
| ] | |
| results = [] | |
| for i, invalid_input in enumerate(invalid_inputs): | |
| print(f"\nπ Test Case {i+1}: {repr(invalid_input)}") | |
| try: | |
| parsed = parser.parse_query(invalid_input) | |
| # Should return a basic parsed query | |
| assert parsed is not None, "Should return a parsed query" | |
| assert hasattr(parsed, 'original_query'), "Should have original_query" | |
| assert hasattr(parsed, 'enhanced_query'), "Should have enhanced_query" | |
| print(f" β Handled gracefully") | |
| results.append(True) | |
| except Exception as e: | |
| print(f" β Error: {e}") | |
| results.append(False) | |
| success_count = sum(results) | |
| total_count = len(results) | |
| print(f"\nπ Error Handling Results: {success_count}/{total_count} handled") | |
| return success_count > 0 # At least some should be handled | |
| except Exception as e: | |
| print(f"β Error in error handling test: {e}") | |
| return False | |
| def test_comprehensive_workflow(): | |
| """Test a comprehensive workflow with real-world queries""" | |
| print("\nπ§ͺ Testing Comprehensive Workflow") | |
| print("="*50) | |
| try: | |
| from query_parser import AdvancedQueryParser | |
| parser = AdvancedQueryParser(use_gpu=False) | |
| # Real-world insurance queries | |
| real_queries = [ | |
| "I need to file a claim for my recent heart surgery that cost $25,000", | |
| "What's covered under my health insurance policy for dental procedures?", | |
| "How long is the waiting period for pre-existing conditions?", | |
| "Do I need a doctor's report and medical certificate for this claim?", | |
| "Can I claim for prescription medications and hospital stays?" | |
| ] | |
| results = [] | |
| for i, query in enumerate(real_queries): | |
| print(f"\nπ Real Query {i+1}: {query}") | |
| try: | |
| parsed = parser.parse_query(query) | |
| print(f" π Type: {parsed.query_type}") | |
| print(f" π― Intent: {parsed.intent}") | |
| print(f" π Confidence: {parsed.confidence:.2f}") | |
| print(f" π Keywords: {parsed.keywords[:5]}") | |
| print(f" π·οΈ Entities: {list(parsed.entities.keys())}") | |
| # Check if enhanced query is different from original | |
| if parsed.enhanced_query != parsed.original_query: | |
| print(f" β¨ Query enhanced successfully") | |
| # Check if we have meaningful results | |
| if parsed.confidence > 0.0 or parsed.keywords or parsed.entities: | |
| print(f" β Meaningful results extracted") | |
| results.append(True) | |
| else: | |
| print(f" β οΈ Limited results") | |
| results.append(False) | |
| except Exception as e: | |
| print(f" β Error: {e}") | |
| results.append(False) | |
| success_count = sum(results) | |
| total_count = len(results) | |
| print(f"\nπ Comprehensive Results: {success_count}/{total_count} successful") | |
| return success_count > 0 # At least some should work | |
| except Exception as e: | |
| print(f"β Error in comprehensive workflow: {e}") | |
| return False | |
| def main(): | |
| """Run all tests""" | |
| print("π Query Parser Test Suite") | |
| print("="*60) | |
| print("Testing query_parser.py functionality") | |
| print() | |
| # Run all tests | |
| tests = [ | |
| ("Import Test", test_query_parser_import), | |
| ("Initialization Test", test_query_parser_initialization), | |
| ("Basic Parsing Test", test_basic_query_parsing), | |
| ("Entity Extraction Test", test_entity_extraction), | |
| ("Query Classification Test", test_query_classification), | |
| ("Query Suggestions Test", test_query_suggestions), | |
| ("Error Handling Test", test_error_handling), | |
| ("Comprehensive Workflow Test", test_comprehensive_workflow) | |
| ] | |
| results = {} | |
| for test_name, test_func in tests: | |
| print(f"\n{'='*60}") | |
| print(f"π§ͺ Running {test_name}") | |
| print(f"{'='*60}") | |
| success = test_func() | |
| results[test_name] = success | |
| if success: | |
| print(f"β {test_name} PASSED") | |
| else: | |
| print(f"β {test_name} FAILED") | |
| # Summary | |
| print(f"\n{'='*60}") | |
| print("π TEST SUMMARY") | |
| print(f"{'='*60}") | |
| passed = sum(results.values()) | |
| total = len(results) | |
| for test_name, success in results.items(): | |
| status = "β PASS" if success else "β FAIL" | |
| print(f"{test_name:<30}: {status}") | |
| print(f"\nOverall: {passed}/{total} tests passed") | |
| if passed == total: | |
| print("π All tests passed! Your query parser is working correctly.") | |
| elif passed > total // 2: | |
| print("β οΈ Most tests passed, but some issues need attention.") | |
| print("\nπ‘ Areas to check:") | |
| for test_name, success in results.items(): | |
| if not success: | |
| print(f" - {test_name}") | |
| else: | |
| print("β Many tests failed. Check the error messages above.") | |
| print("\nπ‘ Common issues:") | |
| print(" - Missing dependencies (NLTK, spaCy)") | |
| print(" - Import errors") | |
| print(" - Initialization problems") | |
| if __name__ == "__main__": | |
| main() |