inspect-ai 0.3.99__py3-none-any.whl → 0.3.101__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/eval.py +2 -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 +37 -9
- inspect_ai/_eval/eval.py +13 -1
- inspect_ai/_eval/evalset.py +3 -2
- inspect_ai/_eval/run.py +2 -0
- inspect_ai/_eval/score.py +2 -4
- inspect_ai/_eval/task/log.py +3 -1
- inspect_ai/_eval/task/run.py +59 -81
- 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 +2 -1
- inspect_ai/_view/www/CLAUDE.md +15 -0
- inspect_ai/_view/www/dist/assets/index.css +307 -171
- inspect_ai/_view/www/dist/assets/index.js +24733 -21641
- inspect_ai/_view/www/log-schema.json +77 -3
- inspect_ai/_view/www/package.json +9 -5
- inspect_ai/_view/www/src/@types/log.d.ts +9 -0
- 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 +220 -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/log-view/tabs/grouping.ts +4 -4
- inspect_ai/_view/www/src/app/routing/navigationHooks.ts +22 -25
- 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 +24 -17
- 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/SampleList.tsx +17 -5
- inspect_ai/_view/www/src/app/samples/list/SampleRow.tsx +1 -1
- inspect_ai/_view/www/src/app/samples/transcript/ErrorEventView.tsx +1 -2
- 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 +290 -33
- inspect_ai/agent/_react.py +12 -7
- inspect_ai/agent/_run.py +2 -3
- inspect_ai/analysis/beta/__init__.py +2 -0
- inspect_ai/analysis/beta/_dataframe/samples/table.py +19 -18
- inspect_ai/dataset/_sources/csv.py +2 -6
- inspect_ai/dataset/_sources/hf.py +2 -6
- inspect_ai/dataset/_sources/json.py +2 -6
- inspect_ai/dataset/_util.py +23 -0
- inspect_ai/log/_log.py +1 -1
- inspect_ai/log/_recorders/eval.py +4 -3
- inspect_ai/log/_recorders/file.py +2 -9
- inspect_ai/log/_recorders/json.py +1 -0
- inspect_ai/log/_recorders/recorder.py +1 -0
- 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 +85 -41
- inspect_ai/model/_openai_web_search.py +38 -0
- inspect_ai/model/_providers/azureai.py +72 -3
- inspect_ai/model/_providers/openai.py +4 -1
- inspect_ai/model/_providers/openai_responses.py +5 -1
- inspect_ai/scorer/_metric.py +1 -2
- inspect_ai/scorer/_reducer/reducer.py +1 -1
- 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 +43 -15
- inspect_ai/tool/_tools/_web_search/_tavily.py +46 -13
- inspect_ai/tool/_tools/_web_search/_web_search.py +214 -45
- inspect_ai/util/__init__.py +4 -0
- inspect_ai/util/_json.py +3 -0
- inspect_ai/util/_limit.py +230 -20
- inspect_ai/util/_sandbox/docker/compose.py +20 -11
- inspect_ai/util/_span.py +1 -1
- {inspect_ai-0.3.99.dist-info → inspect_ai-0.3.101.dist-info}/METADATA +3 -3
- {inspect_ai-0.3.99.dist-info → inspect_ai-0.3.101.dist-info}/RECORD +138 -124
- {inspect_ai-0.3.99.dist-info → inspect_ai-0.3.101.dist-info}/WHEEL +1 -1
- {inspect_ai-0.3.99.dist-info → inspect_ai-0.3.101.dist-info}/entry_points.txt +0 -0
- {inspect_ai-0.3.99.dist-info → inspect_ai-0.3.101.dist-info}/licenses/LICENSE +0 -0
- {inspect_ai-0.3.99.dist-info → inspect_ai-0.3.101.dist-info}/top_level.txt +0 -0
inspect_ai/_util/content.py
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
from typing import Literal, Union
|
2
2
|
|
3
|
-
from pydantic import BaseModel, Field
|
3
|
+
from pydantic import BaseModel, Field, JsonValue
|
4
4
|
|
5
5
|
|
6
|
-
class
|
6
|
+
class ContentBase(BaseModel):
|
7
|
+
internal: JsonValue | None = Field(default=None)
|
8
|
+
"""Model provider specific payload - typically used to aid transformation back to model types."""
|
9
|
+
|
10
|
+
|
11
|
+
class ContentText(ContentBase):
|
7
12
|
"""Text content."""
|
8
13
|
|
9
14
|
type: Literal["text"] = Field(default="text")
|
@@ -16,7 +21,7 @@ class ContentText(BaseModel):
|
|
16
21
|
"""Was this a refusal message?"""
|
17
22
|
|
18
23
|
|
19
|
-
class ContentReasoning(
|
24
|
+
class ContentReasoning(ContentBase):
|
20
25
|
"""Reasoning content.
|
21
26
|
|
22
27
|
See the specification for [thinking blocks](https://docs.anthropic.com/en/docs/build-with-claude/extended-thinking#understanding-thinking-blocks) for Claude models.
|
@@ -35,7 +40,7 @@ class ContentReasoning(BaseModel):
|
|
35
40
|
"""Indicates that the explicit content of this reasoning block has been redacted."""
|
36
41
|
|
37
42
|
|
38
|
-
class ContentImage(
|
43
|
+
class ContentImage(ContentBase):
|
39
44
|
"""Image content."""
|
40
45
|
|
41
46
|
type: Literal["image"] = Field(default="image")
|
@@ -51,7 +56,7 @@ class ContentImage(BaseModel):
|
|
51
56
|
"""
|
52
57
|
|
53
58
|
|
54
|
-
class ContentAudio(
|
59
|
+
class ContentAudio(ContentBase):
|
55
60
|
"""Audio content."""
|
56
61
|
|
57
62
|
type: Literal["audio"] = Field(default="audio")
|
@@ -64,7 +69,7 @@ class ContentAudio(BaseModel):
|
|
64
69
|
"""Format of audio data ('mp3' or 'wav')"""
|
65
70
|
|
66
71
|
|
67
|
-
class ContentVideo(
|
72
|
+
class ContentVideo(ContentBase):
|
68
73
|
"""Video content."""
|
69
74
|
|
70
75
|
type: Literal["video"] = Field(default="video")
|
inspect_ai/_util/interrupt.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import anyio
|
2
2
|
|
3
|
-
from .
|
3
|
+
from inspect_ai.util._limit import check_working_limit
|
4
4
|
|
5
5
|
|
6
6
|
def check_sample_interrupt() -> None:
|
@@ -12,4 +12,4 @@ def check_sample_interrupt() -> None:
|
|
12
12
|
raise anyio.get_cancelled_exc_class()
|
13
13
|
|
14
14
|
# check for working_limit
|
15
|
-
|
15
|
+
check_working_limit()
|
inspect_ai/_util/text.py
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
import random
|
2
2
|
import re
|
3
3
|
import string
|
4
|
+
import textwrap
|
4
5
|
from logging import getLogger
|
5
6
|
from typing import List, NamedTuple
|
6
7
|
|
7
8
|
logger = getLogger(__name__)
|
8
9
|
|
9
10
|
|
11
|
+
def truncate_text(text: str, max_length: int) -> str:
|
12
|
+
if len(text) <= max_length:
|
13
|
+
return text
|
14
|
+
return textwrap.shorten(text, width=max_length, placeholder="...")
|
15
|
+
|
16
|
+
|
10
17
|
def strip_punctuation(s: str) -> str:
|
11
18
|
return s.strip(string.whitespace + string.punctuation)
|
12
19
|
|
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
@@ -45,9 +45,10 @@ def sync_view_schema() -> None:
|
|
45
45
|
"false",
|
46
46
|
],
|
47
47
|
cwd=WWW_DIR,
|
48
|
+
check=True,
|
48
49
|
)
|
49
50
|
|
50
|
-
subprocess.run(["yarn", "prettier:write"], cwd=types_path.parent)
|
51
|
+
subprocess.run(["yarn", "prettier:write"], cwd=types_path.parent, check=True)
|
51
52
|
|
52
53
|
shutil.copyfile(types_path, vs_code_types_path)
|
53
54
|
|
@@ -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.
|