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

feat(autofix): Add first pass at interactive flow #1168

Merged
merged 16 commits into from
Sep 19, 2024
Merged

Conversation

roaga
Copy link
Member

@roaga roaga commented Sep 16, 2024

This supports insight card generation, user interjection, and a root cause flow that makes sense for the new design. (#450 )

@roaga roaga marked this pull request as ready for review September 16, 2024 22:59
Copy link
Member

@jennmueng jennmueng left a comment

Choose a reason for hiding this comment

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

1 note, will take a second pass later after long interview

Comment on lines +92 to +110
# call LLM separately with the same memory to generate structured output insight cards
insight_sharing = InsightSharingComponent(context)
past_insights = context.state.get().get_all_insights()
insight_card = insight_sharing.invoke(
InsightSharingRequest(
latest_thought=text,
memory=self.memory,
task_description=context.state.get().get_step_description(),
past_insights=past_insights,
)
)
if insight_card:
if context.state.get().steps and isinstance(
context.state.get().steps[-1], DefaultStep
):
step = cast(DefaultStep, context.state.get().steps[-1])
step.insights.append(insight_card)
with context.state.update() as cur:
cur.steps[-1] = step
Copy link
Member

Choose a reason for hiding this comment

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

Hmm I think this is worth pulling out of the general agent logic and into a specific AutofixAgent that inherits from this generic Agent as codecov will be using this too and we don't need to generate insights there.

Copy link
Member Author

@roaga roaga Sep 18, 2024

Choose a reason for hiding this comment

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

Since in many cases we'll want to disable it for Autofix too (e.g. evals, GH Copilot), I'm adding an interactive flag to the AgentConfig so that these kinds of features are easy to enable/disable whenever we want. It defaults to False so the unit test gen code will not generate any insights.

Copy link
Member

@jennmueng jennmueng left a comment

Choose a reason for hiding this comment

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

couple comments, nothing major, lgtm otherwise

Comment on lines +150 to +153
elif message.role == "tool_use":
new_messages.append(
Message(role="assistant", content=message.content, tool_calls=[])
)
Copy link
Member

Choose a reason for hiding this comment

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

tool_use is for anthropic right, we don't need to use this hack on anthropic calls right?

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 believe I did need to use this hack for Claude, I can't recall the exact error that was occurring though

@roaga roaga merged commit 0104de0 into main Sep 19, 2024
10 checks passed
@roaga roaga deleted the autofix/interactive branch September 19, 2024 14:21
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