trinity.explorer.proxy.recorder module#
- class trinity.explorer.proxy.recorder.HistoryRecorder(db_url: str, table_name: str)[source]#
Bases:
objectRecord chat history into the database.
- record_history(experiences: List[Experience]) None[source]#
Save experience to the database.
- update_reward(reward: float, msg_ids: list, run_id: int, task_id: str) List[Experience][source]#
Update reward for given response IDs and return the updated experiences.
- Parameters:
reward (float) β The reward value to be updated.
msg_ids (list) β List of message IDs to update.
run_id (int) β The run ID associated with the experiences.
task_id (str) β The task ID associated with the experiences.
- Returns:
List of updated experiences.
- Return type:
List[Experience]
Note
Only experiences that have not been consumed (consumed == 0) will be returned. For example, if you call this method multiple times with the same msg_ids, only the first call will return the updated experiences; subsequent calls will return an empty list.