You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DEVELOPMENT_INSTRUCTIONS.md
+2-1Lines changed: 2 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,4 +4,5 @@
4
4
- Make sure there are concise and up to date docstrings that document usage.
5
5
- Debug information belongs into the command line logs, not in the app UI/UX.
6
6
- Always develop a generic solution, do not use content from specific examples in the code
7
-
- Never include content from example documents in the source code. Never leak content from provided examples into test code!
7
+
- Never include content from example documents in the source code. Never leak content from provided examples into test code!
8
+
- If you create new .py files for testing or debugging, place them in the experiments folder. Delete them after they are no longer useful. If they yield meaningful unit tests, integrate them into the test suite.
total_tokens=doc_tokens+system_prompt_length# Reserve space for system prompt and user query
269
+
# Generate the actual system prompt to measure its real size
270
+
system_prompt=f"""You are a document analysis assistant. Answer questions ONLY using information from this document:
271
+
272
+
DOCUMENT CONTENT:
273
+
{document_text}
274
+
275
+
INITIAL CHECK:
276
+
First, verify you have received document content above. If the document is empty or missing, respond: "Error: No document content received, cannot proceed."
277
+
278
+
RESPONSE RULES:
279
+
Choose ONE approach based on whether the document contains relevant information:
280
+
281
+
1. **IF ANSWERABLE**: Provide a complete answer with citations
282
+
- Every factual claim must have a citation [1], [2], etc.
283
+
- List citations at the end using this exact format:
284
+
[1] "exact quote from document"
285
+
[2] "another exact quote"
286
+
287
+
2. **IF NOT ANSWERABLE**: Decline to answer
288
+
- State: "I cannot answer this based on the document"
289
+
- Do NOT include any citations when declining
290
+
- Do not attempt to answer the question with your own knowledge.
291
+
292
+
CITATION GUIDELINES:
293
+
- Use verbatim quotes in their original language (never translate)
294
+
- Quote meaningful phrases (3-8 words) that provide context
295
+
- Include descriptive context around numbers/measurements
296
+
- Each citation on its own line
297
+
298
+
LANGUAGE RULES:
299
+
- Respond in the user's language
300
+
- Keep citations in the document's original language
301
+
302
+
EXAMPLE - Answerable:
303
+
Q: Does he have medical experience?
304
+
A: Yes, he has experience in medical applications. [1]
305
+
306
+
[1] "project development for AI applications: medical data mining & AI"
This folder contains development tools, debugging scripts, and experimental code that are useful for development but not part of the main application or test suite.
4
+
5
+
## Files
6
+
7
+
### `debug_context.py`
8
+
**Purpose**: Debug and analyze context window calculations for Ollama models.
9
+
10
+
**Usage**:
11
+
```bash
12
+
# Debug context detection for all available models
- Analyzes text quality and structure preservation
50
+
- Compares different approaches
51
+
- Saves extracted text for inspection
52
+
- Shows document statistics and metadata
53
+
54
+
## When to Use These Tools
55
+
56
+
-**During development**: When working on extraction or context handling features
57
+
-**For debugging**: When troubleshooting issues with specific models or documents
58
+
-**For analysis**: When evaluating extraction quality or performance
59
+
-**For demonstrations**: When showing capabilities to stakeholders
60
+
61
+
## Integration with Main Codebase
62
+
63
+
These tools import from the main `ragnarok` package and `app.py`, so they test the actual production code. They're kept separate to avoid cluttering the main application while remaining useful for development.
0 commit comments