Repository navigation
feat(evals): judge open-ended answers and record judge identity #8574
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
Closed
sudoKrishna
wants to merge
24
commits into
simstudioai:main
from
sudoKrishna:feat/evals-judged-scenarios
Closed
Changes from 2 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
86c79d7
feat(evals): add agent tool-use evaluation harness
sudoKrishna af2e6ca
feat(evals): add live DeepSeek model runs to the agent eval suite
sudoKrishna 433fd0f
test(evals): assert grounded behavior instead of exact phrasing in li…
sudoKrishna 85525a4
feat(evals): run agent scenarios through the DAGExecutor
sudoKrishna fb7f54c
test(evals): assert executor block retry on agent failure
sudoKrishna c93426b
test(evals): assert executor model fallback on primary failure
sudoKrishna 2032c4d
feat(evals): record and replay live model transcripts
sudoKrishna c12342a
feat(evals): add agent context eval suite
sudoKrishna 26937ff
feat(evals): compare agent tool-use across models
sudoKrishna a22387d
feat(evals): report failed checks in the model comparison
sudoKrishna 9d2ec19
feat(evals): add adversarial agent tool-use scenarios
sudoKrishna cdebc4d
test(evals): fix adversarial scenario design after the live run
sudoKrishna fc549db
test(evals): fix chain and near-duplicate scenarios for live models
sudoKrishna 4590af8
feat(evals): add LLM-as-judge scoring
sudoKrishna 031f5ab
Merge branch 'feat/evals-agent-context' into feat/evals-integration
sudoKrishna ae57d49
Merge branch 'feat/evals-model-compare' into feat/evals-integration
sudoKrishna 6dace97
Merge branch 'feat/evals-adversarial-scenarios' into feat/evals-integ…
sudoKrishna 5235110
Merge branch 'feat/evals-llm-judge' into feat/evals-integration
sudoKrishna f619479
test(evals): address review findings on the eval harness
sudoKrishna 3d8de59
feat(evals): judge open-ended agent answers
sudoKrishna 74faa92
feat(evals): record judge identity and refuse cross-identity comparisons
sudoKrishna 2023d07
feat(evals): judge the remaining open-ended scenarios
sudoKrishna 8bf9c01
fix(evals): address the judge review findings
sudoKrishna 69af5d7
feat(evals): record and replay judge transcripts
sudoKrishna File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import { | ||
| permissionCheckMock, | ||
| permissionCheckMockFns, | ||
| } from '@sim/testing/mocks/permission-check.mock' | ||
| import { providersMock } from '@sim/testing/mocks/providers.mock' | ||
| import { providersConversationHistoryMock } from '@sim/testing/mocks/providers-conversation-history.mock' | ||
| import { providersUtilsMock, providersUtilsMockFns } from '@sim/testing/mocks/providers-utils.mock' | ||
| import { toolsMock } from '@sim/testing/mocks/tools.mock' | ||
| import { workspaceFileSecretProvenanceMock } from '@sim/testing/mocks/workspace-file-secret-provenance.mock' | ||
| import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest' | ||
| import { AGENT_CONTEXT_SCENARIOS } from '@/evals/agent-context/scenarios' | ||
| import { runExecutorScenario } from '@/evals/agent-tool-use/executor-harness' | ||
| import { writeEvalReport } from '@/evals/agent-tool-use/report' | ||
| import type { AgentToolUseResult } from '@/evals/agent-tool-use/types' | ||
|
|
||
| vi.mock('@/providers/conversation-history', () => providersConversationHistoryMock) | ||
| vi.mock('@/tools', () => toolsMock) | ||
| vi.mock('@/providers/utils', () => providersUtilsMock) | ||
| vi.mock('@/providers', () => providersMock) | ||
| vi.mock('@/ee/access-control/utils/permission-check', () => permissionCheckMock) | ||
| vi.mock( | ||
| '@/lib/uploads/contexts/workspace/workspace-file-secret-provenance', | ||
| () => workspaceFileSecretProvenanceMock | ||
| ) | ||
| vi.mock('@/lib/memory/agent-turn-session', () => ({ | ||
| openAgentTurnSession: vi.fn(async () => undefined), | ||
| })) | ||
| vi.mock('@/lib/internal/mcp/discover-tools', () => ({ | ||
| discoverMcpServerToolsAsExecutor: vi.fn(async () => []), | ||
| })) | ||
| vi.mock('@/lib/internal/custom-tools/read-available-by-id-or-title', () => ({ | ||
| readAvailableCustomToolByIdOrTitleAsExecutor: vi.fn(async () => undefined), | ||
| })) | ||
| vi.mock('@/executor/utils/http', () => ({ | ||
| buildAuthHeaders: vi.fn(async () => ({ 'Content-Type': 'application/json' })), | ||
| buildAPIUrl: vi.fn((path: string) => path), | ||
| extractAPIErrorMessage: vi.fn(async () => 'request failed'), | ||
| })) | ||
| vi.mock('@/lib/execution/cancellation', () => ({ | ||
| subscribeToExecutionCancellation: vi.fn(async () => () => {}), | ||
| isExecutionCancelled: vi.fn(async () => false), | ||
| })) | ||
|
|
||
| const results: AgentToolUseResult[] = [] | ||
|
|
||
| beforeEach(() => { | ||
| permissionCheckMockFns.mockValidateModelProvider.mockResolvedValue(undefined) | ||
| providersUtilsMockFns.mockGetProviderFromModel.mockReturnValue('mock-provider') | ||
| }) | ||
|
|
||
| afterAll(() => { | ||
| const reportPath = process.env.EVAL_CONTEXT_REPORT_PATH | ||
| if (reportPath) writeEvalReport(results, reportPath) | ||
| }) | ||
|
|
||
| describe('agent context eval suite', () => { | ||
| it.each(AGENT_CONTEXT_SCENARIOS)('$id: $name', async (scenario) => { | ||
| const result = await runExecutorScenario(scenario) | ||
| results.push(result) | ||
|
|
||
| const failed = result.checks.filter((entry) => !entry.passed) | ||
| expect( | ||
| failed, | ||
| failed.map((entry) => `${entry.name}: ${entry.detail}`).join('; ') || undefined | ||
| ).toEqual([]) | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import type { ExecutorScenario } from '@/evals/agent-tool-use/executor-harness' | ||
|
|
||
| /** | ||
| * Agent context evals. | ||
| * | ||
| * These drive the real Agent block inside the `DAGExecutor` with conversation | ||
| * memory on. The memory read is stubbed per conversation id, so the provider | ||
| * request shows exactly what the handler assembled: prior history, then the new | ||
| * user prompt, with the system prompt preserved. A handler that passed the | ||
| * wrong conversation id, dropped history, or reordered the prompt fails. | ||
| * | ||
| * Windowing inside the memory service (`sliding_window`, token budgets) is | ||
| * covered by its own unit tests; this suite covers the assembly the model sees. | ||
| */ | ||
| export const AGENT_CONTEXT_SCENARIOS: ExecutorScenario[] = [ | ||
| { | ||
| id: 'context-remembers-prior-turns', | ||
| name: 'includes prior conversation memory before the new user prompt', | ||
| category: 'retrieval', | ||
| description: | ||
| 'Memory holds two prior turns. The provider request must contain both, in order, followed by the new user prompt, with the system prompt present.', | ||
| workflowInput: {}, | ||
| agent: { | ||
| model: 'gpt-4o', | ||
| systemPrompt: 'You are a helpful assistant.', | ||
| userPrompt: 'What is my name?', | ||
| memory: { | ||
| conversationId: 'conv-ada', | ||
| history: [ | ||
| { role: 'user', content: 'My name is Ada.' }, | ||
| { role: 'assistant', content: 'Nice to meet you, Ada.' }, | ||
| ], | ||
| }, | ||
| }, | ||
| providerResponse: { | ||
| content: 'Your name is Ada.', | ||
| tokens: { input: 30, output: 5, total: 35 }, | ||
| }, | ||
| expect: { | ||
| succeeds: true, | ||
| finalContent: 'Ada', | ||
| }, | ||
| }, | ||
| { | ||
| id: 'context-isolates-conversations', | ||
| name: 'reads the conversation named by the block, not another', | ||
| category: 'retrieval', | ||
| description: | ||
| 'The memory stub only returns history for the block conversation id; any other id yields a placeholder. A handler that passed the wrong id would surface the placeholder and fail.', | ||
| workflowInput: {}, | ||
| agent: { | ||
| model: 'gpt-4o', | ||
| userPrompt: 'What did we decide?', | ||
| memory: { | ||
| conversationId: 'conv-b', | ||
| history: [ | ||
| { role: 'user', content: 'We decided to ship on Friday.' }, | ||
| { role: 'assistant', content: 'Shipping Friday.' }, | ||
| ], | ||
| }, | ||
| }, | ||
| providerResponse: { | ||
| content: 'You decided to ship on Friday.', | ||
| tokens: { input: 25, output: 6, total: 31 }, | ||
| }, | ||
| expect: { | ||
| succeeds: true, | ||
| finalContent: 'Friday', | ||
| }, | ||
| }, | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.