File size: 759 Bytes
0c51b93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import json
from collections import OrderedDict
from typing import Any

with open("../data/openai_log_attribution.jsonl", "r") as f:
    logs = [json.loads(line, object_hook=OrderedDict) for line in f]


def render_log(log: OrderedDict[str, Any]) -> None:
    print(log["scenario"] + "\n")
    print("Agent: " + log["agent"] + "\n")
    print("Goal: " + log["goal"] + "\n")

    for key, val in log["attributed_utterances"].items():
        print(key)
        print("Utterance: ", val[0])
        if val[1] == -1:
            print("Attribution: ", "mask")
        else:
            print("Attribution: ", val[1])
            print("Attributed reward: ", val[1] / 3 * log["goal_score"])

        print()
    print("goal achieving score: ", log["goal_score"])