Skip to content

Commit b343d5a

Browse files
committed
wip
1 parent e41721a commit b343d5a

File tree

6 files changed

+54
-1
lines changed

6 files changed

+54
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""Pytest configuration for phone example tests."""
2+
3+
import pytest
4+
5+
# Override root conftest - we don't need blockbuster for these tests

examples/03_phone_and_rag_example/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff 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]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[pytest]
2+
asyncio_mode = auto
3+
markers =
4+
integration: marks tests as integration tests (require API keys)

examples/03_phone_and_rag_example/rag_turbopuffer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
):
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
"""
3+
1. find files with markdown
4+
5+
"""
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
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\nThe 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()

0 commit comments

Comments
 (0)