-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_example.sh
More file actions
executable file
·85 lines (61 loc) · 2.42 KB
/
run_example.sh
File metadata and controls
executable file
·85 lines (61 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
# Run example analysis
set -e
echo "🧪 Running ContextLab example..."
# Create example documents if they don't exist
mkdir -p examples/sample_docs
if [ ! -f "examples/sample_docs/wiki_1.md" ]; then
echo "Creating sample documents..."
cat > examples/sample_docs/wiki_1.md << 'EOF'
# Machine Learning
Machine learning (ML) is a field of study in artificial intelligence concerned with
the development and study of statistical algorithms that can learn from data and
generalize to unseen data, and thus perform tasks without explicit instructions.
## History
The term "machine learning" was coined in 1959 by Arthur Samuel, an IBM employee
and pioneer in the field of computer gaming and artificial intelligence.
## Types of Learning
Machine learning approaches are traditionally divided into three broad categories:
1. **Supervised learning**: The algorithm learns from labeled training data
2. **Unsupervised learning**: The algorithm learns patterns from unlabeled data
3. **Reinforcement learning**: The algorithm learns through trial and error
EOF
cat > examples/sample_docs/wiki_2.md << 'EOF'
# Artificial Intelligence
Artificial intelligence (AI) is the intelligence of machines or software, as opposed
to the intelligence of humans or animals. It is also the field of study in computer
science that develops and studies intelligent machines.
## Applications
AI has many applications across various industries:
- Natural language processing
- Computer vision
- Robotics
- Expert systems
- Autonomous vehicles
## Machine Learning
Machine learning is a subset of artificial intelligence that focuses on the
development of algorithms that can learn from and make predictions or decisions
based on data. It has become increasingly important in recent years.
EOF
fi
# Run analysis with mock mode (no API key required)
echo "📊 Analyzing documents..."
contextlab analyze examples/sample_docs/*.md \
--model gpt-4o-mini \
--chunk-size 256 \
--overlap 30 \
--out .contextlab \
--mock
# Get the run ID (last line of output)
RUN_ID=$(ls -t .contextlab/runs | head -1)
echo "✅ Analysis complete! Run ID: $RUN_ID"
# Visualize results
echo "📈 Visualizing results..."
contextlab viz "$RUN_ID" --headless
echo ""
echo "🎉 Example complete!"
echo ""
echo "To view in web UI:"
echo " 1. Start API: make api"
echo " 2. Start web UI: cd web && npm run dev"
echo " 3. Navigate to: http://localhost:5173/runs/$RUN_ID"