Test the specific issues identified in the codebase.
| 369 | |
| 370 | |
| 371 | class TestIssuesIdentified: |
| 372 | """Test the specific issues identified in the codebase.""" |
| 373 | |
| 374 | def test_binary_assumptions_in_rag(self): |
| 375 | """Test that RAG doesn't make binary assumptions about embedders.""" |
| 376 | from api.rag import RAG |
| 377 | |
| 378 | # The current implementation only considers is_ollama_embedder |
| 379 | # This test documents the current behavior and will help verify fixes |
| 380 | try: |
| 381 | rag = RAG() |
| 382 | |
| 383 | # Current implementation only has is_ollama_embedder |
| 384 | assert hasattr(rag, 'is_ollama_embedder'), "RAG should have is_ollama_embedder" |
| 385 | |
| 386 | # This is the issue: no explicit support for Google embedder detection |
| 387 | # The fix should add proper embedder type detection |
| 388 | |
| 389 | except Exception as e: |
| 390 | logger.warning(f"RAG test failed: {e}") |
| 391 | |
| 392 | def test_binary_assumptions_in_data_pipeline(self): |
| 393 | """Test binary assumptions in data pipeline functions.""" |
| 394 | from api.data_pipeline import prepare_data_pipeline, count_tokens |
| 395 | |
| 396 | # These functions currently only consider is_ollama_embedder parameter |
| 397 | # This test documents the issue and will verify fixes |
| 398 | |
| 399 | # count_tokens only considers ollama vs non-ollama |
| 400 | token_count_ollama = count_tokens("test", is_ollama_embedder=True) |
| 401 | token_count_other = count_tokens("test", is_ollama_embedder=False) |
| 402 | |
| 403 | assert isinstance(token_count_ollama, int) |
| 404 | assert isinstance(token_count_other, int) |
| 405 | |
| 406 | # prepare_data_pipeline only accepts is_ollama_embedder parameter |
| 407 | try: |
| 408 | pipeline_ollama = prepare_data_pipeline(is_ollama_embedder=True) |
| 409 | pipeline_other = prepare_data_pipeline(is_ollama_embedder=False) |
| 410 | |
| 411 | assert pipeline_ollama is not None |
| 412 | assert pipeline_other is not None |
| 413 | except Exception as e: |
| 414 | logger.warning(f"Pipeline creation failed: {e}") |
| 415 | |
| 416 | |
| 417 | def run_all_tests(): |
nothing calls this directly
no outgoing calls
no test coverage detected