-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Adding skill evaluation to agent-evals #9757
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
base: launch.skills
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @joehan, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the agent evaluation framework by introducing the ability to test and verify agent skill activation and selection. It provides new mechanisms for configuring available skills and asserting their usage, laying the groundwork for more comprehensive and targeted evaluations of agent capabilities. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces a solid foundation for evaluating agent skills. The changes are well-structured, adding new arguments for skill configuration, a new expectSkillActivated matcher, and comprehensive tests for skill activation and selection. My feedback focuses on improving code clarity and maintainability by removing a small amount of dead code and refactoring duplicated test logic to make the new test suites easier to manage in the future. Overall, this is a great step forward for agent evaluations.
| const skillPaths: string[] = []; | ||
| for (const skillPath of skills) { | ||
| const skillName = path.basename(skillPath); | ||
| const dest = path.join(skillsDir, skillName); | ||
| console.debug(`Copying skill ${skillPath} to ${dest}`); | ||
| cpSync(skillPath, dest, { recursive: true }); | ||
| skillPaths.push(dest); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The skillPaths variable is initialized and populated within the loop, but it's never used. This appears to be dead code and should be removed to improve clarity and maintainability. The CLI seems to correctly pick up skills by convention from the .gemini/skills directory, making this variable unnecessary.
for (const skillPath of skills) {
const skillName = path.basename(skillPath);
const dest = path.join(skillsDir, skillName);
console.debug(`Copying skill ${skillPath} to ${dest}`);
cpSync(skillPath, dest, { recursive: true });
}| for (const tc of testCases) { | ||
| it(`${tc.expectSkillEnabled ? 'should' : 'should not'} activate firebase-basics skill for prompt: ${tc.prompt} ("MCP Enabled")`, async function (this: Mocha.Context) { | ||
| if (!process.env.GEMINI_API_KEY) { | ||
| this.skip(); | ||
| } | ||
| const run: AgentTestRunner = await startAgentTest(this, { | ||
| skills: [FIREBASE_BASICS_PATH], | ||
| enableMcp: true, | ||
| }); | ||
|
|
||
| await run.type(tc.prompt); | ||
|
|
||
| if (tc.expectSkillEnabled) { | ||
| await run.expectSkillActivated("firebase-basics"); | ||
| } else { | ||
| await run.dont.expectSkillActivated("firebase-basics"); | ||
| } | ||
| }); | ||
|
|
||
| it(`${tc.expectSkillEnabled ? 'should' : 'should not'} activate firebase-basics skill for prompt: ${tc.prompt} ("MCP Disabled")`, async function (this: Mocha.Context) { | ||
| if (!process.env.GEMINI_API_KEY) { | ||
| this.skip(); | ||
| } | ||
| const run: AgentTestRunner = await startAgentTest(this, { | ||
| skills: [FIREBASE_BASICS_PATH], | ||
| enableMcp: false, | ||
| }); | ||
|
|
||
| await run.type(tc.prompt); | ||
|
|
||
| if (tc.expectSkillEnabled) { | ||
| await run.expectSkillActivated("firebase-basics"); | ||
| } else { | ||
| await run.dont.expectSkillActivated("firebase-basics"); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is significant code duplication between the test cases for "MCP Enabled" and "MCP Disabled". To improve maintainability and reduce redundancy, this can be refactored into a single parameterized test that iterates over the enableMcp boolean states.
for (const tc of testCases) {
for (const mcpEnabled of [true, false]) {
const mcpState = mcpEnabled ? "MCP Enabled" : "MCP Disabled";
it(`${tc.expectSkillEnabled ? 'should' : 'should not'} activate firebase-basics skill for prompt: ${tc.prompt} ("${mcpState}")`, async function (this: Mocha.Context) {
if (!process.env.GEMINI_API_KEY) {
this.skip();
}
const run: AgentTestRunner = await startAgentTest(this, {
skills: [FIREBASE_BASICS_PATH],
enableMcp: mcpEnabled,
});
await run.type(tc.prompt);
if (tc.expectSkillEnabled) {
await run.expectSkillActivated("firebase-basics");
} else {
await run.dont.expectSkillActivated("firebase-basics");
}
});
}
}| for (const tc of testCases) { | ||
| it(`${tc.expectSkillEnabled ? 'should' : 'should not'} activate firestore-basics skill for prompt: ${tc.prompt} ("MCP Enabled")`, async function (this: Mocha.Context) { | ||
| if (!process.env.GEMINI_API_KEY) { | ||
| this.skip(); | ||
| } | ||
| const run: AgentTestRunner = await startAgentTest(this, { | ||
| skills: [FIRESTORE_BASICS_PATH], | ||
| enableMcp: true, | ||
| }); | ||
|
|
||
| await run.type(tc.prompt); | ||
|
|
||
| if (tc.expectSkillEnabled) { | ||
| await run.expectSkillActivated("firestore-basics"); | ||
| } else { | ||
| await run.dont.expectSkillActivated("firestore-basics"); | ||
| } | ||
| }); | ||
|
|
||
| it(`${tc.expectSkillEnabled ? 'should' : 'should not'} activate firestore-basics skill for prompt: ${tc.prompt} ("MCP Disabled")`, async function (this: Mocha.Context) { | ||
| if (!process.env.GEMINI_API_KEY) { | ||
| this.skip(); | ||
| } | ||
| const run: AgentTestRunner = await startAgentTest(this, { | ||
| skills: [FIRESTORE_BASICS_PATH], | ||
| enableMcp: false, | ||
| }); | ||
|
|
||
| await run.type(tc.prompt); | ||
|
|
||
| if (tc.expectSkillEnabled) { | ||
| await run.expectSkillActivated("firestore-basics"); | ||
| } else { | ||
| await run.dont.expectSkillActivated("firestore-basics"); | ||
| } | ||
| }); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the firebase-basics test file, there is duplicated logic for testing with MCP enabled and disabled. This can be refactored into a more concise, parameterized test to improve readability and maintainability.
for (const tc of testCases) {
for (const mcpEnabled of [true, false]) {
const mcpState = mcpEnabled ? "MCP Enabled" : "MCP Disabled";
it(`${tc.expectSkillEnabled ? 'should' : 'should not'} activate firestore-basics skill for prompt: ${tc.prompt} ("${mcpState}")`, async function (this: Mocha.Context) {
if (!process.env.GEMINI_API_KEY) {
this.skip();
}
const run: AgentTestRunner = await startAgentTest(this, {
skills: [FIRESTORE_BASICS_PATH],
enableMcp: mcpEnabled,
});
await run.type(tc.prompt);
if (tc.expectSkillEnabled) {
await run.expectSkillActivated("firestore-basics");
} else {
await run.dont.expectSkillActivated("firestore-basics");
}
});
}
}
Description
Starting on adding evals for the agent skills. So far, I'm just focusing on the frontmatter and skill activation.
Changes: