inspect-ai 0.3.98__py3-none-any.whl → 0.3.100__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/__init__.py +2 -0
- inspect_ai/_cli/log.py +1 -1
- inspect_ai/_display/core/config.py +11 -5
- inspect_ai/_display/core/panel.py +66 -2
- inspect_ai/_display/core/textual.py +5 -2
- inspect_ai/_display/plain/display.py +1 -0
- inspect_ai/_display/rich/display.py +2 -2
- inspect_ai/_display/textual/widgets/transcript.py +41 -1
- inspect_ai/_eval/run.py +12 -4
- inspect_ai/_eval/score.py +2 -4
- inspect_ai/_eval/task/log.py +1 -1
- inspect_ai/_eval/task/run.py +59 -81
- inspect_ai/_eval/task/task.py +1 -1
- inspect_ai/_util/_async.py +1 -1
- inspect_ai/_util/content.py +11 -6
- inspect_ai/_util/interrupt.py +2 -2
- inspect_ai/_util/text.py +7 -0
- inspect_ai/_util/working.py +8 -37
- inspect_ai/_view/__init__.py +0 -0
- inspect_ai/_view/schema.py +3 -1
- inspect_ai/_view/view.py +14 -0
- inspect_ai/_view/www/CLAUDE.md +15 -0
- inspect_ai/_view/www/dist/assets/index.css +273 -169
- inspect_ai/_view/www/dist/assets/index.js +20079 -17019
- inspect_ai/_view/www/log-schema.json +122 -8
- inspect_ai/_view/www/package.json +5 -1
- inspect_ai/_view/www/src/@types/log.d.ts +20 -2
- inspect_ai/_view/www/src/app/App.tsx +1 -15
- inspect_ai/_view/www/src/app/appearance/icons.ts +4 -1
- inspect_ai/_view/www/src/app/content/MetaDataGrid.tsx +24 -6
- inspect_ai/_view/www/src/app/content/MetadataGrid.module.css +0 -5
- inspect_ai/_view/www/src/app/content/RenderedContent.tsx +221 -205
- inspect_ai/_view/www/src/app/log-view/LogViewContainer.tsx +2 -1
- inspect_ai/_view/www/src/app/log-view/tabs/SamplesTab.tsx +5 -0
- inspect_ai/_view/www/src/app/routing/url.ts +84 -4
- inspect_ai/_view/www/src/app/samples/InlineSampleDisplay.module.css +0 -5
- inspect_ai/_view/www/src/app/samples/SampleDialog.module.css +1 -1
- inspect_ai/_view/www/src/app/samples/SampleDisplay.module.css +7 -0
- inspect_ai/_view/www/src/app/samples/SampleDisplay.tsx +26 -19
- inspect_ai/_view/www/src/app/samples/SampleSummaryView.module.css +1 -2
- inspect_ai/_view/www/src/app/samples/chat/ChatMessage.tsx +8 -6
- inspect_ai/_view/www/src/app/samples/chat/ChatMessageRow.tsx +0 -4
- inspect_ai/_view/www/src/app/samples/chat/ChatViewVirtualList.tsx +3 -2
- inspect_ai/_view/www/src/app/samples/chat/MessageContent.tsx +2 -0
- inspect_ai/_view/www/src/app/samples/chat/MessageContents.tsx +2 -0
- inspect_ai/_view/www/src/app/samples/chat/messages.ts +1 -0
- inspect_ai/_view/www/src/app/samples/chat/tools/ToolCallView.tsx +1 -0
- inspect_ai/_view/www/src/app/samples/list/SampleRow.tsx +1 -1
- inspect_ai/_view/www/src/app/samples/scores/SampleScoresGrid.module.css +2 -2
- inspect_ai/_view/www/src/app/samples/transcript/ErrorEventView.tsx +2 -3
- inspect_ai/_view/www/src/app/samples/transcript/InfoEventView.tsx +1 -1
- inspect_ai/_view/www/src/app/samples/transcript/InputEventView.tsx +1 -2
- inspect_ai/_view/www/src/app/samples/transcript/ModelEventView.module.css +1 -1
- inspect_ai/_view/www/src/app/samples/transcript/ModelEventView.tsx +1 -1
- inspect_ai/_view/www/src/app/samples/transcript/SampleInitEventView.tsx +1 -1
- inspect_ai/_view/www/src/app/samples/transcript/SampleLimitEventView.tsx +3 -2
- inspect_ai/_view/www/src/app/samples/transcript/SandboxEventView.tsx +4 -5
- inspect_ai/_view/www/src/app/samples/transcript/ScoreEventView.tsx +1 -1
- inspect_ai/_view/www/src/app/samples/transcript/SpanEventView.tsx +1 -2
- inspect_ai/_view/www/src/app/samples/transcript/StepEventView.tsx +1 -3
- inspect_ai/_view/www/src/app/samples/transcript/SubtaskEventView.tsx +1 -2
- inspect_ai/_view/www/src/app/samples/transcript/ToolEventView.tsx +3 -4
- inspect_ai/_view/www/src/app/samples/transcript/TranscriptPanel.module.css +42 -0
- inspect_ai/_view/www/src/app/samples/transcript/TranscriptPanel.tsx +77 -0
- inspect_ai/_view/www/src/app/samples/transcript/TranscriptVirtualList.tsx +27 -71
- inspect_ai/_view/www/src/app/samples/transcript/TranscriptVirtualListComponent.module.css +13 -3
- inspect_ai/_view/www/src/app/samples/transcript/TranscriptVirtualListComponent.tsx +27 -2
- inspect_ai/_view/www/src/app/samples/transcript/event/EventPanel.module.css +1 -0
- inspect_ai/_view/www/src/app/samples/transcript/event/EventPanel.tsx +21 -22
- inspect_ai/_view/www/src/app/samples/transcript/outline/OutlineRow.module.css +45 -0
- inspect_ai/_view/www/src/app/samples/transcript/outline/OutlineRow.tsx +223 -0
- inspect_ai/_view/www/src/app/samples/transcript/outline/TranscriptOutline.module.css +10 -0
- inspect_ai/_view/www/src/app/samples/transcript/outline/TranscriptOutline.tsx +258 -0
- inspect_ai/_view/www/src/app/samples/transcript/outline/tree-visitors.ts +187 -0
- inspect_ai/_view/www/src/app/samples/transcript/state/StateEventRenderers.tsx +8 -1
- inspect_ai/_view/www/src/app/samples/transcript/state/StateEventView.tsx +3 -4
- inspect_ai/_view/www/src/app/samples/transcript/transform/hooks.ts +78 -0
- inspect_ai/_view/www/src/app/samples/transcript/transform/treeify.ts +340 -135
- inspect_ai/_view/www/src/app/samples/transcript/transform/utils.ts +3 -0
- inspect_ai/_view/www/src/app/samples/transcript/types.ts +2 -0
- inspect_ai/_view/www/src/app/types.ts +5 -1
- inspect_ai/_view/www/src/client/api/api-browser.ts +2 -2
- inspect_ai/_view/www/src/components/LiveVirtualList.tsx +6 -1
- inspect_ai/_view/www/src/components/MarkdownDiv.tsx +1 -1
- inspect_ai/_view/www/src/components/PopOver.tsx +422 -0
- inspect_ai/_view/www/src/components/PulsingDots.module.css +9 -9
- inspect_ai/_view/www/src/components/PulsingDots.tsx +4 -1
- inspect_ai/_view/www/src/components/StickyScroll.tsx +183 -0
- inspect_ai/_view/www/src/components/TabSet.tsx +4 -0
- inspect_ai/_view/www/src/state/hooks.ts +52 -2
- inspect_ai/_view/www/src/state/logSlice.ts +4 -3
- inspect_ai/_view/www/src/state/samplePolling.ts +8 -0
- inspect_ai/_view/www/src/state/sampleSlice.ts +53 -9
- inspect_ai/_view/www/src/state/scrolling.ts +152 -0
- inspect_ai/_view/www/src/utils/attachments.ts +7 -0
- inspect_ai/_view/www/src/utils/python.ts +18 -0
- inspect_ai/_view/www/yarn.lock +269 -6
- inspect_ai/agent/_react.py +12 -7
- inspect_ai/agent/_run.py +46 -11
- inspect_ai/analysis/beta/_dataframe/samples/table.py +19 -18
- inspect_ai/log/_bundle.py +5 -3
- inspect_ai/log/_log.py +3 -3
- inspect_ai/log/_recorders/file.py +2 -9
- inspect_ai/log/_transcript.py +1 -1
- inspect_ai/model/_call_tools.py +6 -2
- inspect_ai/model/_openai.py +1 -1
- inspect_ai/model/_openai_responses.py +78 -39
- inspect_ai/model/_openai_web_search.py +31 -0
- inspect_ai/model/_providers/anthropic.py +3 -6
- inspect_ai/model/_providers/azureai.py +72 -3
- inspect_ai/model/_providers/openai.py +2 -1
- inspect_ai/model/_providers/providers.py +1 -1
- inspect_ai/scorer/_metric.py +1 -2
- inspect_ai/solver/_task_state.py +2 -2
- inspect_ai/tool/_tool.py +6 -2
- inspect_ai/tool/_tool_def.py +27 -4
- inspect_ai/tool/_tool_info.py +2 -0
- inspect_ai/tool/_tools/_web_search/_google.py +15 -4
- inspect_ai/tool/_tools/_web_search/_tavily.py +35 -12
- inspect_ai/tool/_tools/_web_search/_web_search.py +214 -45
- inspect_ai/util/__init__.py +6 -0
- inspect_ai/util/_json.py +3 -0
- inspect_ai/util/_limit.py +374 -141
- inspect_ai/util/_sandbox/docker/compose.py +20 -11
- inspect_ai/util/_span.py +1 -1
- {inspect_ai-0.3.98.dist-info → inspect_ai-0.3.100.dist-info}/METADATA +3 -3
- {inspect_ai-0.3.98.dist-info → inspect_ai-0.3.100.dist-info}/RECORD +131 -117
- {inspect_ai-0.3.98.dist-info → inspect_ai-0.3.100.dist-info}/WHEEL +1 -1
- {inspect_ai-0.3.98.dist-info → inspect_ai-0.3.100.dist-info}/entry_points.txt +0 -0
- {inspect_ai-0.3.98.dist-info → inspect_ai-0.3.100.dist-info}/licenses/LICENSE +0 -0
- {inspect_ai-0.3.98.dist-info → inspect_ai-0.3.100.dist-info}/top_level.txt +0 -0
inspect_ai/_util/working.py
CHANGED
@@ -1,19 +1,14 @@
|
|
1
1
|
import time
|
2
2
|
from contextvars import ContextVar
|
3
3
|
|
4
|
-
from inspect_ai.util._limit import
|
4
|
+
from inspect_ai.util._limit import check_working_limit, record_waiting_time
|
5
5
|
|
6
6
|
|
7
|
-
def
|
8
|
-
_sample_working_limit.set(working_limit)
|
7
|
+
def init_sample_working_time(start_time: float) -> None:
|
9
8
|
_sample_start_time.set(start_time)
|
10
9
|
_sample_waiting_time.set(0)
|
11
10
|
|
12
11
|
|
13
|
-
def end_sample_working_limit() -> None:
|
14
|
-
_sample_working_limit.set(None)
|
15
|
-
|
16
|
-
|
17
12
|
def sample_waiting_time() -> float:
|
18
13
|
return _sample_waiting_time.get()
|
19
14
|
|
@@ -23,37 +18,13 @@ def sample_working_time() -> float:
|
|
23
18
|
|
24
19
|
|
25
20
|
def report_sample_waiting_time(waiting_time: float) -> None:
|
21
|
+
# record and check for scoped limits
|
22
|
+
record_waiting_time(waiting_time)
|
23
|
+
check_working_limit()
|
24
|
+
|
25
|
+
# record sample-level limits
|
26
26
|
_sample_waiting_time.set(_sample_waiting_time.get() + waiting_time)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
def check_sample_working_limit() -> None:
|
31
|
-
from inspect_ai.log._transcript import SampleLimitEvent, transcript
|
32
|
-
|
33
|
-
# no check if we don't have a limit
|
34
|
-
working_limit = _sample_working_limit.get()
|
35
|
-
if working_limit is None:
|
36
|
-
return
|
37
|
-
|
38
|
-
# are we over the limit?
|
39
|
-
running_time = time.monotonic() - _sample_start_time.get()
|
40
|
-
working_time = running_time - sample_waiting_time()
|
41
|
-
if working_time > working_limit:
|
42
|
-
message = f"Exceeded working time limit ({working_limit:,} seconds)"
|
43
|
-
transcript()._event(
|
44
|
-
SampleLimitEvent(type="working", limit=int(working_limit), message=message)
|
45
|
-
)
|
46
|
-
raise LimitExceededError(
|
47
|
-
type="working",
|
48
|
-
value=int(working_time),
|
49
|
-
limit=int(working_limit),
|
50
|
-
message=message,
|
51
|
-
)
|
52
|
-
|
53
|
-
|
54
|
-
_sample_working_limit: ContextVar[float | None] = ContextVar(
|
55
|
-
"sample_working_limit", default=None
|
56
|
-
)
|
27
|
+
|
57
28
|
|
58
29
|
_sample_start_time: ContextVar[float] = ContextVar("sample_start_time", default=0)
|
59
30
|
|
File without changes
|
inspect_ai/_view/schema.py
CHANGED
@@ -30,6 +30,7 @@ def sync_view_schema() -> None:
|
|
30
30
|
for key in defs.keys():
|
31
31
|
defs[key] = schema_to_strict(defs[key])
|
32
32
|
f.write(json.dumps(schema, indent=2))
|
33
|
+
f.write("\n")
|
33
34
|
|
34
35
|
# generate types w/ json-schema-to-typescript
|
35
36
|
subprocess.run(
|
@@ -44,9 +45,10 @@ def sync_view_schema() -> None:
|
|
44
45
|
"false",
|
45
46
|
],
|
46
47
|
cwd=WWW_DIR,
|
48
|
+
check=True,
|
47
49
|
)
|
48
50
|
|
49
|
-
subprocess.run(["yarn", "prettier:write"], cwd=types_path.parent)
|
51
|
+
subprocess.run(["yarn", "prettier:write"], cwd=types_path.parent, check=True)
|
50
52
|
|
51
53
|
shutil.copyfile(types_path, vs_code_types_path)
|
52
54
|
|
inspect_ai/_view/view.py
CHANGED
@@ -30,6 +30,20 @@ def view(
|
|
30
30
|
log_level: str | None = None,
|
31
31
|
fs_options: dict[str, Any] = {},
|
32
32
|
) -> None:
|
33
|
+
"""Run the Inspect View server.
|
34
|
+
|
35
|
+
Args:
|
36
|
+
log_dir: Directory to view logs from.
|
37
|
+
recursive: Recursively list files in `log_dir`.
|
38
|
+
host: Tcp/ip host (defaults to "127.0.0.1").
|
39
|
+
port: Tcp/ip port (defaults to 7575).
|
40
|
+
authorization: Validate requests by checking for this authorization header.
|
41
|
+
log_level: Level for logging to the console: "debug", "http", "sandbox",
|
42
|
+
"info", "warning", "error", or "critical" (defaults to "warning").
|
43
|
+
fs_options: Additional arguments to pass through to the filesystem provider
|
44
|
+
(e.g. `S3FileSystem`). Use `{"anon": True }` if you are accessing a
|
45
|
+
public S3 bucket with no credentials.
|
46
|
+
"""
|
33
47
|
init_dotenv()
|
34
48
|
init_logger(log_level)
|
35
49
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# CLAUDE.md
|
2
|
+
|
3
|
+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
4
|
+
|
5
|
+
## Build/Lint/Test Commands
|
6
|
+
|
7
|
+
- Run type checker, linter, and tests: `yarn check-all`
|
8
|
+
- Run type checker: `yarn tsc`
|
9
|
+
- Run linter: `yarn lint`
|
10
|
+
- Run tests: `yarn test`
|
11
|
+
|
12
|
+
## Other Information
|
13
|
+
|
14
|
+
- The code in this project is typescript, learn more about the configuration by inspecting package.json.
|
15
|
+
- Respect existing code patterns when modifying files. Run linting before committing changes.
|