File tree Expand file tree Collapse file tree 6 files changed +54
-1
lines changed
examples/03_phone_and_rag_example Expand file tree Collapse file tree 6 files changed +54
-1
lines changed Original file line number Diff line number Diff line change 1+ """Pytest configuration for phone example tests."""
2+
3+ import pytest
4+
5+ # Override root conftest - we don't need blockbuster for these tests
Original file line number Diff line number Diff line change @@ -20,6 +20,9 @@ dependencies = [
2020 " turbopuffer>=0.1" ,
2121 " langchain-google-genai>=2.0" ,
2222 " langchain-text-splitters>=0.3" ,
23+ # Testing
24+ " pytest>=8.0" ,
25+ " pytest-asyncio>=0.24" ,
2326]
2427
2528[tool .uv .sources ]
Original file line number Diff line number Diff line change 1+ [pytest]
2+ asyncio_mode = auto
3+ markers =
4+ integration: marks tests as integration tests (require API keys)
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def __init__(
104104 self ,
105105 namespace : str ,
106106 embedding_model : str = "models/gemini-embedding-001" ,
107- chunk_size : int = 1000 ,
107+ chunk_size : int = 10000 ,
108108 chunk_overlap : int = 200 ,
109109 region : str = "gcp-us-central1" ,
110110 ):
Original file line number Diff line number Diff line change 1+
2+ """
3+ 1. find files with markdown
4+
5+ """
Original file line number Diff line number Diff line change 1+ """Tests for TurboPuffer Hybrid RAG."""
2+
3+ from pathlib import Path
4+
5+ import pytest
6+ from dotenv import load_dotenv
7+
8+ from rag_turbopuffer import TurboPufferRAG
9+
10+ load_dotenv ()
11+ import logging
12+
13+ logger = logging .getLogger (__name__ )
14+ logger .setLevel (logging .DEBUG )
15+
16+ @pytest .fixture
17+ def knowledge_dir (tmp_path : Path ) -> Path :
18+ """Create temp directory with a test document."""
19+ doc = tmp_path / "test.md"
20+ doc .write_text ("# Stream Chat API\n \n The Chat API supports real-time messaging and moderation." )
21+ return tmp_path
22+
23+
24+ @pytest .mark .integration
25+ async def test_index_and_search (knowledge_dir : Path ):
26+ """Index a document and find it via search."""
27+ rag = TurboPufferRAG (namespace = "test-rag" )
28+
29+ await rag .index_directory (knowledge_dir )
30+
31+ result = await rag .search ("chat messaging" )
32+ assert "Chat" in result
33+ logger .info ("result %s" , result )
34+ import pdb ; pdb .set_trace ()
35+
36+ await rag .close ()
You can’t perform that action at this time.
0 commit comments