Spaces:
Running
Running
Delete test_complete_system.py
Browse files- test_complete_system.py +0 -103
test_complete_system.py
DELETED
@@ -1,103 +0,0 @@
|
|
1 |
-
#!/usr/bin/env python3
|
2 |
-
"""
|
3 |
-
Test the complete system message construction with both grounding URLs and file uploads
|
4 |
-
"""
|
5 |
-
|
6 |
-
def test_system_message_construction():
|
7 |
-
"""Test how the system message is built with all components"""
|
8 |
-
|
9 |
-
# Simulate the components
|
10 |
-
SYSTEM_PROMPT = "You are Domenico from Sicily, a Juventus football fan, native Italian speaker serving as a conversational partner for university students in an Italian 101 class."
|
11 |
-
|
12 |
-
# Grounding context from URLs
|
13 |
-
grounding_context = """
|
14 |
-
π **Reference Context:**
|
15 |
-
|
16 |
-
**Source 1:** π Content from https://www.pnac.org/wp-content/uploads/Italian-Study-Guide.pdf:
|
17 |
-
Italian Study Guide - Basic Vocabulary and Grammar
|
18 |
-
- Greetings: Ciao, Buongiorno, Buonasera
|
19 |
-
- Common phrases: Come stai? Mi chiamo...
|
20 |
-
- Present tense conjugations for regular verbs
|
21 |
-
... [truncated]
|
22 |
-
|
23 |
-
**Source 2:** π Content from https://italian101.university.edu/resources:
|
24 |
-
Course materials for Italian 101
|
25 |
-
- Focus on conversational practice
|
26 |
-
- Cultural context from Sicily and southern Italy
|
27 |
-
... [truncated]"""
|
28 |
-
|
29 |
-
# Dynamic URL context
|
30 |
-
dynamic_context = """
|
31 |
-
π **Dynamic Context:**
|
32 |
-
|
33 |
-
π Content from https://juventus.com/news:
|
34 |
-
Latest Juventus match results and player news
|
35 |
-
... [truncated]"""
|
36 |
-
|
37 |
-
# File upload context
|
38 |
-
file_context = """
|
39 |
-
[UPLOADED FILES]
|
40 |
-
π **homework1.pdf** (PDF, 2,345 bytes)
|
41 |
-
Assignment: Practice introducing yourself in Italian
|
42 |
-
Questions about daily routines and hobbies
|
43 |
-
|
44 |
-
π **vocabulary_list.txt** (856 bytes)
|
45 |
-
```txt
|
46 |
-
calcio - soccer/football
|
47 |
-
tifoso - fan
|
48 |
-
squadra - team
|
49 |
-
partita - match/game
|
50 |
-
... [truncated]
|
51 |
-
```"""
|
52 |
-
|
53 |
-
# Build the complete system message as per the implementation
|
54 |
-
system_content = SYSTEM_PROMPT
|
55 |
-
|
56 |
-
# Add grounding context (includes dynamic URLs)
|
57 |
-
full_grounding = grounding_context + dynamic_context
|
58 |
-
if full_grounding:
|
59 |
-
system_content = f"{system_content}\n\n{full_grounding}"
|
60 |
-
|
61 |
-
# Add file context
|
62 |
-
if file_context:
|
63 |
-
system_content = f"{system_content}\n\n{file_context}"
|
64 |
-
|
65 |
-
# Display the results
|
66 |
-
print("=" * 80)
|
67 |
-
print("COMPLETE SYSTEM MESSAGE CONSTRUCTION TEST")
|
68 |
-
print("=" * 80)
|
69 |
-
print("\n1. ORIGINAL SYSTEM PROMPT:")
|
70 |
-
print("-" * 40)
|
71 |
-
print(SYSTEM_PROMPT)
|
72 |
-
|
73 |
-
print("\n\n2. GROUNDING CONTEXT (URLs):")
|
74 |
-
print("-" * 40)
|
75 |
-
print(full_grounding)
|
76 |
-
|
77 |
-
print("\n\n3. FILE UPLOAD CONTEXT:")
|
78 |
-
print("-" * 40)
|
79 |
-
print(file_context)
|
80 |
-
|
81 |
-
print("\n\n4. FINAL COMPLETE SYSTEM MESSAGE:")
|
82 |
-
print("=" * 80)
|
83 |
-
print(system_content)
|
84 |
-
print("=" * 80)
|
85 |
-
|
86 |
-
# Test message structure
|
87 |
-
messages = [
|
88 |
-
{"role": "system", "content": system_content},
|
89 |
-
{"role": "user", "content": "Ciao! Come stai oggi?"}
|
90 |
-
]
|
91 |
-
|
92 |
-
print("\n\n5. MESSAGE STRUCTURE:")
|
93 |
-
print("-" * 40)
|
94 |
-
print(f"System message length: {len(system_content)} characters")
|
95 |
-
print(f"System role: {messages[0]['role']}")
|
96 |
-
print(f"User message: {messages[1]['content']}")
|
97 |
-
|
98 |
-
print("\n\nβ
TEST COMPLETE - All components properly integrated into system message")
|
99 |
-
|
100 |
-
return system_content
|
101 |
-
|
102 |
-
if __name__ == "__main__":
|
103 |
-
test_system_message_construction()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|