-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexample_run.py
35 lines (30 loc) · 1.05 KB
/
example_run.py
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
from dotenv import load_dotenv
import os
from truth import VerifierAgent
from loguru import logger
# Disable logging
logger.remove()
logger.add(lambda _: None, level="CRITICAL")
load_dotenv()
mistral_api_key = os.getenv("MISTRAL_API_KEY")
brave_api_key = os.getenv("BRAVE_API_KEY")
# Initialize the VerifierAgent with the specified Mistral API key, Brave API key, and model
agent = VerifierAgent(
mistral_api_key=mistral_api_key,
brave_api_key=brave_api_key,
model="mistral-small-latest",
)
# List of statements to verify
statements = [
"The Earth is flat.",
# "Water boils at 100 degrees Celsius at sea level.",
"The capital of France is London.",
# "Photosynthesis is the process by which plants convert sunlight into energy.",
]
# Verify each statement
for statement in statements:
logger.info(f"Verifying: '{statement}'")
output = agent.verify_statement(statement)
print(
f"Result: {output['result']}\nConfidence: {output['confidence']}\nSources: {output['sources']}\nExplanation: {output['explanation']}\n\n"
)