Skip to content

Commit 0e794b0

Browse files
committed
fix(jev): expose text inputs to Agent models
1 parent 9f0e689 commit 0e794b0

4 files changed

Lines changed: 47 additions & 10 deletions

File tree

‎apps/docs/content/docs/integrations/jev.mdx‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ Choose an option with Jev and return its probability distribution and confidence
2828
| --------- | ---- | -------- | ----------- |
2929
| `apiKey` | string | Yes | TypeSafe API key from https://console.typesafe.ai |
3030
| `model` | string | No | Model ID or alias: jev-1.13.0, jev-latest, or jev-preview. Defaults to jev-1.13.0. |
31-
| `state` | json | Yes | Content to evaluate: a text string, JSON object, or array. |
32-
| `instructions` | json | Yes | The question to evaluate, as text, a JSON object, or an array. |
31+
| `state` | string | Yes | Content to evaluate: a text string, JSON object, or array. |
32+
| `instructions` | string | Yes | The question to evaluate, as text, a JSON object, or an array. |
3333
| `criteria` | json | Yes | Map of 1–255 option names to descriptions \(text, object, array, or null\). |
3434

3535
#### Output
@@ -54,8 +54,8 @@ Score content against an ordered rubric with Jev, including probabilities and co
5454
| --------- | ---- | -------- | ----------- |
5555
| `apiKey` | string | Yes | TypeSafe API key from https://console.typesafe.ai |
5656
| `model` | string | No | Model ID or alias: jev-1.13.0, jev-latest, or jev-preview. Defaults to jev-1.13.0. |
57-
| `state` | json | Yes | Content to evaluate: a text string, JSON object, or array. |
58-
| `instructions` | json | Yes | The question to evaluate, as text, a JSON object, or an array. |
57+
| `state` | string | Yes | Content to evaluate: a text string, JSON object, or array. |
58+
| `instructions` | string | Yes | The question to evaluate, as text, a JSON object, or an array. |
5959
| `criteria` | array | Yes | Ordered array of 2–10 rubric descriptions, from lowest to highest score. |
6060

6161
#### Output
@@ -81,8 +81,8 @@ Evaluate a yes/no question with Jev and return the probability that the answer i
8181
| --------- | ---- | -------- | ----------- |
8282
| `apiKey` | string | Yes | TypeSafe API key from https://console.typesafe.ai |
8383
| `model` | string | No | Model ID or alias: jev-1.13.0, jev-latest, or jev-preview. Defaults to jev-1.13.0. |
84-
| `state` | json | Yes | Content to evaluate: a text string, JSON object, or array. |
85-
| `instructions` | json | Yes | The question to evaluate, as text, a JSON object, or an array. |
84+
| `state` | string | Yes | Content to evaluate: a text string, JSON object, or array. |
85+
| `instructions` | string | Yes | The question to evaluate, as text, a JSON object, or an array. |
8686
| `criteria` | json | No | Optional object with true and false descriptions defining what yes and no mean. |
8787

8888
#### Output
@@ -105,7 +105,7 @@ Evaluate multiple Choice, Score, and Noul questions against shared state in one
105105
| --------- | ---- | -------- | ----------- |
106106
| `apiKey` | string | Yes | TypeSafe API key from https://console.typesafe.ai |
107107
| `model` | string | No | Model ID or alias: jev-1.13.0, jev-latest, or jev-preview. Defaults to jev-1.13.0. |
108-
| `state` | json | Yes | Content to evaluate: a text string, JSON object, or array. |
108+
| `state` | string | Yes | Content to evaluate: a text string, JSON object, or array. |
109109
| `questions` | json | Yes | Map of question IDs to \{type, instructions, criteria\}. Types: choice \(option map\), score \(2–10 ordered levels\), noul \(optional true/false descriptions\). Answers use the same IDs. |
110110

111111
#### Output

‎apps/sim/tools/generated/tool-metadata.ts‎

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

‎apps/sim/tools/jev/jev-agent.test.ts‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,4 +124,41 @@ describe('Jev Agent tools', () => {
124124
maxItems: 10,
125125
})
126126
})
127+
128+
it.each(CASES)(
129+
'accepts model-supplied text for unfilled $operation inputs',
130+
async ({ operation, args, questions }) => {
131+
const tool = await agentTool(operation, { apiKey: 'test-key' })
132+
expect(tool.parameters.properties.state.type).toBe('string')
133+
if (operation !== 'jev_evaluate') {
134+
expect(tool.parameters.properties.instructions.type).toBe('string')
135+
}
136+
const { toolParams } = prepareToolExecution(
137+
tool,
138+
{ ...args, state: '42', ...(operation !== 'jev_evaluate' && { instructions: 'Question' }) },
139+
{},
140+
'test-call'
141+
)
142+
const request = prepareToolRequest(TOOLS[operation], toolParams)
143+
expect(JSON.parse(request.body!)).toEqual({
144+
state: '42',
145+
model: 'jev-1.13.0',
146+
questions,
147+
})
148+
}
149+
)
150+
151+
it('preserves resolved structured state and instructions through the Agent adapter', async () => {
152+
const state = { ticket: 'Payment failed', attempts: 3 }
153+
const instructions = ['Evaluate urgency', { context: 'A repeated failure needs attention' }]
154+
const criteria = ['Low', 'High']
155+
const tool = await agentTool('jev_score', { apiKey: 'test-key', state, instructions, criteria })
156+
const { toolParams } = prepareToolExecution(tool, {}, {}, 'test-call')
157+
const request = prepareToolRequest(jevScoreTool, toolParams)
158+
expect(JSON.parse(request.body!)).toEqual({
159+
state,
160+
model: 'jev-1.13.0',
161+
questions: { result: { type: 'score', instructions, criteria } },
162+
})
163+
})
127164
})

‎apps/sim/tools/jev/shared.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ export const JEV_COMMON_PARAMS = {
8282
'Model ID or alias: jev-1.13.0, jev-latest, or jev-preview. Defaults to jev-1.13.0.',
8383
},
8484
state: {
85-
type: 'json',
85+
type: 'string',
8686
required: true,
8787
visibility: 'user-or-llm',
8888
description: 'Content to evaluate: a text string, JSON object, or array.',
8989
},
9090
} as const satisfies ToolConfig['params']
9191

9292
export const JEV_INSTRUCTIONS_PARAM = {
93-
type: 'json',
93+
type: 'string',
9494
required: true,
9595
visibility: 'user-or-llm',
9696
description: 'The question to evaluate, as text, a JSON object, or an array.',

0 commit comments

Comments
 (0)