inspect-ai 0.3.88__py3-none-any.whl → 0.3.90__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.
Files changed (90) hide show
  1. inspect_ai/_cli/eval.py +16 -0
  2. inspect_ai/_cli/score.py +1 -12
  3. inspect_ai/_cli/util.py +4 -2
  4. inspect_ai/_display/core/footer.py +2 -2
  5. inspect_ai/_display/plain/display.py +2 -2
  6. inspect_ai/_eval/context.py +7 -1
  7. inspect_ai/_eval/eval.py +51 -27
  8. inspect_ai/_eval/evalset.py +27 -10
  9. inspect_ai/_eval/loader.py +7 -8
  10. inspect_ai/_eval/run.py +23 -31
  11. inspect_ai/_eval/score.py +18 -1
  12. inspect_ai/_eval/task/log.py +5 -13
  13. inspect_ai/_eval/task/resolved.py +1 -0
  14. inspect_ai/_eval/task/run.py +231 -256
  15. inspect_ai/_eval/task/task.py +25 -2
  16. inspect_ai/_eval/task/util.py +1 -8
  17. inspect_ai/_util/constants.py +1 -0
  18. inspect_ai/_util/json.py +8 -3
  19. inspect_ai/_util/registry.py +30 -13
  20. inspect_ai/_view/www/App.css +5 -0
  21. inspect_ai/_view/www/dist/assets/index.css +71 -36
  22. inspect_ai/_view/www/dist/assets/index.js +573 -475
  23. inspect_ai/_view/www/log-schema.json +66 -0
  24. inspect_ai/_view/www/src/metadata/MetaDataView.module.css +1 -1
  25. inspect_ai/_view/www/src/metadata/MetaDataView.tsx +13 -8
  26. inspect_ai/_view/www/src/metadata/RenderedContent.tsx +3 -0
  27. inspect_ai/_view/www/src/plan/ModelCard.module.css +16 -0
  28. inspect_ai/_view/www/src/plan/ModelCard.tsx +93 -0
  29. inspect_ai/_view/www/src/samples/chat/ChatMessage.tsx +2 -2
  30. inspect_ai/_view/www/src/samples/chat/tools/ToolInput.module.css +2 -2
  31. inspect_ai/_view/www/src/samples/transcript/ModelEventView.tsx +5 -1
  32. inspect_ai/_view/www/src/samples/transcript/StepEventView.tsx +12 -6
  33. inspect_ai/_view/www/src/samples/transcript/TranscriptView.module.css +0 -2
  34. inspect_ai/_view/www/src/samples/transcript/state/StateEventView.tsx +6 -29
  35. inspect_ai/_view/www/src/types/log.d.ts +24 -6
  36. inspect_ai/_view/www/src/workspace/navbar/ModelRolesView.module.css +16 -0
  37. inspect_ai/_view/www/src/workspace/navbar/ModelRolesView.tsx +43 -0
  38. inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.module.css +1 -1
  39. inspect_ai/_view/www/src/workspace/navbar/PrimaryBar.tsx +5 -0
  40. inspect_ai/_view/www/src/workspace/tabs/InfoTab.tsx +2 -0
  41. inspect_ai/agent/_agent.py +12 -0
  42. inspect_ai/agent/_as_tool.py +1 -1
  43. inspect_ai/agent/_bridge/bridge.py +9 -2
  44. inspect_ai/agent/_react.py +142 -74
  45. inspect_ai/agent/_run.py +13 -2
  46. inspect_ai/agent/_types.py +6 -0
  47. inspect_ai/approval/_apply.py +6 -7
  48. inspect_ai/approval/_approver.py +3 -3
  49. inspect_ai/approval/_auto.py +2 -2
  50. inspect_ai/approval/_call.py +20 -4
  51. inspect_ai/approval/_human/approver.py +3 -3
  52. inspect_ai/approval/_human/manager.py +2 -2
  53. inspect_ai/approval/_human/panel.py +3 -3
  54. inspect_ai/approval/_policy.py +3 -3
  55. inspect_ai/log/__init__.py +2 -0
  56. inspect_ai/log/_log.py +23 -2
  57. inspect_ai/log/_model.py +58 -0
  58. inspect_ai/log/_recorders/file.py +14 -3
  59. inspect_ai/log/_transcript.py +3 -0
  60. inspect_ai/model/__init__.py +2 -0
  61. inspect_ai/model/_call_tools.py +4 -1
  62. inspect_ai/model/_model.py +49 -3
  63. inspect_ai/model/_openai.py +151 -21
  64. inspect_ai/model/_providers/anthropic.py +20 -12
  65. inspect_ai/model/_providers/bedrock.py +3 -3
  66. inspect_ai/model/_providers/cloudflare.py +29 -108
  67. inspect_ai/model/_providers/google.py +21 -10
  68. inspect_ai/model/_providers/grok.py +23 -17
  69. inspect_ai/model/_providers/groq.py +61 -37
  70. inspect_ai/model/_providers/llama_cpp_python.py +8 -9
  71. inspect_ai/model/_providers/mistral.py +8 -3
  72. inspect_ai/model/_providers/ollama.py +8 -9
  73. inspect_ai/model/_providers/openai.py +53 -157
  74. inspect_ai/model/_providers/openai_compatible.py +195 -0
  75. inspect_ai/model/_providers/openrouter.py +4 -15
  76. inspect_ai/model/_providers/providers.py +11 -0
  77. inspect_ai/model/_providers/together.py +25 -23
  78. inspect_ai/model/_trim.py +83 -0
  79. inspect_ai/solver/_plan.py +5 -3
  80. inspect_ai/tool/_tool_def.py +8 -2
  81. inspect_ai/util/__init__.py +3 -0
  82. inspect_ai/util/_concurrency.py +15 -2
  83. {inspect_ai-0.3.88.dist-info → inspect_ai-0.3.90.dist-info}/METADATA +1 -1
  84. {inspect_ai-0.3.88.dist-info → inspect_ai-0.3.90.dist-info}/RECORD +88 -83
  85. {inspect_ai-0.3.88.dist-info → inspect_ai-0.3.90.dist-info}/WHEEL +1 -1
  86. inspect_ai/_eval/task/rundir.py +0 -78
  87. inspect_ai/_view/www/node_modules/flatted/python/flatted.py +0 -149
  88. {inspect_ai-0.3.88.dist-info → inspect_ai-0.3.90.dist-info}/entry_points.txt +0 -0
  89. {inspect_ai-0.3.88.dist-info → inspect_ai-0.3.90.dist-info}/licenses/LICENSE +0 -0
  90. {inspect_ai-0.3.88.dist-info → inspect_ai-0.3.90.dist-info}/top_level.txt +0 -0
@@ -1,149 +0,0 @@
1
- # ISC License
2
- #
3
- # Copyright (c) 2018-2025, Andrea Giammarchi, @WebReflection
4
- #
5
- # Permission to use, copy, modify, and/or distribute this software for any
6
- # purpose with or without fee is hereby granted, provided that the above
7
- # copyright notice and this permission notice appear in all copies.
8
- #
9
- # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
10
- # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
11
- # AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
12
- # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
13
- # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
14
- # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
15
- # PERFORMANCE OF THIS SOFTWARE.
16
-
17
- import json as _json
18
-
19
- class _Known:
20
- def __init__(self):
21
- self.key = []
22
- self.value = []
23
-
24
- class _String:
25
- def __init__(self, value):
26
- self.value = value
27
-
28
-
29
- def _array_keys(value):
30
- keys = []
31
- i = 0
32
- for _ in value:
33
- keys.append(i)
34
- i += 1
35
- return keys
36
-
37
- def _object_keys(value):
38
- keys = []
39
- for key in value:
40
- keys.append(key)
41
- return keys
42
-
43
- def _is_array(value):
44
- return isinstance(value, (list, tuple))
45
-
46
- def _is_object(value):
47
- return isinstance(value, dict)
48
-
49
- def _is_string(value):
50
- return isinstance(value, str)
51
-
52
- def _index(known, input, value):
53
- input.append(value)
54
- index = str(len(input) - 1)
55
- known.key.append(value)
56
- known.value.append(index)
57
- return index
58
-
59
- def _loop(keys, input, known, output):
60
- for key in keys:
61
- value = output[key]
62
- if isinstance(value, _String):
63
- _ref(key, input[int(value.value)], input, known, output)
64
-
65
- return output
66
-
67
- def _ref(key, value, input, known, output):
68
- if _is_array(value) and value not in known:
69
- known.append(value)
70
- value = _loop(_array_keys(value), input, known, value)
71
- elif _is_object(value) and value not in known:
72
- known.append(value)
73
- value = _loop(_object_keys(value), input, known, value)
74
-
75
- output[key] = value
76
-
77
- def _relate(known, input, value):
78
- if _is_string(value) or _is_array(value) or _is_object(value):
79
- try:
80
- return known.value[known.key.index(value)]
81
- except:
82
- return _index(known, input, value)
83
-
84
- return value
85
-
86
- def _transform(known, input, value):
87
- if _is_array(value):
88
- output = []
89
- for val in value:
90
- output.append(_relate(known, input, val))
91
- return output
92
-
93
- if _is_object(value):
94
- obj = {}
95
- for key in value:
96
- obj[key] = _relate(known, input, value[key])
97
- return obj
98
-
99
- return value
100
-
101
- def _wrap(value):
102
- if _is_string(value):
103
- return _String(value)
104
-
105
- if _is_array(value):
106
- i = 0
107
- for val in value:
108
- value[i] = _wrap(val)
109
- i += 1
110
-
111
- elif _is_object(value):
112
- for key in value:
113
- value[key] = _wrap(value[key])
114
-
115
- return value
116
-
117
- def parse(value, *args, **kwargs):
118
- json = _json.loads(value, *args, **kwargs)
119
- wrapped = []
120
- for value in json:
121
- wrapped.append(_wrap(value))
122
-
123
- input = []
124
- for value in wrapped:
125
- if isinstance(value, _String):
126
- input.append(value.value)
127
- else:
128
- input.append(value)
129
-
130
- value = input[0]
131
-
132
- if _is_array(value):
133
- return _loop(_array_keys(value), input, [value], value)
134
-
135
- if _is_object(value):
136
- return _loop(_object_keys(value), input, [value], value)
137
-
138
- return value
139
-
140
-
141
- def stringify(value, *args, **kwargs):
142
- known = _Known()
143
- input = []
144
- output = []
145
- i = int(_index(known, input, value))
146
- while i < len(input):
147
- output.append(_transform(known, input, input[i]))
148
- i += 1
149
- return _json.dumps(output, *args, **kwargs)