Skip to content

Commit 3160259

Browse files
author
Jicheng Lu
committed
add reasoning effort level
1 parent 6221255 commit 3160259

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

src/lib/helpers/enums.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,4 +185,11 @@ const llmModelType = {
185185
Embedding: 4,
186186
Audio: 5
187187
};
188-
export const LlmModelType = Object.freeze(llmModelType);
188+
export const LlmModelType = Object.freeze(llmModelType);
189+
190+
const reasoningEffortLevel = {
191+
Low: "low",
192+
Medium: "medium",
193+
High: "high"
194+
};
195+
export const ReasoningEffortLevel = Object.freeze(reasoningEffortLevel);

src/lib/helpers/types/agentTypes.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* @property {string?} model
1818
* @property {number} max_recursion_depth
1919
* @property {number?} [max_output_tokens]
20+
* @property {string?} [reasoning_effort_level]
2021
*/
2122

2223

src/routes/page/agent/[agentId]/agent-components/agent-llm-config.svelte

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Card, CardBody, Input } from '@sveltestrap/sveltestrap';
44
import { getLlmProviders, getLlmProviderModels } from '$lib/services/llm-provider-service';
55
import { INTEGER_REGEX } from '$lib/helpers/constants';
6+
import { ReasoningEffortLevel } from '$lib/helpers/enums';
67
78
/** @type {import('$agentTypes').AgentModel} */
89
export let agent;
@@ -18,6 +19,14 @@
1819
}
1920
2021
const recursiveDepthLowerLimit = 1;
22+
/** @type {import('$commonTypes').LabelValuePair[]} */
23+
const reasonLevelOptions = [
24+
{ value: '', label: '' },
25+
...Object.entries(ReasoningEffortLevel).map(([k, v]) => ({
26+
value: v,
27+
label: v
28+
}))
29+
];
2130
2231
let config = agent.llm_config;
2332
@@ -89,6 +98,12 @@
8998
handleAgentChange();
9099
}
91100
101+
/** @param {any} e */
102+
function changeReasoningEffortLevel(e) {
103+
config.reasoning_effort_level = e.target.value || null;
104+
handleAgentChange();
105+
}
106+
92107
/** @param {any} e */
93108
function validateIntegerInput(e) {
94109
const reg = new RegExp(INTEGER_REGEX, 'g');
@@ -164,5 +179,20 @@
164179
/>
165180
</div>
166181
</div>
182+
183+
<div class="mb-3 row">
184+
<label for="example-text-input" class="col-md-3 col-form-label">
185+
Reasoning level
186+
</label>
187+
<div class="col-md-9">
188+
<Input type="select" value={config.reasoning_effort_level} on:change={e => changeReasoningEffortLevel(e)}>
189+
{#each reasonLevelOptions as option}
190+
<option value={option.value} selected={option.value == config.reasoning_effort_level}>
191+
{option.label}
192+
</option>
193+
{/each}
194+
</Input>
195+
</div>
196+
</div>
167197
</CardBody>
168198
</Card>

0 commit comments

Comments
 (0)