Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output single artifact, move value to name #724

Merged
merged 4 commits into from
Apr 2, 2024
Merged

Conversation

collindutter
Copy link
Member

This PR makes the following changes:

  • Don't return a ListArtifact from ToolTask. Consistent with old behavior.
  • Move the formatted output of ActionsSubtask to TextArtifact.name instead of TextArtifact.value. This allows developers to have a formatted output in additional to the raw output (for parsing).

@@ -103,7 +101,9 @@ def run(self) -> BaseArtifact:
else:
results = self.execute_actions(self.actions)

self.output = ListArtifact([TextArtifact(format_output(r)) for r in results])
self.output = ListArtifact(
[TextArtifact(name=f"{r[0]} output: {r[1].to_text()}", value=r[1].to_text()) for r in results]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the correct approach? Using name doesn't quite feel right.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think name should just be {r[0]} output.

@@ -63,8 +63,8 @@ def run(self) -> BaseArtifact:
subtask.run()
subtask.after_run()

if subtask.output:
self.output = subtask.output
if subtask.output and isinstance(subtask.output, ListArtifact):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can just be if isinstance(subtask.output, ListArtifact).

@@ -103,7 +101,9 @@ def run(self) -> BaseArtifact:
else:
results = self.execute_actions(self.actions)

self.output = ListArtifact([TextArtifact(format_output(r)) for r in results])
self.output = ListArtifact(
[TextArtifact(name=f"{r[0]} output: {r[1].to_text()}", value=r[1].to_text()) for r in results]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think name should just be {r[0]} output.

@collindutter collindutter merged commit 76e7177 into dev Apr 2, 2024
6 checks passed
@collindutter collindutter deleted the fix/tooltask-output branch April 2, 2024 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants