Untitled
unknown
plain_text
9 months ago
1.3 kB
4
Indexable
# Verify each game and extract the Confirmation status
confirmation_results = []
raw_results = [] # Optional: To store the full response for reference
for index, row in df_combined.iterrows():
title = row['title']
classification = row['classification']
try:
# Get the raw JSON string response from the LLM
raw_response = verify_classification(title, classification)
# Parse the JSON string into a Python dictionary
parsed_response = parse_llm_response(raw_response)
# Extract the "Confirmation" value
confirmation_results.append(parsed_response.get("Confirmation", "Error"))
# Optionally store the raw response for debugging or reference
raw_results.append(parsed_response)
except Exception as e:
# Handle errors gracefully
confirmation_results.append("Error")
raw_results.append({
"Title": title,
"Classification": classification,
"Confirmation": "Error",
"Reason": str(e),
"Alternate Name": None
})
# Add the Confirmation results to the DataFrame
df_combined['Confirmation'] = confirmation_results
# Optional: Add raw results for reference (if needed)
df_combined['Raw Verification'] = raw_resultsEditor is loading...
Leave a Comment