Skip to content

Commit

Permalink
runs
Browse files Browse the repository at this point in the history
  • Loading branch information
vachillo committed Oct 25, 2024
1 parent 3c3ea7c commit 9ca30aa
Showing 1 changed file with 8 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,15 @@ def load(self) -> tuple[list[Run], dict[str, Any]]:
# retrieve the Thread to get the metadata
thread_response = self._call_api("get", f"/threads/{thread_id}").json()

runs = []
for m in messages_response.get("messages", []):
run_id = m["metadata"].pop("run_id", None)
run = Run(
meta=m["metadata"],
input=BaseArtifact.from_json(m["input"]),
output=BaseArtifact.from_json(m["output"]),
runs = [
Run(
**({"id": message["metadata"]} if "metadata" in message else {}),
meta=message["metadata"],
input=BaseArtifact.from_json(message["input"]),
output=BaseArtifact.from_json(message["output"]),
)
if run_id is not None:
run.id = run_id
runs.append(run)
for message in messages_response.get("messages", [])
]

return runs, thread_response.get("metadata", {})

Expand Down

0 comments on commit 9ca30aa

Please sign in to comment.