-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathdataset.py
More file actions
84 lines (67 loc) · 2.33 KB
/
Copy pathdataset.py
File metadata and controls
84 lines (67 loc) · 2.33 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
"""
Optional helper module containing:
- SAMPLE_QUERIES used during the activity
- FALLBACK_DOCS, an in memory documentation corpus used if the docs/ folder
is missing or cannot be loaded
"""
# -----------------------------------------------------------
# Sample queries used throughout Phase 0, 1, and 2
# -----------------------------------------------------------
SAMPLE_QUERIES = [
"Where is the auth token generated?",
"What environment variables are required for authentication?",
"How do I connect to the database?",
"Which endpoint lists all users?",
"What does the /api/projects/<project_id> route return?",
"Is there any mention of payment processing in these docs?",
"How does a client refresh an access token?",
"Which fields are stored in the users table?",
]
# -----------------------------------------------------------
# Optional fallback documentation corpus
# Used only if docs/ directory is missing.
# -----------------------------------------------------------
FALLBACK_DOCS = {
"AUTH.md": """
# Authentication Guide
Tokens are created by the generate_access_token function inside auth_utils.py.
They are signed using the AUTH_SECRET_KEY environment variable.
Clients authenticate by sending a POST request to /api/login. They receive
a token which must be included in the Authorization header for all future
requests.
A token can be refreshed using POST /api/refresh.
""",
"API_REFERENCE.md": """
# API Reference
GET /api/users returns all users. Requires a valid Authorization token.
GET /api/users/<user_id> returns data for a specific user.
GET /api/projects/<project_id> returns detailed project info.
POST /api/login validates credentials and returns an access token.
""",
"DATABASE.md": """
# Database Guide
The users table contains:
- user_id
- email
- password_hash
- joined_at
The projects table contains:
- project_id
- name
- description
- status
- owner_id
""",
"SETUP.md": """
# Setup Guide
Set DATABASE_URL and AUTH_SECRET_KEY before running the application.
Install dependencies with pip install -r requirements.txt.
Run the server using python app.py.
"""
}
def load_fallback_documents():
"""
Returns FALLBACK_DOCS as a list of (filename, text) tuples.
Provided as a helper for environments where no docs/ folder is available.
"""
return list(FALLBACK_DOCS.items())