inspect-ai 0.3.62__py3-none-any.whl → 0.3.64__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- inspect_ai/_cli/cache.py +8 -7
- inspect_ai/_cli/common.py +0 -12
- inspect_ai/_cli/eval.py +32 -4
- inspect_ai/_cli/info.py +1 -0
- inspect_ai/_cli/list.py +1 -1
- inspect_ai/_cli/log.py +2 -0
- inspect_ai/_cli/main.py +1 -1
- inspect_ai/_cli/sandbox.py +4 -1
- inspect_ai/_cli/score.py +181 -32
- inspect_ai/_cli/trace.py +10 -0
- inspect_ai/_cli/view.py +4 -2
- inspect_ai/_display/core/active.py +2 -3
- inspect_ai/_display/core/config.py +7 -1
- inspect_ai/_display/textual/widgets/samples.py +4 -3
- inspect_ai/_display/textual/widgets/sandbox.py +6 -0
- inspect_ai/_eval/eval.py +104 -101
- inspect_ai/_eval/evalset.py +75 -75
- inspect_ai/_eval/loader.py +122 -12
- inspect_ai/_eval/registry.py +1 -1
- inspect_ai/_eval/run.py +14 -0
- inspect_ai/_eval/score.py +125 -36
- inspect_ai/_eval/task/log.py +105 -4
- inspect_ai/_eval/task/results.py +92 -38
- inspect_ai/_eval/task/run.py +9 -2
- inspect_ai/_eval/task/sandbox.py +35 -2
- inspect_ai/_eval/task/task.py +49 -46
- inspect_ai/_util/constants.py +1 -1
- inspect_ai/_util/content.py +8 -0
- inspect_ai/_util/error.py +2 -0
- inspect_ai/_util/file.py +15 -1
- inspect_ai/_util/hash.py +1 -1
- inspect_ai/_util/logger.py +4 -2
- inspect_ai/_util/registry.py +7 -1
- inspect_ai/_view/view.py +1 -2
- inspect_ai/_view/www/.vscode/extensions.json +3 -0
- inspect_ai/_view/www/.vscode/settings.json +8 -0
- inspect_ai/_view/www/App.css +97 -29
- inspect_ai/_view/www/README.md +1 -1
- inspect_ai/_view/www/dist/assets/index.css +16663 -14674
- inspect_ai/_view/www/dist/assets/index.js +58808 -51348
- inspect_ai/_view/www/dist/index.html +1 -1
- inspect_ai/_view/www/index.html +2 -2
- inspect_ai/_view/www/log-schema.json +87 -73
- inspect_ai/_view/www/package.json +22 -4
- inspect_ai/_view/www/postcss.config.cjs +8 -9
- inspect_ai/_view/www/src/{App.mjs → App.tsx} +356 -365
- inspect_ai/_view/www/src/AppErrorBoundary.tsx +47 -0
- inspect_ai/_view/www/src/api/api-browser.ts +2 -2
- inspect_ai/_view/www/src/api/api-http.ts +3 -5
- inspect_ai/_view/www/src/api/api-vscode.ts +6 -6
- inspect_ai/_view/www/src/api/client-api.ts +4 -4
- inspect_ai/_view/www/src/api/index.ts +4 -4
- inspect_ai/_view/www/src/api/{Types.ts → types.ts} +25 -9
- inspect_ai/_view/www/src/appearance/colors.ts +9 -0
- inspect_ai/_view/www/src/appearance/fonts.ts +39 -0
- inspect_ai/_view/www/src/appearance/icons.ts +100 -0
- inspect_ai/_view/www/src/appearance/{Styles.mjs → styles.ts} +2 -32
- inspect_ai/_view/www/src/components/AnsiDisplay.tsx +198 -0
- inspect_ai/_view/www/src/components/AsciinemaPlayer.tsx +86 -0
- inspect_ai/_view/www/src/components/Card.css +60 -0
- inspect_ai/_view/www/src/components/Card.tsx +109 -0
- inspect_ai/_view/www/src/components/CopyButton.module.css +11 -0
- inspect_ai/_view/www/src/components/CopyButton.tsx +58 -0
- inspect_ai/_view/www/src/components/DownloadButton.css +4 -0
- inspect_ai/_view/www/src/components/DownloadButton.tsx +25 -0
- inspect_ai/_view/www/src/components/DownloadPanel.css +10 -0
- inspect_ai/_view/www/src/components/DownloadPanel.tsx +30 -0
- inspect_ai/_view/www/src/components/EmptyPanel.css +12 -0
- inspect_ai/_view/www/src/components/EmptyPanel.tsx +15 -0
- inspect_ai/_view/www/src/components/ErrorPanel.css +37 -0
- inspect_ai/_view/www/src/components/ErrorPanel.tsx +39 -0
- inspect_ai/_view/www/src/components/ExpandablePanel.css +40 -0
- inspect_ai/_view/www/src/components/ExpandablePanel.tsx +115 -0
- inspect_ai/_view/www/src/components/FindBand.css +49 -0
- inspect_ai/_view/www/src/components/FindBand.tsx +130 -0
- inspect_ai/_view/www/src/components/HumanBaselineView.css +41 -0
- inspect_ai/_view/www/src/components/HumanBaselineView.tsx +162 -0
- inspect_ai/_view/www/src/components/JsonPanel.css +20 -0
- inspect_ai/_view/www/src/components/JsonPanel.tsx +82 -0
- inspect_ai/_view/www/src/components/LabeledValue.css +20 -0
- inspect_ai/_view/www/src/components/LabeledValue.tsx +41 -0
- inspect_ai/_view/www/src/components/LargeModal.module.css +54 -0
- inspect_ai/_view/www/src/components/LargeModal.tsx +189 -0
- inspect_ai/_view/www/src/components/LightboxCarousel.css +95 -0
- inspect_ai/_view/www/src/components/LightboxCarousel.tsx +132 -0
- inspect_ai/_view/www/src/components/MarkdownDiv.css +3 -0
- inspect_ai/_view/www/src/components/MarkdownDiv.tsx +133 -0
- inspect_ai/_view/www/src/components/MessageBand.css +43 -0
- inspect_ai/_view/www/src/components/MessageBand.tsx +39 -0
- inspect_ai/_view/www/src/components/MorePopOver.css +0 -0
- inspect_ai/_view/www/src/components/MorePopOver.tsx +67 -0
- inspect_ai/_view/www/src/components/NavPills.module.css +18 -0
- inspect_ai/_view/www/src/components/NavPills.tsx +101 -0
- inspect_ai/_view/www/src/components/ProgressBar.module.css +37 -0
- inspect_ai/_view/www/src/components/ProgressBar.tsx +22 -0
- inspect_ai/_view/www/src/components/TabSet.module.css +40 -0
- inspect_ai/_view/www/src/components/TabSet.tsx +215 -0
- inspect_ai/_view/www/src/components/ToolButton.css +3 -0
- inspect_ai/_view/www/src/components/ToolButton.tsx +27 -0
- inspect_ai/_view/www/src/components/VirtualList.module.css +19 -0
- inspect_ai/_view/www/src/components/VirtualList.tsx +292 -0
- inspect_ai/_view/www/src/{index.js → index.tsx} +45 -19
- inspect_ai/_view/www/src/{log → logfile}/remoteLogFile.ts +3 -8
- inspect_ai/_view/www/src/{utils/remoteZipFile.mjs → logfile/remoteZipFile.ts} +86 -80
- inspect_ai/_view/www/src/metadata/MetaDataGrid.tsx +83 -0
- inspect_ai/_view/www/src/metadata/MetaDataView.module.css +35 -0
- inspect_ai/_view/www/src/metadata/MetaDataView.tsx +95 -0
- inspect_ai/_view/www/src/metadata/MetadataGrid.module.css +15 -0
- inspect_ai/_view/www/src/metadata/RenderedContent.module.css +12 -0
- inspect_ai/_view/www/src/{components/RenderedContent/RenderedContent.mjs → metadata/RenderedContent.tsx} +92 -73
- inspect_ai/_view/www/src/metadata/types.ts +18 -0
- inspect_ai/_view/www/src/plan/DatasetDetailView.module.css +3 -0
- inspect_ai/_view/www/src/plan/DatasetDetailView.tsx +37 -0
- inspect_ai/_view/www/src/plan/DetailStep.module.css +9 -0
- inspect_ai/_view/www/src/plan/DetailStep.tsx +31 -0
- inspect_ai/_view/www/src/plan/PlanCard.tsx +28 -0
- inspect_ai/_view/www/src/plan/PlanDetailView.module.css +48 -0
- inspect_ai/_view/www/src/plan/PlanDetailView.tsx +324 -0
- inspect_ai/_view/www/src/plan/ScorerDetailView.module.css +3 -0
- inspect_ai/_view/www/src/plan/ScorerDetailView.tsx +30 -0
- inspect_ai/_view/www/src/plan/SolverDetailView.module.css +15 -0
- inspect_ai/_view/www/src/plan/SolverDetailView.tsx +32 -0
- inspect_ai/_view/www/src/samples/InlineSampleDisplay.module.css +8 -0
- inspect_ai/_view/www/src/samples/InlineSampleDisplay.tsx +53 -0
- inspect_ai/_view/www/src/samples/SampleDialog.tsx +122 -0
- inspect_ai/_view/www/src/samples/SampleDisplay.module.css +29 -0
- inspect_ai/_view/www/src/samples/SampleDisplay.tsx +331 -0
- inspect_ai/_view/www/src/samples/SampleSummaryView.module.css +24 -0
- inspect_ai/_view/www/src/samples/SampleSummaryView.tsx +177 -0
- inspect_ai/_view/www/src/samples/SamplesTools.tsx +52 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessage.module.css +29 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessage.tsx +76 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessageRenderer.tsx +60 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessageRow.module.css +9 -0
- inspect_ai/_view/www/src/samples/chat/ChatMessageRow.tsx +57 -0
- inspect_ai/_view/www/src/samples/chat/ChatView.tsx +47 -0
- inspect_ai/_view/www/src/samples/chat/ChatViewVirtualList.module.css +4 -0
- inspect_ai/_view/www/src/samples/chat/ChatViewVirtualList.tsx +58 -0
- inspect_ai/_view/www/src/samples/chat/MessageContent.module.css +4 -0
- inspect_ai/_view/www/src/samples/chat/MessageContent.tsx +157 -0
- inspect_ai/_view/www/src/samples/chat/MessageContents.module.css +3 -0
- inspect_ai/_view/www/src/samples/chat/MessageContents.tsx +133 -0
- inspect_ai/_view/www/src/samples/chat/messages.ts +112 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolCallView.tsx +147 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolInput.module.css +14 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolInput.tsx +76 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolOutput.module.css +19 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolOutput.tsx +60 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolTitle.module.css +4 -0
- inspect_ai/_view/www/src/samples/chat/tools/ToolTitle.tsx +18 -0
- inspect_ai/_view/www/src/samples/chat/tools/tool.ts +92 -0
- inspect_ai/_view/www/src/samples/descriptor/samplesDescriptor.tsx +365 -0
- inspect_ai/_view/www/src/samples/descriptor/score/BooleanScoreDescriptor.module.css +22 -0
- inspect_ai/_view/www/src/samples/descriptor/score/BooleanScoreDescriptor.tsx +26 -0
- inspect_ai/_view/www/src/samples/descriptor/score/CategoricalScoreDescriptor.tsx +18 -0
- inspect_ai/_view/www/src/samples/descriptor/score/NumericScoreDescriptor.tsx +27 -0
- inspect_ai/_view/www/src/samples/descriptor/score/ObjectScoreDescriptor.module.css +18 -0
- inspect_ai/_view/www/src/samples/descriptor/score/ObjectScoreDescriptor.tsx +71 -0
- inspect_ai/_view/www/src/samples/descriptor/score/OtherScoreDescriptor.tsx +20 -0
- inspect_ai/_view/www/src/samples/descriptor/score/PassFailScoreDescriptor.module.css +28 -0
- inspect_ai/_view/www/src/samples/descriptor/score/PassFailScoreDescriptor.tsx +81 -0
- inspect_ai/_view/www/src/samples/descriptor/score/ScoreDescriptor.tsx +99 -0
- inspect_ai/_view/www/src/samples/descriptor/types.ts +55 -0
- inspect_ai/_view/www/src/samples/error/FlatSampleErrorView.module.css +19 -0
- inspect_ai/_view/www/src/samples/error/FlatSampleErrorView.tsx +22 -0
- inspect_ai/_view/www/src/samples/error/SampleErrorView.module.css +17 -0
- inspect_ai/_view/www/src/samples/error/SampleErrorView.tsx +31 -0
- inspect_ai/_view/www/src/samples/error/error.ts +15 -0
- inspect_ai/_view/www/src/samples/list/SampleFooter.module.css +9 -0
- inspect_ai/_view/www/src/samples/list/SampleFooter.tsx +14 -0
- inspect_ai/_view/www/src/samples/list/SampleHeader.module.css +13 -0
- inspect_ai/_view/www/src/samples/list/SampleHeader.tsx +36 -0
- inspect_ai/_view/www/src/samples/list/SampleList.module.css +11 -0
- inspect_ai/_view/www/src/samples/list/SampleList.tsx +247 -0
- inspect_ai/_view/www/src/samples/list/SampleRow.module.css +33 -0
- inspect_ai/_view/www/src/samples/list/SampleRow.tsx +98 -0
- inspect_ai/_view/www/src/samples/list/SampleSeparator.module.css +6 -0
- inspect_ai/_view/www/src/samples/list/SampleSeparator.tsx +24 -0
- inspect_ai/_view/www/src/samples/sample-tools/EpochFilter.module.css +9 -0
- inspect_ai/_view/www/src/samples/sample-tools/EpochFilter.tsx +51 -0
- inspect_ai/_view/www/src/samples/sample-tools/SelectScorer.module.css +16 -0
- inspect_ai/_view/www/src/samples/sample-tools/SelectScorer.tsx +175 -0
- inspect_ai/_view/www/src/samples/sample-tools/SortFilter.module.css +9 -0
- inspect_ai/_view/www/src/samples/sample-tools/SortFilter.tsx +186 -0
- inspect_ai/_view/www/src/samples/{tools/filters.mjs → sample-tools/filters.ts} +86 -81
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/SampleFilter.module.css +16 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/SampleFilter.tsx +288 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/completions.ts +346 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/language.ts +19 -0
- inspect_ai/_view/www/src/samples/sample-tools/sample-filter/tokenize.ts +97 -0
- inspect_ai/_view/www/src/samples/{SampleLimit.mjs → sampleLimit.ts} +3 -6
- inspect_ai/_view/www/src/samples/scores/SampleScoreView.module.css +53 -0
- inspect_ai/_view/www/src/samples/scores/SampleScoreView.tsx +168 -0
- inspect_ai/_view/www/src/samples/scores/SampleScores.module.css +5 -0
- inspect_ai/_view/www/src/samples/scores/SampleScores.tsx +37 -0
- inspect_ai/_view/www/src/samples/transcript/ApprovalEventView.tsx +66 -0
- inspect_ai/_view/www/src/samples/transcript/ErrorEventView.tsx +51 -0
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.module.css +3 -0
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.tsx +54 -0
- inspect_ai/_view/www/src/samples/transcript/InputEventView.tsx +48 -0
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.module.css +6 -0
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.tsx +36 -0
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.module.css +43 -0
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.tsx +223 -0
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.module.css +23 -0
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.tsx +112 -0
- inspect_ai/_view/www/src/samples/transcript/SampleLimitEventView.tsx +75 -0
- inspect_ai/_view/www/src/samples/transcript/SampleTranscript.tsx +22 -0
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.module.css +15 -0
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.tsx +100 -0
- inspect_ai/_view/www/src/samples/transcript/StepEventView.tsx +171 -0
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.module.css +19 -0
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.tsx +133 -0
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.module.css +10 -0
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.tsx +92 -0
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.module.css +49 -0
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.tsx +449 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNav.module.css +5 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNav.tsx +43 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNavs.module.css +3 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventNavs.tsx +39 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventPanel.module.css +25 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventPanel.tsx +191 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventRow.module.css +13 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventRow.tsx +32 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventSection.module.css +8 -0
- inspect_ai/_view/www/src/samples/transcript/event/EventSection.tsx +29 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateDiffView.tsx +67 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenderers.tsx +285 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenders.module.css +10 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.module.css +9 -0
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.tsx +346 -0
- inspect_ai/_view/www/src/samples/transcript/types.ts +58 -0
- inspect_ai/_view/www/src/types/log.d.ts +108 -19
- inspect_ai/_view/www/src/types/prism.d.ts +11 -0
- inspect_ai/_view/www/src/types.ts +71 -0
- inspect_ai/_view/www/src/usage/ModelTokenTable.tsx +28 -0
- inspect_ai/_view/www/src/usage/ModelUsagePanel.module.css +24 -0
- inspect_ai/_view/www/src/usage/ModelUsagePanel.tsx +97 -0
- inspect_ai/_view/www/src/usage/TokenTable.module.css +17 -0
- inspect_ai/_view/www/src/usage/TokenTable.tsx +91 -0
- inspect_ai/_view/www/src/usage/UsageCard.module.css +15 -0
- inspect_ai/_view/www/src/usage/UsageCard.tsx +67 -0
- inspect_ai/_view/www/src/utils/attachments.ts +42 -0
- inspect_ai/_view/www/src/utils/{Base64.mjs → base64.ts} +1 -6
- inspect_ai/_view/www/src/{components/Browser.mjs → utils/browser.ts} +0 -1
- inspect_ai/_view/www/src/utils/debugging.ts +28 -0
- inspect_ai/_view/www/src/utils/dom.ts +30 -0
- inspect_ai/_view/www/src/utils/format.ts +194 -0
- inspect_ai/_view/www/src/utils/git.ts +7 -0
- inspect_ai/_view/www/src/utils/html.ts +6 -0
- inspect_ai/_view/www/src/utils/http.ts +14 -0
- inspect_ai/_view/www/src/utils/{Path.mjs → path.ts} +2 -9
- inspect_ai/_view/www/src/utils/{Print.mjs → print.ts} +34 -26
- inspect_ai/_view/www/src/utils/queue.ts +51 -0
- inspect_ai/_view/www/src/utils/sync.ts +114 -0
- inspect_ai/_view/www/src/utils/{Type.mjs → type.ts} +3 -6
- inspect_ai/_view/www/src/utils/vscode.ts +13 -0
- inspect_ai/_view/www/src/workspace/WorkSpace.tsx +324 -0
- inspect_ai/_view/www/src/workspace/WorkSpaceView.module.css +33 -0
- inspect_ai/_view/www/src/workspace/WorkSpaceView.tsx +158 -0
- inspect_ai/_view/www/src/workspace/error/TaskErrorPanel.module.css +3 -0
- inspect_ai/_view/www/src/workspace/error/TaskErrorPanel.tsx +28 -0
- inspect_ai/_view/www/src/workspace/navbar/Navbar.module.css +54 -0
- inspect_ai/_view/www/src/workspace/navbar/Navbar.tsx +68 -0
- inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.module.css +52 -0
- inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.tsx +114 -0
- inspect_ai/_view/www/src/workspace/navbar/ResultsPanel.module.css +90 -0
- inspect_ai/_view/www/src/workspace/navbar/ResultsPanel.tsx +180 -0
- inspect_ai/_view/www/src/workspace/navbar/SecondaryBar.module.css +28 -0
- inspect_ai/_view/www/src/workspace/navbar/SecondaryBar.tsx +226 -0
- inspect_ai/_view/www/src/workspace/navbar/StatusPanel.module.css +14 -0
- inspect_ai/_view/www/src/workspace/navbar/StatusPanel.tsx +61 -0
- inspect_ai/_view/www/src/workspace/sidebar/EvalStatus.module.css +15 -0
- inspect_ai/_view/www/src/workspace/sidebar/EvalStatus.tsx +71 -0
- inspect_ai/_view/www/src/workspace/sidebar/LogDirectoryTitleView.module.css +5 -0
- inspect_ai/_view/www/src/workspace/sidebar/LogDirectoryTitleView.tsx +56 -0
- inspect_ai/_view/www/src/workspace/sidebar/Sidebar.module.css +68 -0
- inspect_ai/_view/www/src/workspace/sidebar/Sidebar.tsx +85 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarLogEntry.module.css +29 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarLogEntry.tsx +95 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoreView.module.css +23 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoreView.tsx +43 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoresView.module.css +35 -0
- inspect_ai/_view/www/src/workspace/sidebar/SidebarScoresView.tsx +63 -0
- inspect_ai/_view/www/src/workspace/tabs/InfoTab.module.css +0 -0
- inspect_ai/_view/www/src/workspace/tabs/InfoTab.tsx +70 -0
- inspect_ai/_view/www/src/workspace/tabs/JsonTab.module.css +5 -0
- inspect_ai/_view/www/src/workspace/tabs/JsonTab.tsx +46 -0
- inspect_ai/_view/www/src/workspace/tabs/SamplesTab.tsx +204 -0
- inspect_ai/_view/www/src/workspace/tabs/grouping.ts +195 -0
- inspect_ai/_view/www/src/workspace/tabs/types.ts +19 -0
- inspect_ai/_view/www/src/workspace/types.ts +10 -0
- inspect_ai/_view/www/src/workspace/utils.ts +34 -0
- inspect_ai/_view/www/tsconfig.json +23 -9
- inspect_ai/_view/www/vite.config.js +8 -17
- inspect_ai/_view/www/yarn.lock +627 -556
- inspect_ai/approval/_approval.py +2 -0
- inspect_ai/approval/_approver.py +4 -4
- inspect_ai/approval/_auto.py +1 -1
- inspect_ai/approval/_human/approver.py +3 -0
- inspect_ai/approval/_policy.py +5 -0
- inspect_ai/approval/_registry.py +2 -2
- inspect_ai/dataset/_dataset.py +64 -37
- inspect_ai/dataset/_sources/__init__.py +0 -0
- inspect_ai/dataset/_sources/csv.py +20 -12
- inspect_ai/dataset/_sources/file.py +4 -0
- inspect_ai/dataset/_sources/hf.py +39 -29
- inspect_ai/dataset/_sources/json.py +17 -9
- inspect_ai/log/__init__.py +2 -0
- inspect_ai/log/_convert.py +3 -3
- inspect_ai/log/_file.py +24 -9
- inspect_ai/log/_log.py +101 -13
- inspect_ai/log/_message.py +4 -2
- inspect_ai/log/_recorders/file.py +4 -0
- inspect_ai/log/_recorders/json.py +5 -7
- inspect_ai/log/_recorders/recorder.py +3 -0
- inspect_ai/log/_transcript.py +19 -8
- inspect_ai/model/__init__.py +2 -0
- inspect_ai/model/_cache.py +39 -21
- inspect_ai/model/_call_tools.py +4 -3
- inspect_ai/model/_chat_message.py +14 -4
- inspect_ai/model/_generate_config.py +1 -1
- inspect_ai/model/_model.py +31 -24
- inspect_ai/model/_model_output.py +14 -1
- inspect_ai/model/_openai.py +10 -18
- inspect_ai/model/_providers/anthropic.py +3 -3
- inspect_ai/model/_providers/google.py +9 -5
- inspect_ai/model/_providers/openai.py +5 -9
- inspect_ai/model/_providers/openai_o1.py +3 -5
- inspect_ai/model/_providers/openrouter.py +86 -0
- inspect_ai/model/_providers/providers.py +11 -0
- inspect_ai/scorer/__init__.py +6 -1
- inspect_ai/scorer/_answer.py +7 -7
- inspect_ai/scorer/_classification.py +38 -18
- inspect_ai/scorer/_common.py +2 -8
- inspect_ai/scorer/_match.py +4 -5
- inspect_ai/scorer/_metric.py +87 -28
- inspect_ai/scorer/_metrics/__init__.py +3 -3
- inspect_ai/scorer/_metrics/accuracy.py +8 -10
- inspect_ai/scorer/_metrics/mean.py +3 -17
- inspect_ai/scorer/_metrics/std.py +111 -30
- inspect_ai/scorer/_model.py +12 -12
- inspect_ai/scorer/_pattern.py +3 -3
- inspect_ai/scorer/_reducer/reducer.py +36 -21
- inspect_ai/scorer/_reducer/registry.py +2 -2
- inspect_ai/scorer/_reducer/types.py +7 -1
- inspect_ai/scorer/_score.py +11 -1
- inspect_ai/scorer/_scorer.py +110 -16
- inspect_ai/solver/__init__.py +1 -1
- inspect_ai/solver/_basic_agent.py +19 -22
- inspect_ai/solver/_bridge/__init__.py +0 -3
- inspect_ai/solver/_bridge/bridge.py +3 -3
- inspect_ai/solver/_chain.py +1 -2
- inspect_ai/solver/_critique.py +3 -3
- inspect_ai/solver/_fork.py +2 -2
- inspect_ai/solver/_human_agent/__init__.py +0 -0
- inspect_ai/solver/_human_agent/agent.py +5 -8
- inspect_ai/solver/_human_agent/commands/clock.py +14 -10
- inspect_ai/solver/_human_agent/commands/note.py +1 -1
- inspect_ai/solver/_human_agent/commands/score.py +0 -11
- inspect_ai/solver/_multiple_choice.py +38 -26
- inspect_ai/solver/_prompt.py +7 -7
- inspect_ai/solver/_solver.py +53 -52
- inspect_ai/solver/_task_state.py +80 -69
- inspect_ai/solver/_use_tools.py +9 -9
- inspect_ai/tool/__init__.py +4 -1
- inspect_ai/tool/_tool.py +43 -14
- inspect_ai/tool/_tool_call.py +6 -2
- inspect_ai/tool/_tool_choice.py +3 -1
- inspect_ai/tool/_tool_def.py +10 -8
- inspect_ai/tool/_tool_params.py +24 -0
- inspect_ai/tool/_tool_with.py +7 -7
- inspect_ai/tool/_tools/__init__.py +0 -0
- inspect_ai/tool/{beta → _tools}/_computer/_common.py +2 -2
- inspect_ai/tool/{beta → _tools}/_computer/_computer.py +13 -5
- inspect_ai/tool/_tools/_computer/_resources/tool/__init__.py +0 -0
- inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_x11_client.py +1 -1
- inspect_ai/tool/_tools/_computer/_resources/tool/requirements.txt +0 -0
- inspect_ai/tool/_tools/_execute.py +23 -11
- inspect_ai/tool/_tools/_web_browser/_resources/README.md +2 -2
- inspect_ai/tool/_tools/_web_browser/_web_browser.py +5 -3
- inspect_ai/tool/_tools/_web_search.py +7 -5
- inspect_ai/tool/beta.py +3 -0
- inspect_ai/util/_concurrency.py +3 -3
- inspect_ai/util/_panel.py +2 -0
- inspect_ai/util/_resource.py +12 -12
- inspect_ai/util/_sandbox/docker/compose.py +23 -20
- inspect_ai/util/_sandbox/docker/config.py +2 -1
- inspect_ai/util/_sandbox/docker/docker.py +42 -86
- inspect_ai/util/_sandbox/docker/service.py +100 -0
- inspect_ai/util/_sandbox/environment.py +99 -96
- inspect_ai/util/_sandbox/self_check.py +124 -16
- inspect_ai/util/_subprocess.py +5 -3
- inspect_ai/util/_subtask.py +15 -16
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/LICENSE +1 -1
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/METADATA +11 -6
- inspect_ai-0.3.64.dist-info/RECORD +625 -0
- inspect_ai/_view/www/src/Register.mjs +0 -3
- inspect_ai/_view/www/src/Types.mjs +0 -38
- inspect_ai/_view/www/src/appearance/Colors.mjs +0 -27
- inspect_ai/_view/www/src/appearance/Fonts.mjs +0 -66
- inspect_ai/_view/www/src/appearance/Icons.mjs +0 -240
- inspect_ai/_view/www/src/components/AnsiDisplay.mjs +0 -184
- inspect_ai/_view/www/src/components/AppErrorBoundary.mjs +0 -34
- inspect_ai/_view/www/src/components/AsciiCinemaPlayer.mjs +0 -74
- inspect_ai/_view/www/src/components/Card.mjs +0 -126
- inspect_ai/_view/www/src/components/ChatView.mjs +0 -441
- inspect_ai/_view/www/src/components/CopyButton.mjs +0 -48
- inspect_ai/_view/www/src/components/Dialog.mjs +0 -61
- inspect_ai/_view/www/src/components/DownloadButton.mjs +0 -15
- inspect_ai/_view/www/src/components/DownloadPanel.mjs +0 -29
- inspect_ai/_view/www/src/components/EmptyPanel.mjs +0 -23
- inspect_ai/_view/www/src/components/ErrorPanel.mjs +0 -66
- inspect_ai/_view/www/src/components/ExpandablePanel.mjs +0 -136
- inspect_ai/_view/www/src/components/FindBand.mjs +0 -157
- inspect_ai/_view/www/src/components/HumanBaselineView.mjs +0 -168
- inspect_ai/_view/www/src/components/JsonPanel.mjs +0 -61
- inspect_ai/_view/www/src/components/LabeledValue.mjs +0 -32
- inspect_ai/_view/www/src/components/LargeModal.mjs +0 -190
- inspect_ai/_view/www/src/components/LightboxCarousel.mjs +0 -217
- inspect_ai/_view/www/src/components/MarkdownDiv.mjs +0 -118
- inspect_ai/_view/www/src/components/MessageBand.mjs +0 -48
- inspect_ai/_view/www/src/components/MessageContent.mjs +0 -111
- inspect_ai/_view/www/src/components/MetaDataGrid.mjs +0 -92
- inspect_ai/_view/www/src/components/MetaDataView.mjs +0 -109
- inspect_ai/_view/www/src/components/MorePopOver.mjs +0 -50
- inspect_ai/_view/www/src/components/NavPills.mjs +0 -63
- inspect_ai/_view/www/src/components/ProgressBar.mjs +0 -51
- inspect_ai/_view/www/src/components/RenderedContent/ChatMessageRenderer.mjs +0 -54
- inspect_ai/_view/www/src/components/RenderedContent/Types.mjs +0 -19
- inspect_ai/_view/www/src/components/TabSet.mjs +0 -184
- inspect_ai/_view/www/src/components/ToolButton.mjs +0 -16
- inspect_ai/_view/www/src/components/Tools.mjs +0 -376
- inspect_ai/_view/www/src/components/VirtualList.mjs +0 -280
- inspect_ai/_view/www/src/components/ansi-output.js +0 -932
- inspect_ai/_view/www/src/json/JsonTab.mjs +0 -48
- inspect_ai/_view/www/src/log-reader/Log-Reader.mjs +0 -25
- inspect_ai/_view/www/src/log-reader/Native-Log-Reader.mjs +0 -13
- inspect_ai/_view/www/src/log-reader/Open-AI-Log-Reader.mjs +0 -263
- inspect_ai/_view/www/src/navbar/Navbar.mjs +0 -418
- inspect_ai/_view/www/src/navbar/SecondaryBar.mjs +0 -175
- inspect_ai/_view/www/src/plan/PlanCard.mjs +0 -418
- inspect_ai/_view/www/src/samples/SampleDialog.mjs +0 -123
- inspect_ai/_view/www/src/samples/SampleDisplay.mjs +0 -516
- inspect_ai/_view/www/src/samples/SampleError.mjs +0 -99
- inspect_ai/_view/www/src/samples/SampleList.mjs +0 -427
- inspect_ai/_view/www/src/samples/SampleScoreView.mjs +0 -172
- inspect_ai/_view/www/src/samples/SampleScores.mjs +0 -34
- inspect_ai/_view/www/src/samples/SampleTranscript.mjs +0 -20
- inspect_ai/_view/www/src/samples/SamplesDescriptor.mjs +0 -771
- inspect_ai/_view/www/src/samples/SamplesTab.mjs +0 -399
- inspect_ai/_view/www/src/samples/SamplesTools.mjs +0 -64
- inspect_ai/_view/www/src/samples/tools/EpochFilter.mjs +0 -38
- inspect_ai/_view/www/src/samples/tools/SampleFilter.mjs +0 -756
- inspect_ai/_view/www/src/samples/tools/SelectScorer.mjs +0 -141
- inspect_ai/_view/www/src/samples/tools/SortFilter.mjs +0 -151
- inspect_ai/_view/www/src/samples/transcript/ApprovalEventView.mjs +0 -71
- inspect_ai/_view/www/src/samples/transcript/ErrorEventView.mjs +0 -44
- inspect_ai/_view/www/src/samples/transcript/EventPanel.mjs +0 -271
- inspect_ai/_view/www/src/samples/transcript/EventRow.mjs +0 -46
- inspect_ai/_view/www/src/samples/transcript/EventSection.mjs +0 -33
- inspect_ai/_view/www/src/samples/transcript/InfoEventView.mjs +0 -59
- inspect_ai/_view/www/src/samples/transcript/InputEventView.mjs +0 -44
- inspect_ai/_view/www/src/samples/transcript/LoggerEventView.mjs +0 -32
- inspect_ai/_view/www/src/samples/transcript/ModelEventView.mjs +0 -216
- inspect_ai/_view/www/src/samples/transcript/SampleInitEventView.mjs +0 -107
- inspect_ai/_view/www/src/samples/transcript/SampleLimitEventView.mjs +0 -74
- inspect_ai/_view/www/src/samples/transcript/ScoreEventView.mjs +0 -100
- inspect_ai/_view/www/src/samples/transcript/StepEventView.mjs +0 -187
- inspect_ai/_view/www/src/samples/transcript/SubtaskEventView.mjs +0 -133
- inspect_ai/_view/www/src/samples/transcript/ToolEventView.mjs +0 -88
- inspect_ai/_view/www/src/samples/transcript/TranscriptView.mjs +0 -459
- inspect_ai/_view/www/src/samples/transcript/Types.mjs +0 -44
- inspect_ai/_view/www/src/samples/transcript/state/StateDiffView.mjs +0 -53
- inspect_ai/_view/www/src/samples/transcript/state/StateEventRenderers.mjs +0 -254
- inspect_ai/_view/www/src/samples/transcript/state/StateEventView.mjs +0 -313
- inspect_ai/_view/www/src/sidebar/Sidebar.mjs +0 -418
- inspect_ai/_view/www/src/usage/ModelTokenTable.mjs +0 -72
- inspect_ai/_view/www/src/usage/UsageCard.mjs +0 -159
- inspect_ai/_view/www/src/utils/Format.mjs +0 -260
- inspect_ai/_view/www/src/utils/Git.mjs +0 -12
- inspect_ai/_view/www/src/utils/Html.mjs +0 -21
- inspect_ai/_view/www/src/utils/attachments.mjs +0 -31
- inspect_ai/_view/www/src/utils/debugging.mjs +0 -23
- inspect_ai/_view/www/src/utils/http.mjs +0 -18
- inspect_ai/_view/www/src/utils/queue.mjs +0 -67
- inspect_ai/_view/www/src/utils/sync.mjs +0 -101
- inspect_ai/_view/www/src/workspace/TaskErrorPanel.mjs +0 -17
- inspect_ai/_view/www/src/workspace/WorkSpace.mjs +0 -516
- inspect_ai/tool/beta/__init__.py +0 -5
- inspect_ai-0.3.62.dist-info/RECORD +0 -481
- /inspect_ai/{tool/beta/_computer/_resources/tool → _eval}/__init__.py +0 -0
- /inspect_ai/{tool/beta/_computer/_resources/tool/requirements.txt → _util/__init__.py} +0 -0
- /inspect_ai/_view/www/src/{constants.mjs → constants.ts} +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/__init__.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_computer_split.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/Dockerfile +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/README.md +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/entrypoint.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/novnc_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/x11vnc_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/xfce_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/entrypoint/xvfb_startup.sh +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/Code/User/globalStorage/state.vscdb +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/Code/User/settings.json +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-panel.xml +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-screensaver.xml +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/Desktop/Firefox Web Browser.desktop +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/Desktop/Terminal.desktop +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/image_home_dir/Desktop/Visual Studio Code.desktop +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_logger.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_run.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/_tool_result.py +0 -0
- /inspect_ai/tool/{beta → _tools}/_computer/_resources/tool/computer_tool.py +0 -0
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/WHEEL +0 -0
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/entry_points.txt +0 -0
- {inspect_ai-0.3.62.dist-info → inspect_ai-0.3.64.dist-info}/top_level.txt +0 -0
@@ -1,427 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { useCallback, useMemo, useState } from "preact/hooks";
|
3
|
-
import { useEffect, useRef } from "preact/hooks";
|
4
|
-
|
5
|
-
import { ApplicationStyles } from "../appearance/Styles.mjs";
|
6
|
-
import { FontSize } from "../appearance/Fonts.mjs";
|
7
|
-
import { TextStyle } from "../appearance/Fonts.mjs";
|
8
|
-
import { MarkdownDiv } from "../components/MarkdownDiv.mjs";
|
9
|
-
import { SampleError } from "./SampleError.mjs";
|
10
|
-
|
11
|
-
import { arrayToString, formatNoDecimal } from "../utils/Format.mjs";
|
12
|
-
import { EmptyPanel } from "../components/EmptyPanel.mjs";
|
13
|
-
import { VirtualList } from "../components/VirtualList.mjs";
|
14
|
-
import { MessageBand } from "../components/MessageBand.mjs";
|
15
|
-
import { inputString } from "../utils/Format.mjs";
|
16
|
-
|
17
|
-
const kSampleHeight = 88;
|
18
|
-
const kSeparatorHeight = 24;
|
19
|
-
|
20
|
-
/**
|
21
|
-
* Convert samples to a datastructure which contemplates grouping, etc...
|
22
|
-
*
|
23
|
-
* @param {Object} props - The parameters for the component.
|
24
|
-
* @param {Object} props.listRef - The ref for the list.
|
25
|
-
* @param {import("./SamplesTab.mjs").ListItem[]} props.items - The samples.
|
26
|
-
* @param {import("../samples/SamplesDescriptor.mjs").SamplesDescriptor} props.sampleDescriptor - The sample descriptor.
|
27
|
-
* @param {Object} props.style - The style for the element
|
28
|
-
* @param {number} props.selectedIndex - The index of the selected sample.
|
29
|
-
* @param {(index: number) => void} props.setSelectedIndex - The function to set the selected sample index.
|
30
|
-
* @param {import("../Types.mjs").ScoreLabel} props.selectedScore - The function to get the selected score.
|
31
|
-
* @param {() => void} props.nextSample - The function to move to the next sample.
|
32
|
-
* @param {() => void} props.prevSample - The function to move to the previous sample.
|
33
|
-
* @param {(index: number) => void} props.showSample - The function to show the sample.
|
34
|
-
* @returns {import("preact").JSX.Element} The SampleList component.
|
35
|
-
*/
|
36
|
-
export const SampleList = (props) => {
|
37
|
-
const {
|
38
|
-
listRef,
|
39
|
-
items,
|
40
|
-
sampleDescriptor,
|
41
|
-
style,
|
42
|
-
selectedIndex,
|
43
|
-
setSelectedIndex,
|
44
|
-
selectedScore,
|
45
|
-
nextSample,
|
46
|
-
prevSample,
|
47
|
-
showSample,
|
48
|
-
} = props;
|
49
|
-
// If there are no samples, just display an empty state
|
50
|
-
if (items.length === 0) {
|
51
|
-
return html`<${EmptyPanel}>No Samples</${EmptyPanel}>`;
|
52
|
-
}
|
53
|
-
|
54
|
-
const [hidden, setHidden] = useState(false);
|
55
|
-
useEffect(() => {
|
56
|
-
setHidden(false);
|
57
|
-
}, [items]);
|
58
|
-
|
59
|
-
// Keep a mapping of the indexes to items (skipping separators)
|
60
|
-
const itemRowMapping = useMemo(() => {
|
61
|
-
const rowIndexes = [];
|
62
|
-
items.forEach((item, index) => {
|
63
|
-
if (item.type === "sample") {
|
64
|
-
rowIndexes.push(index);
|
65
|
-
}
|
66
|
-
});
|
67
|
-
return rowIndexes;
|
68
|
-
}, [items]);
|
69
|
-
|
70
|
-
const prevSelectedIndexRef = useRef(null);
|
71
|
-
useEffect(() => {
|
72
|
-
const listEl = listRef.current;
|
73
|
-
if (listEl) {
|
74
|
-
const actualRowIndex = itemRowMapping[selectedIndex];
|
75
|
-
const direction =
|
76
|
-
actualRowIndex > prevSelectedIndexRef.current ? "down" : "up";
|
77
|
-
listRef.current?.scrollToIndex(actualRowIndex, direction);
|
78
|
-
prevSelectedIndexRef.current = actualRowIndex;
|
79
|
-
}
|
80
|
-
}, [selectedIndex, listRef, itemRowMapping]);
|
81
|
-
|
82
|
-
/** @param {import("./SamplesTab.mjs").ListItem} item */
|
83
|
-
const renderRow = (item) => {
|
84
|
-
if (item.type === "sample") {
|
85
|
-
return html`
|
86
|
-
<${SampleRow}
|
87
|
-
id=${item.number}
|
88
|
-
index=${item.index}
|
89
|
-
sample=${item.data}
|
90
|
-
height=${kSampleHeight}
|
91
|
-
sampleDescriptor=${sampleDescriptor}
|
92
|
-
selected=${selectedIndex === item.index}
|
93
|
-
setSelected=${setSelectedIndex}
|
94
|
-
selectedScore=${selectedScore}
|
95
|
-
showSample=${showSample}
|
96
|
-
/>
|
97
|
-
`;
|
98
|
-
} else if (item.type === "separator") {
|
99
|
-
return html`
|
100
|
-
<${SeparatorRow}
|
101
|
-
id=${`sample-group${item.number}`}
|
102
|
-
title=${item.data}
|
103
|
-
height=${kSeparatorHeight}
|
104
|
-
/>
|
105
|
-
`;
|
106
|
-
} else {
|
107
|
-
return "";
|
108
|
-
}
|
109
|
-
};
|
110
|
-
|
111
|
-
const onkeydown = useCallback(
|
112
|
-
(e) => {
|
113
|
-
switch (e.key) {
|
114
|
-
case "ArrowUp":
|
115
|
-
prevSample();
|
116
|
-
e.preventDefault();
|
117
|
-
e.stopPropagation();
|
118
|
-
return false;
|
119
|
-
case "ArrowDown":
|
120
|
-
nextSample();
|
121
|
-
e.preventDefault();
|
122
|
-
e.stopPropagation();
|
123
|
-
return false;
|
124
|
-
case "Enter":
|
125
|
-
showSample(selectedIndex);
|
126
|
-
e.preventDefault();
|
127
|
-
e.stopPropagation();
|
128
|
-
return false;
|
129
|
-
}
|
130
|
-
},
|
131
|
-
[selectedIndex],
|
132
|
-
);
|
133
|
-
|
134
|
-
const listStyle = { ...style, flex: "1", overflowY: "auto", outline: "none" };
|
135
|
-
const { input, limit, answer, target } = gridColumns(sampleDescriptor);
|
136
|
-
|
137
|
-
const headerRow = html`<div
|
138
|
-
style=${{
|
139
|
-
display: "grid",
|
140
|
-
...gridColumnStyles(sampleDescriptor),
|
141
|
-
fontSize: FontSize.smaller,
|
142
|
-
...TextStyle.label,
|
143
|
-
...TextStyle.secondary,
|
144
|
-
paddingBottom: "0.3em",
|
145
|
-
paddingTop: "0.3em",
|
146
|
-
borderBottom: "solid var(--bs-light-border-subtle) 1px",
|
147
|
-
}}
|
148
|
-
>
|
149
|
-
<div>Id</div>
|
150
|
-
<div>${input !== "0" ? "Input" : ""}</div>
|
151
|
-
<div>${target !== "0" ? "Target" : ""}</div>
|
152
|
-
<div>${answer !== "0" ? "Answer" : ""}</div>
|
153
|
-
<div>${limit !== "0" ? "Limit" : ""}</div>
|
154
|
-
<div style=${{ justifySelf: "center" }}>Score</div>
|
155
|
-
</div>`;
|
156
|
-
|
157
|
-
const sampleCount = items?.reduce((prev, current) => {
|
158
|
-
if (current.type === "sample") {
|
159
|
-
return prev + 1;
|
160
|
-
} else {
|
161
|
-
return prev;
|
162
|
-
}
|
163
|
-
}, 0);
|
164
|
-
const footerRow = html` <div
|
165
|
-
style=${{
|
166
|
-
borderTop: "solid var(--bs-light-border-subtle) 1px",
|
167
|
-
background: "var(--bs-light-bg-subtle)",
|
168
|
-
fontSize: FontSize.smaller,
|
169
|
-
display: "grid",
|
170
|
-
gridTemplateColumns: "max-content",
|
171
|
-
justifyContent: "end",
|
172
|
-
alignContent: "end",
|
173
|
-
padding: "0.2em 1em",
|
174
|
-
}}
|
175
|
-
>
|
176
|
-
<div>${sampleCount} Samples</div>
|
177
|
-
</div>`;
|
178
|
-
|
179
|
-
// Count any sample errors and display a bad alerting the user
|
180
|
-
// to any errors
|
181
|
-
const errorCount = items?.reduce((previous, item) => {
|
182
|
-
// @ts-expect-error
|
183
|
-
if (item.data.error) {
|
184
|
-
return previous + 1;
|
185
|
-
} else {
|
186
|
-
return previous;
|
187
|
-
}
|
188
|
-
}, 0);
|
189
|
-
|
190
|
-
// Count limits
|
191
|
-
const limitCount = items?.reduce((previous, item) => {
|
192
|
-
// @ts-expect-error
|
193
|
-
if (item.data.limit) {
|
194
|
-
return previous + 1;
|
195
|
-
} else {
|
196
|
-
return previous;
|
197
|
-
}
|
198
|
-
}, 0);
|
199
|
-
|
200
|
-
const percentError = (errorCount / sampleCount) * 100;
|
201
|
-
const percentLimit = (limitCount / sampleCount) * 100;
|
202
|
-
const warningMessage =
|
203
|
-
errorCount > 0
|
204
|
-
? `INFO: ${errorCount} of ${sampleCount} samples (${formatNoDecimal(percentError)}%) had errors and were not scored.`
|
205
|
-
: limitCount
|
206
|
-
? `INFO: ${limitCount} of ${sampleCount} samples (${formatNoDecimal(percentLimit)}%) completed due to exceeding a limit.`
|
207
|
-
: undefined;
|
208
|
-
|
209
|
-
const warningRow = warningMessage
|
210
|
-
? html`<${MessageBand}
|
211
|
-
message=${warningMessage}
|
212
|
-
hidden=${hidden}
|
213
|
-
setHidden=${setHidden}
|
214
|
-
type="info"
|
215
|
-
/>`
|
216
|
-
: "";
|
217
|
-
|
218
|
-
return html` <div
|
219
|
-
style=${{ display: "flex", flexDirection: "column", width: "100%" }}
|
220
|
-
>
|
221
|
-
${warningRow} ${headerRow}
|
222
|
-
<${VirtualList}
|
223
|
-
ref=${listRef}
|
224
|
-
data=${items}
|
225
|
-
tabIndex="0"
|
226
|
-
renderRow=${renderRow}
|
227
|
-
onkeydown=${onkeydown}
|
228
|
-
style=${listStyle}
|
229
|
-
/>
|
230
|
-
${footerRow}
|
231
|
-
</div>`;
|
232
|
-
};
|
233
|
-
|
234
|
-
const SeparatorRow = ({ id, title, height }) => {
|
235
|
-
return html`<div
|
236
|
-
id=${id}
|
237
|
-
style=${{
|
238
|
-
padding: ".25em 1em .25em 1em",
|
239
|
-
textTransform: "uppercase",
|
240
|
-
...TextStyle.secondary,
|
241
|
-
fontSize: FontSize.smaller,
|
242
|
-
fontWeight: 600,
|
243
|
-
borderBottom: "solid 1px var(--bs-border-color)",
|
244
|
-
height: `${height}px`,
|
245
|
-
}}
|
246
|
-
>
|
247
|
-
<div>${title}</div>
|
248
|
-
</div>`;
|
249
|
-
};
|
250
|
-
|
251
|
-
/**
|
252
|
-
* @param {Object} props - The parameters for the component.
|
253
|
-
* @param {string} props.id - The unique identifier for the sample.
|
254
|
-
* @param {number} props.index - The index of the sample.
|
255
|
-
* @param {import("../api/Types.ts").SampleSummary} props.sample - The sample.
|
256
|
-
* @param {import("../samples/SamplesDescriptor.mjs").SamplesDescriptor} props.sampleDescriptor - The sample descriptor.
|
257
|
-
* @param {number} props.height - The height of the sample row.
|
258
|
-
* @param {boolean} props.selected - Whether the sample is selected.
|
259
|
-
* @param {(index: number) => void} props.showSample - The function to show the sample.
|
260
|
-
* @returns {import("preact").JSX.Element} The SampleRow component.
|
261
|
-
*/
|
262
|
-
const SampleRow = ({
|
263
|
-
id,
|
264
|
-
index,
|
265
|
-
sample,
|
266
|
-
sampleDescriptor,
|
267
|
-
height,
|
268
|
-
selected,
|
269
|
-
showSample,
|
270
|
-
}) => {
|
271
|
-
const selectedStyle = selected
|
272
|
-
? {
|
273
|
-
boxShadow: "inset 0 0 0px 2px var(--bs-focus-ring-color)",
|
274
|
-
}
|
275
|
-
: {};
|
276
|
-
|
277
|
-
const cellStyle = {
|
278
|
-
paddingLeft: "0em",
|
279
|
-
paddingRight: "0em",
|
280
|
-
};
|
281
|
-
|
282
|
-
return html`
|
283
|
-
<div
|
284
|
-
id=${`sample-${id}`}
|
285
|
-
onclick=${() => {
|
286
|
-
showSample(index);
|
287
|
-
}}
|
288
|
-
style=${{
|
289
|
-
height: `${height}px`,
|
290
|
-
display: "grid",
|
291
|
-
...gridColumnStyles(sampleDescriptor),
|
292
|
-
paddingTop: "1em",
|
293
|
-
paddingBottom: "1em",
|
294
|
-
gridTemplateRows: `${height - 28}px`,
|
295
|
-
fontSize: FontSize.base,
|
296
|
-
borderBottom: "solid var(--bs-border-color) 1px",
|
297
|
-
cursor: "pointer",
|
298
|
-
...selectedStyle,
|
299
|
-
overflowY: "hidden",
|
300
|
-
}}
|
301
|
-
>
|
302
|
-
<div
|
303
|
-
class="sample-id"
|
304
|
-
style=${{ ...cellStyle, ...ApplicationStyles.threeLineClamp }}
|
305
|
-
>
|
306
|
-
${sample.id}
|
307
|
-
</div>
|
308
|
-
<div
|
309
|
-
class="sample-input"
|
310
|
-
style=${{
|
311
|
-
...ApplicationStyles.threeLineClamp,
|
312
|
-
wordWrap: "anywhere",
|
313
|
-
...cellStyle,
|
314
|
-
}}
|
315
|
-
>
|
316
|
-
${inputString(sample.input).join(" ")}
|
317
|
-
</div>
|
318
|
-
<div
|
319
|
-
class="sample-target"
|
320
|
-
style=${{
|
321
|
-
...ApplicationStyles.threeLineClamp,
|
322
|
-
...cellStyle,
|
323
|
-
}}
|
324
|
-
>
|
325
|
-
<${MarkdownDiv}
|
326
|
-
markdown=${arrayToString(sample?.target)}
|
327
|
-
style=${{ paddingLeft: "0" }}
|
328
|
-
class="no-last-para-padding"
|
329
|
-
/>
|
330
|
-
</div>
|
331
|
-
<div
|
332
|
-
class="sample-answer"
|
333
|
-
style=${{
|
334
|
-
...ApplicationStyles.threeLineClamp,
|
335
|
-
...cellStyle,
|
336
|
-
}}
|
337
|
-
>
|
338
|
-
${sample
|
339
|
-
? html`
|
340
|
-
<${MarkdownDiv}
|
341
|
-
markdown=${sampleDescriptor
|
342
|
-
?.selectedScorerDescriptor(sample)
|
343
|
-
.answer()}
|
344
|
-
style=${{ paddingLeft: "0" }}
|
345
|
-
class="no-last-para-padding"
|
346
|
-
/>
|
347
|
-
`
|
348
|
-
: ""}
|
349
|
-
</div>
|
350
|
-
<div
|
351
|
-
class="sample-limit"
|
352
|
-
style=${{
|
353
|
-
fontSize: FontSize.small,
|
354
|
-
...ApplicationStyles.threeLineClamp,
|
355
|
-
...cellStyle,
|
356
|
-
}}
|
357
|
-
>
|
358
|
-
${sample.limit}
|
359
|
-
</div>
|
360
|
-
|
361
|
-
<div
|
362
|
-
style=${{
|
363
|
-
fontSize: FontSize.small,
|
364
|
-
...cellStyle,
|
365
|
-
display: "flex",
|
366
|
-
justifySelf: "center",
|
367
|
-
}}
|
368
|
-
>
|
369
|
-
${sample.error
|
370
|
-
? html`<${SampleError} message=${sample.error} />`
|
371
|
-
: sampleDescriptor?.selectedScore(sample).render()}
|
372
|
-
</div>
|
373
|
-
</div>
|
374
|
-
`;
|
375
|
-
};
|
376
|
-
|
377
|
-
const gridColumnStyles = (sampleDescriptor) => {
|
378
|
-
const { input, target, answer, limit, id, score } =
|
379
|
-
gridColumns(sampleDescriptor);
|
380
|
-
return {
|
381
|
-
gridGap: "10px",
|
382
|
-
gridTemplateColumns: `${id} ${input} ${target} ${answer} ${limit} ${score}`,
|
383
|
-
paddingLeft: "1rem",
|
384
|
-
paddingRight: "1rem",
|
385
|
-
};
|
386
|
-
};
|
387
|
-
|
388
|
-
const gridColumns = (sampleDescriptor) => {
|
389
|
-
const input =
|
390
|
-
sampleDescriptor?.messageShape.normalized.input > 0
|
391
|
-
? Math.max(0.15, sampleDescriptor.messageShape.normalized.input)
|
392
|
-
: 0;
|
393
|
-
const target =
|
394
|
-
sampleDescriptor?.messageShape.normalized.target > 0
|
395
|
-
? Math.max(0.15, sampleDescriptor.messageShape.normalized.target)
|
396
|
-
: 0;
|
397
|
-
const answer =
|
398
|
-
sampleDescriptor?.messageShape.normalized.answer > 0
|
399
|
-
? Math.max(0.15, sampleDescriptor.messageShape.normalized.answer)
|
400
|
-
: 0;
|
401
|
-
const limit =
|
402
|
-
sampleDescriptor?.messageShape.normalized.limit > 0
|
403
|
-
? Math.max(0.15, sampleDescriptor.messageShape.normalized.limit)
|
404
|
-
: 0;
|
405
|
-
const id = Math.max(2, Math.min(10, sampleDescriptor?.messageShape.raw.id));
|
406
|
-
const score = Math.max(
|
407
|
-
3,
|
408
|
-
Math.min(10, sampleDescriptor?.messageShape.raw.score),
|
409
|
-
);
|
410
|
-
|
411
|
-
const frSize = (val) => {
|
412
|
-
if (val === 0) {
|
413
|
-
return "0";
|
414
|
-
} else {
|
415
|
-
return `${val}fr`;
|
416
|
-
}
|
417
|
-
};
|
418
|
-
|
419
|
-
return {
|
420
|
-
input: frSize(input),
|
421
|
-
target: frSize(target),
|
422
|
-
answer: frSize(answer),
|
423
|
-
limit: frSize(limit),
|
424
|
-
id: `${id}rem`,
|
425
|
-
score: `${score}rem`,
|
426
|
-
};
|
427
|
-
};
|
@@ -1,172 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
import { arrayToString, inputString } from "../utils/Format.mjs";
|
3
|
-
import { MarkdownDiv } from "../components/MarkdownDiv.mjs";
|
4
|
-
import { SampleScores } from "./SampleScores.mjs";
|
5
|
-
import { FontSize, TextStyle } from "../appearance/Fonts.mjs";
|
6
|
-
import { MetaDataGrid } from "../components/MetaDataGrid.mjs";
|
7
|
-
import { Card, CardHeader, CardBody } from "../components/Card.mjs";
|
8
|
-
|
9
|
-
const labelStyle = {
|
10
|
-
paddingRight: "2em",
|
11
|
-
paddingLeft: "0",
|
12
|
-
paddingBottom: "0",
|
13
|
-
...TextStyle.label,
|
14
|
-
...TextStyle.secondary,
|
15
|
-
};
|
16
|
-
|
17
|
-
/**
|
18
|
-
* @param {Object} props - The component props.
|
19
|
-
* @param {import("../types/log").EvalSample} props.sample - The sample.
|
20
|
-
* @param {import("../samples/SamplesDescriptor.mjs").SamplesDescriptor} props.sampleDescriptor - The sample descriptor.
|
21
|
-
* @param {Object} props.style - The style for the element.
|
22
|
-
* @param {string} props.scorer - The scorer.
|
23
|
-
* @returns {import("preact").JSX.Element} The SampleScoreView component.
|
24
|
-
*/
|
25
|
-
export const SampleScoreView = ({
|
26
|
-
sample,
|
27
|
-
sampleDescriptor,
|
28
|
-
style,
|
29
|
-
scorer,
|
30
|
-
}) => {
|
31
|
-
if (!sampleDescriptor) {
|
32
|
-
return html``;
|
33
|
-
}
|
34
|
-
|
35
|
-
const scoreInput = inputString(sample.input);
|
36
|
-
if (sample.choices && sample.choices.length > 0) {
|
37
|
-
scoreInput.push("");
|
38
|
-
scoreInput.push(
|
39
|
-
...sample.choices.map((choice, index) => {
|
40
|
-
return `${String.fromCharCode(65 + index)}) ${choice}`;
|
41
|
-
}),
|
42
|
-
);
|
43
|
-
}
|
44
|
-
|
45
|
-
const scorerDescriptor = sampleDescriptor.evalDescriptor.scorerDescriptor(
|
46
|
-
sample,
|
47
|
-
{ scorer, name: scorer },
|
48
|
-
);
|
49
|
-
const explanation = scorerDescriptor.explanation() || "(No Explanation)";
|
50
|
-
const answer = scorerDescriptor.answer();
|
51
|
-
const metadata = scorerDescriptor.metadata();
|
52
|
-
|
53
|
-
return html`
|
54
|
-
<div
|
55
|
-
class="container-fluid"
|
56
|
-
style=${{
|
57
|
-
marginTop: "0.5em",
|
58
|
-
paddingLeft: "0",
|
59
|
-
fontSize: FontSize.base,
|
60
|
-
...style,
|
61
|
-
}}
|
62
|
-
>
|
63
|
-
<${Card}>
|
64
|
-
<${CardHeader} label="Score"/>
|
65
|
-
<${CardBody}>
|
66
|
-
<div>
|
67
|
-
<div style=${{ ...labelStyle }}>Input</div>
|
68
|
-
<div>
|
69
|
-
<${MarkdownDiv}
|
70
|
-
markdown=${scoreInput.join("\n")}
|
71
|
-
style=${{ wordBreak: "break-all" }}
|
72
|
-
/>
|
73
|
-
</div>
|
74
|
-
</div>
|
75
|
-
|
76
|
-
<table
|
77
|
-
class="table"
|
78
|
-
style=${{ width: "100%", marginBottom: "1em" }}
|
79
|
-
>
|
80
|
-
<thead style=${{ borderBottomColor: "#00000000" }}>
|
81
|
-
<tr>
|
82
|
-
<th style=${{ ...labelStyle, fontWeight: "400" }}>Target</th>
|
83
|
-
<th
|
84
|
-
style=${{ ...labelStyle, paddingBottom: "0", fontWeight: "400" }}
|
85
|
-
>
|
86
|
-
Answer
|
87
|
-
</th>
|
88
|
-
<th
|
89
|
-
style=${{
|
90
|
-
...labelStyle,
|
91
|
-
paddingLeft: "2em",
|
92
|
-
paddingBottom: "0",
|
93
|
-
fontWeight: "400",
|
94
|
-
}}
|
95
|
-
>
|
96
|
-
Score
|
97
|
-
</th>
|
98
|
-
</tr>
|
99
|
-
</thead>
|
100
|
-
<tbody style=${{ borderBottomColor: "#00000000" }}>
|
101
|
-
<tr>
|
102
|
-
<td
|
103
|
-
style=${{
|
104
|
-
paddingRight: "2em",
|
105
|
-
paddingLeft: "0",
|
106
|
-
paddingTop: "0",
|
107
|
-
}}
|
108
|
-
>
|
109
|
-
<${MarkdownDiv}
|
110
|
-
markdown=${arrayToString(
|
111
|
-
arrayToString(sample?.target || "none"),
|
112
|
-
)}
|
113
|
-
style=${{ paddingLeft: "0" }}
|
114
|
-
class="no-last-para-padding"
|
115
|
-
/>
|
116
|
-
</td>
|
117
|
-
<td style=${{ paddingTop: "0", paddingLeft: "0" }}>
|
118
|
-
<${MarkdownDiv}
|
119
|
-
class="no-last-para-padding"
|
120
|
-
markdown=${answer}
|
121
|
-
style=${{ paddingLeft: "0" }}
|
122
|
-
/>
|
123
|
-
</td>
|
124
|
-
<td style=${{ paddingLeft: "2em", paddingTop: "0" }}>
|
125
|
-
<${SampleScores}
|
126
|
-
sample=${sample}
|
127
|
-
sampleDescriptor=${sampleDescriptor}
|
128
|
-
scorer=${scorer}
|
129
|
-
/>
|
130
|
-
</td>
|
131
|
-
</tr>
|
132
|
-
</tbody>
|
133
|
-
</table>
|
134
|
-
</${CardBody}>
|
135
|
-
</${Card}>
|
136
|
-
|
137
|
-
${
|
138
|
-
explanation && explanation !== answer
|
139
|
-
? html`
|
140
|
-
<${Card}>
|
141
|
-
<${CardHeader} label="Explanation"/>
|
142
|
-
<${CardBody}>
|
143
|
-
<${MarkdownDiv}
|
144
|
-
markdown=${arrayToString(explanation)}
|
145
|
-
style=${{ paddingLeft: "0" }}
|
146
|
-
class="no-last-para-padding"
|
147
|
-
/>
|
148
|
-
|
149
|
-
</${CardBody}>
|
150
|
-
</${Card}>`
|
151
|
-
: ""
|
152
|
-
}
|
153
|
-
|
154
|
-
${
|
155
|
-
metadata && Object.keys(metadata).length > 0
|
156
|
-
? html`
|
157
|
-
<${Card}>
|
158
|
-
<${CardHeader} label="Metadata"/>
|
159
|
-
<${CardBody}>
|
160
|
-
<${MetaDataGrid}
|
161
|
-
id="task-sample-score-metadata"
|
162
|
-
classes="tab-pane"
|
163
|
-
entries="${metadata}"
|
164
|
-
style=${{ marginTop: "0" }}
|
165
|
-
/>
|
166
|
-
</${CardBody}>
|
167
|
-
</${Card}>`
|
168
|
-
: ""
|
169
|
-
}
|
170
|
-
</div>
|
171
|
-
`;
|
172
|
-
};
|
@@ -1,34 +0,0 @@
|
|
1
|
-
import { html } from "htm/preact";
|
2
|
-
|
3
|
-
/**
|
4
|
-
* @param {Object} props
|
5
|
-
* @param {import("../api/Types.ts").SampleSummary} props.sample
|
6
|
-
* @param {import("../samples/SamplesDescriptor.mjs").SamplesDescriptor} props.sampleDescriptor
|
7
|
-
* @param {string} props.scorer
|
8
|
-
* @returns {import("preact").JSX.Element}
|
9
|
-
*/
|
10
|
-
export const SampleScores = ({ sample, sampleDescriptor, scorer }) => {
|
11
|
-
const scores = scorer
|
12
|
-
? sampleDescriptor.evalDescriptor
|
13
|
-
.scorerDescriptor(sample, { scorer, name: scorer })
|
14
|
-
.scores()
|
15
|
-
: sampleDescriptor.selectedScorerDescriptor(sample).scores();
|
16
|
-
|
17
|
-
if (scores.length === 1) {
|
18
|
-
return scores[0].rendered();
|
19
|
-
} else {
|
20
|
-
const rows = scores.map((score) => {
|
21
|
-
return html` <div style=${{ opacity: "0.7" }}>${score.name}</div>
|
22
|
-
<div>${score.rendered()}</div>`;
|
23
|
-
});
|
24
|
-
return html`<div
|
25
|
-
style=${{
|
26
|
-
display: "grid",
|
27
|
-
gridTemplateColumns: "max-content max-content",
|
28
|
-
columnGap: "1em",
|
29
|
-
}}
|
30
|
-
>
|
31
|
-
${rows}
|
32
|
-
</div>`;
|
33
|
-
}
|
34
|
-
};
|
@@ -1,20 +0,0 @@
|
|
1
|
-
// @ts-check
|
2
|
-
import { html } from "htm/preact";
|
3
|
-
import { TranscriptVirtualList } from "./transcript/TranscriptView.mjs";
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Renders the SampleTranscript component.
|
7
|
-
*
|
8
|
-
* @param {Object} props - The parameters for the component.
|
9
|
-
* @param {string} props.id - The id of this component
|
10
|
-
* @param {import("../types/log").Events} props.evalEvents - The transcript to display.
|
11
|
-
* @param {import("htm/preact").MutableRef<HTMLElement>} props.scrollRef - The scrollable parent element
|
12
|
-
* @returns {import("preact").JSX.Element} The SampleTranscript component.
|
13
|
-
*/
|
14
|
-
export const SampleTranscript = ({ id, evalEvents, scrollRef }) => {
|
15
|
-
return html`<${TranscriptVirtualList}
|
16
|
-
id=${id}
|
17
|
-
events=${evalEvents}
|
18
|
-
scrollRef=${scrollRef}
|
19
|
-
/>`;
|
20
|
-
};
|