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

Don't create subtasks when not using tools #1489

Merged
merged 1 commit into from
Dec 30, 2024
Merged

Don't create subtasks when not using tools #1489

merged 1 commit into from
Dec 30, 2024

Conversation

collindutter
Copy link
Member

@collindutter collindutter commented Dec 26, 2024

Describe your changes

Don't create subtasks when not using tools

Issue ticket number and link

Introduced via #1463

Copy link

codecov bot commented Dec 26, 2024

Codecov Report

Attention: Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
griptape/tasks/prompt_task.py 81.81% 1 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

@collindutter collindutter added the type:bug Something isn't working label Dec 26, 2024
subtask = self.add_subtask(ActionsSubtask(result.to_artifact()))
else:
break
break
Copy link
Member Author

Choose a reason for hiding this comment

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

Not introduced by this change

Copy link
Contributor

@dylanholmes dylanholmes left a comment

Choose a reason for hiding this comment

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

Optional suggestion

Comment on lines +206 to +209
if self.tools:
subtask = self.add_subtask(ActionsSubtask(result.to_artifact()))

while True:
Copy link
Contributor

Choose a reason for hiding this comment

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

You could avoid some nesting if you flip the condition:

if not self.tools:
    self.output = result.to_artifact()
    return self.output

while True:
    ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I'd rather keep the conditional positive and solve the ugly nested code separately here.

@collindutter collindutter merged commit 6f8908c into main Dec 30, 2024
15 of 16 checks passed
@collindutter collindutter deleted the fix/prompt branch December 30, 2024 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants