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

Refactor ActionsSubtask for more precise initialization logic #1626

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

collindutter
Copy link
Member

@collindutter collindutter commented Jan 29, 2025

Describe your changes

Fixed

  • Answer: being trimmed from LLM's final answer even when using native tool calling.

This PR changes the logic of ActionsSubtask to be more precise about how it parses the input Actions. Previously, it followed the decision tree of:

  • if TextArtifact: Parse ReAct prompt generated from Prompt Driver with use_native_tools=False.
  • else: Parse Artifact generated from Prompt Driver with use_native_tools=True.

The problem is that even Prompt Driver with use_native_tools=True eventually generates a TextArtifact. Now the decision tree looks like:

  • if TextArtifact and the TextArtifact has been explicitly marked as a ReAct Prompt: Parse ReAct prompt generated from Prompt Driver with use_native_tools=False.
  • else: Parse Artifact generated from Prompt Driver with use_native_tools=True.

The way ReAct Artifacts are "marked" is via a metadata field, is_react_prompt. Technically this change of behavior is a breaking change but I highly doubt anyone is passing inputs into ActionsSubtask directly.

Issue ticket number and link

NA

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

Attention: Patch coverage is 95.83333% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
griptape/tasks/tool_task.py 50.00% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@collindutter collindutter force-pushed the fix/actions-subtask branch 2 times, most recently from 9fc1e55 to 6401ffa Compare January 29, 2025 19:27
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.

Nice work! -- Just one subjective comment

griptape/tasks/prompt_task.py Show resolved Hide resolved
@collindutter collindutter added this pull request to the merge queue Jan 29, 2025
Merged via the queue into main with commit c8a17b8 Jan 29, 2025
16 checks passed
@collindutter collindutter deleted the fix/actions-subtask branch January 29, 2025 20:07
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.

2 participants