Skip to content

Commit

Permalink
schema change
Browse files Browse the repository at this point in the history
  • Loading branch information
aisi-inspect committed Oct 6, 2024
1 parent b723cc2 commit f8399d7
Show file tree
Hide file tree
Showing 2 changed files with 138 additions and 9 deletions.
97 changes: 93 additions & 4 deletions src/inspect_ai/_view/www/log-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,24 @@
"title": "Event",
"type": "string"
},
"tool_call": {
"message": {
"title": "Message",
"type": "string"
},
"call": {
"$ref": "#/$defs/ToolCall"
},
"view": {
"anyOf": [
{
"$ref": "#/$defs/ToolCallView"
},
{
"type": "null"
}
],
"default": null
},
"approver": {
"title": "Approver",
"type": "string"
Expand Down Expand Up @@ -50,7 +65,9 @@
"required": [
"timestamp",
"event",
"tool_call",
"message",
"call",
"view",
"approver",
"decision",
"explanation"
Expand All @@ -77,6 +94,8 @@
"additionalProperties": false
},
"ApproverPolicyConfig": {
"additionalProperties": false,
"description": "Configuration format for approver policies.\n\nFor example, here is a configuration in YAML:\n\n```yaml\napprovers:\n - name: human\n tools: web_browser*, bash, pyhton\n choices: [approve, reject]\n\n - name: auto\n tools: *\n decision: approve\n```",
"properties": {
"name": {
"title": "Name",
Expand Down Expand Up @@ -107,8 +126,7 @@
"params"
],
"title": "ApproverPolicyConfig",
"type": "object",
"additionalProperties": false
"type": "object"
},
"ChatCompletionChoice": {
"properties": {
Expand Down Expand Up @@ -578,6 +596,18 @@
"default": null,
"title": "Epochs Reducer"
},
"trace": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"title": "Trace"
},
"approval": {
"anyOf": [
{
Expand Down Expand Up @@ -707,6 +737,7 @@
"limit",
"epochs",
"epochs_reducer",
"trace",
"approval",
"fail_on_error",
"max_messages",
Expand Down Expand Up @@ -3171,6 +3202,30 @@
"type": "object",
"additionalProperties": false
},
"ToolCallContent": {
"description": "Content to include in tool call view.",
"properties": {
"format": {
"enum": [
"text",
"markdown"
],
"title": "Format",
"type": "string"
},
"content": {
"title": "Content",
"type": "string"
}
},
"required": [
"format",
"content"
],
"title": "ToolCallContent",
"type": "object",
"additionalProperties": false
},
"ToolCallError": {
"properties": {
"type": {
Expand Down Expand Up @@ -3200,6 +3255,40 @@
"type": "object",
"additionalProperties": false
},
"ToolCallView": {
"description": "Custom view of a tool call.\n\nBoth `context` and `call` are optional. If `call` is not specified\nthen the view will default to a syntax highlighted Python function call.",
"properties": {
"context": {
"anyOf": [
{
"$ref": "#/$defs/ToolCallContent"
},
{
"type": "null"
}
],
"default": null
},
"call": {
"anyOf": [
{
"$ref": "#/$defs/ToolCallContent"
},
{
"type": "null"
}
],
"default": null
}
},
"title": "ToolCallView",
"type": "object",
"required": [
"context",
"call"
],
"additionalProperties": false
},
"ToolEvent": {
"description": "Call to a tool.",
"properties": {
Expand Down
50 changes: 45 additions & 5 deletions src/inspect_ai/_view/www/src/types/log.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export type ModelBaseUrl = string | null;
export type Limit = number | [unknown, unknown] | null;
export type Epochs = number | null;
export type EpochsReducer = string[] | null;
export type Trace = boolean | null;
export type Name1 = string;
export type Tools = string | string[];
export type Approvers = ApproverPolicyConfig[];
Expand Down Expand Up @@ -263,6 +264,9 @@ export type Result = string | number | boolean | (ContentText | ContentImage)[];
export type Truncated = [unknown, unknown] | null;
export type Timestamp5 = string;
export type Event5 = "approval";
export type Message2 = string;
export type Format = "text" | "markdown";
export type Content5 = string;
export type Approver = string;
export type Decision = "approve" | "reject" | "escalate" | "terminate";
export type Explanation2 = string | null;
Expand All @@ -286,7 +290,7 @@ export type Level =
| "warning"
| "error"
| "critical";
export type Message2 = string;
export type Message3 = string;
export type Created1 = number;
export type Filename = string;
export type Module = string;
Expand Down Expand Up @@ -392,6 +396,7 @@ export interface EvalConfig {
limit: Limit;
epochs: Epochs;
epochs_reducer: EpochsReducer;
trace: Trace;
approval: ApprovalPolicyConfig | null;
fail_on_error: FailOnError;
max_messages: MaxMessages;
Expand All @@ -406,6 +411,22 @@ export interface EvalConfig {
export interface ApprovalPolicyConfig {
approvers: Approvers;
}
/**
* Configuration format for approver policies.
*
* For example, here is a configuration in YAML:
*
* ```yaml
* approvers:
* - name: human
* tools: web_browser*, bash, pyhton
* choices: [approve, reject]
*
* - name: auto
* tools: *
* decision: approve
* ```
*/
export interface ApproverPolicyConfig {
name: Name1;
tools: Tools;
Expand Down Expand Up @@ -636,7 +657,7 @@ export interface Metadata6 {}
export interface Store {}
export interface EvalEvents {
events: Events;
content: Content5;
content: Content6;
}
/**
* Beginning of processing a Sample.
Expand Down Expand Up @@ -845,11 +866,30 @@ export interface Arguments1 {
export interface ApprovalEvent {
timestamp: Timestamp5;
event: Event5;
tool_call: ToolCall;
message: Message2;
call: ToolCall;
view: ToolCallView | null;
approver: Approver;
decision: Decision;
explanation: Explanation2;
}
/**
* Custom view of a tool call.
*
* Both `context` and `call` are optional. If `call` is not specified
* then the view will default to a syntax highlighted Python function call.
*/
export interface ToolCallView {
context: ToolCallContent | null;
call: ToolCallContent | null;
}
/**
* Content to include in tool call view.
*/
export interface ToolCallContent {
format: Format;
content: Content5;
}
/**
* Input screen interaction.
*/
Expand Down Expand Up @@ -887,7 +927,7 @@ export interface LoggerEvent {
export interface LoggingMessage {
name: Name7;
level: Level;
message: Message2;
message: Message3;
created: Created1;
filename: Filename;
module: Module;
Expand Down Expand Up @@ -927,6 +967,6 @@ export interface Input4 {}
export interface Result1 {
[k: string]: unknown;
}
export interface Content5 {
export interface Content6 {
[k: string]: string;
}

0 comments on commit f8399d7

Please sign in to comment.