Skip to content

Commit 1451ec4

Browse files
authored
feat: add Cursor.new() method and notebook improvements
- Add Cursor.new() method for creating fresh conversation threads - Fix DatabricksAgent empty text elements issue - Add notebook build utilities and improve cleaning scripts - Update vibes tutorial notebook with lui.new() pattern - Improve pre-commit hook to recognize redaction patterns
1 parent 64ff541 commit 1451ec4

22 files changed

+2585
-1158
lines changed

.github/workflows/ci.yml

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
pull_request:
66
types: [opened, synchronize, reopened]
77

8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
812
jobs:
913
# Stage 1: Quick quality checks (fail fast on basic issues)
1014
quality-checks:
@@ -30,11 +34,35 @@ jobs:
3034
- name: Type Check (mypy)
3135
run: uv run mypy .
3236

33-
# Stage 2: Unit tests (only run if quality checks pass)
37+
# Stage 2: Light smoke test (quick test run before full matrix)
38+
light-smoke-test:
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
needs: quality-checks
42+
steps:
43+
- uses: actions/checkout@v3
44+
- uses: actions/setup-python@v4
45+
with:
46+
python-version: "3.12"
47+
- name: Install uv
48+
run: |
49+
curl -LsSf https://astral.sh/uv/install.sh | sh
50+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
51+
- name: Install dependencies
52+
run: |
53+
uv venv --python python3.12
54+
uv pip install -e ".[dev]"
55+
- name: Run basic smoke tests
56+
run: |
57+
# Run only critical tests to quickly catch obvious failures
58+
source .venv/bin/activate
59+
python -m pytest tests/unit/test_imports.py tests/unit/test_louie_factory.py -v --tb=short
60+
61+
# Stage 3: Unit tests (only run if smoke test passes)
3462
unit-tests:
3563
runs-on: ubuntu-latest
3664
timeout-minutes: 10
37-
needs: quality-checks
65+
needs: [quality-checks, light-smoke-test]
3866
strategy:
3967
matrix:
4068
python-version: ["3.10", "3.11", "3.12", "3.13"]
@@ -64,7 +92,7 @@ jobs:
6492
name: Unit Tests
6593
fail_ci_if_error: false # Don't fail if Codecov is down
6694

67-
# Stage 3: Integration tests (conditional on credentials)
95+
# Stage 4: Integration tests (conditional on credentials)
6896
integration-tests:
6997
runs-on: ubuntu-latest
7098
timeout-minutes: 10
@@ -108,7 +136,7 @@ jobs:
108136
name: Integration Tests
109137
fail_ci_if_error: false
110138

111-
# Stage 4: Documentation tests (can run in parallel with other tests)
139+
# Stage 5: Documentation tests (can run in parallel with other tests)
112140
docs-test:
113141
runs-on: ubuntu-latest
114142
timeout-minutes: 10
@@ -149,7 +177,7 @@ jobs:
149177
test -f site/assets/louie-logo.png || (echo "❌ Logo not found in built docs" && exit 1)
150178
echo "✅ Logo included in documentation"
151179
152-
# Stage 5: Build and installation tests (only if unit tests pass)
180+
# Stage 6: Build and installation tests (only if unit tests pass)
153181
install-test:
154182
runs-on: ubuntu-latest
155183
timeout-minutes: 10
@@ -196,7 +224,7 @@ jobs:
196224
# Final summary job (for branch protection rules)
197225
ci-success:
198226
runs-on: ubuntu-latest
199-
needs: [quality-checks, unit-tests, docs-test, install-test]
227+
needs: [quality-checks, light-smoke-test, unit-tests, docs-test, install-test]
200228
# Note: integration-tests is not required since it's conditional
201229
if: always()
202230
steps:

.gitsecret-whitelist

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,4 @@ README.md
1414
config.template.json
1515
.env.examplesrc/louieai/_client.py
1616
docs/getting-started/notebooks/*.ipynb
17+
src/louieai/__init__.py

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,14 @@
66

77
AI-powered investigation platform for natural language data analysis.
88

9+
10+
11+
https://github.com/user-attachments/assets/de73f7b3-2862-4298-b9d8-2d38426ab255
12+
13+
[Video: Louie <> Graphistry - Python edition!](https://www.loom.com/share/8d84c9abc0e34df6b233bd7b2e10af9a?sid=4a87707a-79e6-416b-a628-01b5c31c7db3)
14+
15+
16+
917
## 🚀 Get Started in 30 Seconds
1018

1119
```python
@@ -139,4 +147,4 @@ We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
139147

140148
## License
141149

142-
Apache 2.0 - see [LICENSE](LICENSE)
150+
Apache 2.0 - see [LICENSE](LICENSE)

docs/api/notebook.md

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ The cleanest import method - make the module itself callable:
3030
import louieai
3131

3232
# Create authenticated instance
33-
lui = louieai(username="user", password="pass")
33+
lui = louieai(username="user", password="<password>")
3434
# Or with existing PyGraphistry client
3535
lui = louieai(g)
3636

@@ -271,7 +271,7 @@ cursor = louie()
271271

272272
# Create cursor with PyGraphistry client
273273
import graphistry
274-
g = graphistry.register(api=3, username="user", password="pass")
274+
g = graphistry.register(api=3, username="user", password="<password>")
275275
cursor = louie(g)
276276

277277
# Create cursor with personal key authentication
@@ -284,11 +284,50 @@ cursor = louie(
284284
# Create cursor with API key
285285
cursor = louie(api_key="your_api_key")
286286

287+
# Create cursor with thread name and share mode
288+
cursor = louie(name="Security Analysis", share_mode="Organization")
289+
287290
# Use any cursor
288291
cursor("Your query here")
289292
print(cursor.text)
290293
```
291294

295+
### Creating New Conversation Threads
296+
297+
The `new()` method allows you to create fresh conversation threads while preserving all authentication and configuration:
298+
299+
```python
300+
# Start with your main analysis
301+
lui = louie()
302+
lui("Analyze security incidents from last week")
303+
304+
# Create a new thread for a different topic
305+
perf_analysis = lui.new(name="Performance Analysis")
306+
perf_analysis("Show me API response times")
307+
308+
# Create another thread with different visibility
309+
private_investigation = lui.new(
310+
name="Sensitive Investigation",
311+
share_mode="Private"
312+
)
313+
private_investigation("Investigate user account anomalies")
314+
315+
# Original thread is unchanged
316+
lui("Continue with security analysis...") # Still in original thread
317+
```
318+
319+
**Key features of `new()`:**
320+
- **Preserves all configuration**: Authentication, server URLs, timeouts
321+
- **Fresh context**: Each new thread starts without previous conversation history
322+
- **Optional naming**: Provide meaningful names to organize your analyses
323+
- **Share mode control**: Override visibility per thread (Private, Organization, Public)
324+
325+
**Common use cases:**
326+
1. **Organize by topic**: Separate threads for security, performance, business analysis
327+
2. **Isolate investigations**: Keep sensitive queries in private threads
328+
3. **Parallel analysis**: Run different analyses without context confusion
329+
4. **Clean slate**: Start fresh when switching to unrelated topics
330+
292331
### Custom Client Configuration
293332

294333
For more control, you can create a client directly:
@@ -310,7 +349,7 @@ client = LouieClient(
310349
client = LouieClient(
311350
server_url="https://custom.louie.ai",
312351
username="user",
313-
password="pass"
352+
password="<password>"
314353
)
315354

316355
# Create cursor with custom client
@@ -350,11 +389,11 @@ lui = louie()
350389
# 2. From existing PyGraphistry client
351390
import graphistry
352391
gc = graphistry.client()
353-
gc.register(api=3, username="user", password="pass")
392+
gc.register(api=3, username="user", password="<password>")
354393
lui = louie(gc)
355394

356395
# 3. With direct credentials
357-
lui = louie(username="user", password="pass")
396+
lui = louie(username="user", password="<password>")
358397
lui = louie(personal_key_id="pk_123", personal_key_secret="sk_456")
359398
lui = louie(api_key="your_api_key")
360399

0 commit comments

Comments
 (0)