Skip to content

[v14] Add the ability to run a specific tool to Assist.#33640

Merged
jakule merged 2 commits intobranch/v14from
jakule/v14/assist-access-monitoring-backport
Oct 19, 2023
Merged

[v14] Add the ability to run a specific tool to Assist.#33640
jakule merged 2 commits intobranch/v14from
jakule/v14/assist-access-monitoring-backport

Conversation

@jakule
Copy link
Copy Markdown
Contributor

@jakule jakule commented Oct 18, 2023

Backport of #31113

This commit contains:
- a refactoring of the model action logic to be exposed through the
  `DoAction` function
- Expose `RunTool()` capability through ai.Client and assist.Assist
- Add the "audit-query" action that invokes directly the audit
  generation tool
Comment thread lib/ai/client.go
Reasoning: "Tool invoked directly",
}

return agent.DoAction(ctx, client.svc, action)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: We should wrap the error. I'm not sure what the other returns are from the context here.

Suggested change
return agent.DoAction(ctx, client.svc, action)
?, ?, err = agent.DoAction(ctx, client.svc, action)
return ?, ?, trace.Wrap(err)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we should, but I also don't think we should do that in a backport. We can address those comments in a separate PR targeting master.

Comment thread lib/ai/client_test.go
response, _, err := client.RunTool(ctx, toolCtx, tools.AuditQueryGenerationToolName, "List users who connected to a server as root")
require.NoError(t, err)
message, ok := response.(*output.StreamingMessage)
require.True(t, ok)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: add more context so that we get more than "should be true" if the assertion fails

Suggested change
require.True(t, ok)
require.True(t, ok, "expected response to be an output.StreamingMessage, got %T, response)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we could change, but I also don't think we should do that in a backport. We can address those comments in a separate PR targeting master.

Comment thread lib/ai/client_test.go
response, _, err := client.RunTool(ctx, toolCtx, "Nodes names and labels retrieval", string(inputText))
require.NoError(t, err)
message, ok := response.(*output.Message)
require.True(t, ok)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: add more context so that we get more than "should be true" if the assertion fails

Suggested change
require.True(t, ok)
require.True(t, ok, "expected response to be an output.StreamingMessage, got %T, response

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we could change, but I also don't think we should do that in a backport. We can address those comments in a separate PR targeting master.

"github.com/gravitational/teleport/lib/ai/tokens"
)

const AuditQueryGenerationToolName = "Audit Query Generation"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: missing docs on exported constant

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

As above. It can be addressed in a separate PR.

@rosstimothy
Copy link
Copy Markdown
Contributor

This also does not look like a backport of #31112

* stream audit query responses

* fixup! stream audit query responses

* fixup! fixup! stream audit query responses
@jakule
Copy link
Copy Markdown
Contributor Author

jakule commented Oct 18, 2023

This also does not look like a backport of #31112

I fixed that, thx

Copy link
Copy Markdown
Contributor

@smallinsky smallinsky left a comment

Choose a reason for hiding this comment

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

LGTM
Tim left some valid comments but agree with Jakub that we should align it in master first and backport.

@jakule jakule added this pull request to the merge queue Oct 18, 2023
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 18, 2023
@jakule jakule added this pull request to the merge queue Oct 19, 2023
Merged via the queue into branch/v14 with commit 49b7d83 Oct 19, 2023
@jakule jakule deleted the jakule/v14/assist-access-monitoring-backport branch October 19, 2023 13:49
@fheinecke fheinecke mentioned this pull request Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants