-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
32 lines (25 loc) · 852 Bytes
/
main.py
File metadata and controls
32 lines (25 loc) · 852 Bytes
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
import json
from deepdiff import DeepDiff
from rich import print
from rich.panel import Panel
from rich.console import Console
# initialize rich console
console = Console()
try:
with open("llm_response.json", "r") as file:
data = json.load(file)
except FileNotFoundError:
print("Document not found")
exit(1)
response_before = data["before"]
response_after = data["after"]
console.print(Panel.fit("[bold yellow] Differences Detected: [/bold yellow]"))
diff = DeepDiff(response_before, response_after, significant_digits=2)
if not diff:
console.print(Panel.fit("[bold green] No Differences Detected: [/bold green]"))
else:
for key, value in diff.items():
console.print(f"[bold cyan]{key}[/bold cyan]: ",style="bold cyan")
console.print(value, style="white")
print("Differences Detected: \n")
print(diff)