feat: Add support for the temperature field (#11554)
<img width="460" alt="Screenshot 2025-05-22 at 3 10 22 PM" src="https://github.com/user-attachments/assets/e1c6bbd7-cd28-4808-99cb-ebc322531987" /> This is a stop-gap solution.
This commit is contained in:
@@ -42,6 +42,7 @@ const initialState = {
|
|||||||
conversationFaqs: false,
|
conversationFaqs: false,
|
||||||
memories: false,
|
memories: false,
|
||||||
},
|
},
|
||||||
|
temperature: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
const state = reactive({ ...initialState });
|
const state = reactive({ ...initialState });
|
||||||
@@ -87,6 +88,7 @@ const updateStateFromAssistant = assistant => {
|
|||||||
conversationFaqs: config.feature_faq || false,
|
conversationFaqs: config.feature_faq || false,
|
||||||
memories: config.feature_memory || false,
|
memories: config.feature_memory || false,
|
||||||
};
|
};
|
||||||
|
state.temperature = config.temperature || 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleBasicInfoUpdate = async () => {
|
const handleBasicInfoUpdate = async () => {
|
||||||
@@ -136,6 +138,7 @@ const handleInstructionsUpdate = async () => {
|
|||||||
const payload = {
|
const payload = {
|
||||||
config: {
|
config: {
|
||||||
...props.assistant.config,
|
...props.assistant.config,
|
||||||
|
temperature: state.temperature || 1,
|
||||||
instructions: state.instructions,
|
instructions: state.instructions,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -212,7 +215,7 @@ watch(
|
|||||||
|
|
||||||
<!-- Instructions Section -->
|
<!-- Instructions Section -->
|
||||||
<Accordion :title="t('CAPTAIN.ASSISTANTS.FORM.SECTIONS.INSTRUCTIONS')">
|
<Accordion :title="t('CAPTAIN.ASSISTANTS.FORM.SECTIONS.INSTRUCTIONS')">
|
||||||
<div class="flex flex-col gap-4 pt-4">
|
<div class="flex flex-col gap-4">
|
||||||
<Editor
|
<Editor
|
||||||
v-model="state.instructions"
|
v-model="state.instructions"
|
||||||
:placeholder="t('CAPTAIN.ASSISTANTS.FORM.INSTRUCTIONS.PLACEHOLDER')"
|
:placeholder="t('CAPTAIN.ASSISTANTS.FORM.INSTRUCTIONS.PLACEHOLDER')"
|
||||||
@@ -221,6 +224,25 @@ watch(
|
|||||||
:message-type="formErrors.instructions ? 'error' : 'info'"
|
:message-type="formErrors.instructions ? 'error' : 'info'"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<div class="flex flex-col gap-2 mt-4">
|
||||||
|
<label class="text-sm font-medium text-n-slate-12">
|
||||||
|
{{ t('CAPTAIN.ASSISTANTS.FORM.TEMPERATURE.LABEL') }}
|
||||||
|
</label>
|
||||||
|
<div class="flex items-center gap-4">
|
||||||
|
<input
|
||||||
|
v-model="state.temperature"
|
||||||
|
type="range"
|
||||||
|
min="0"
|
||||||
|
max="1"
|
||||||
|
step="0.1"
|
||||||
|
class="w-full"
|
||||||
|
/>
|
||||||
|
<span class="text-sm text-n-slate-12">{{ state.temperature }}</span>
|
||||||
|
</div>
|
||||||
|
<p class="text-sm text-n-slate-11 italic">
|
||||||
|
{{ t('CAPTAIN.ASSISTANTS.FORM.TEMPERATURE.DESCRIPTION') }}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
<div class="flex justify-end">
|
<div class="flex justify-end">
|
||||||
<Button
|
<Button
|
||||||
size="small"
|
size="small"
|
||||||
|
|||||||
@@ -367,7 +367,6 @@
|
|||||||
"CANCEL_ANYTIME": "You can change or cancel your plan anytime"
|
"CANCEL_ANYTIME": "You can change or cancel your plan anytime"
|
||||||
},
|
},
|
||||||
"ENTERPRISE_PAYWALL": {
|
"ENTERPRISE_PAYWALL": {
|
||||||
"AVAILABLE_ON": "Captain AI feature is only available in a paid plan.",
|
|
||||||
"UPGRADE_PROMPT": "Upgrade your plan to get access to our assistants, copilot and more.",
|
"UPGRADE_PROMPT": "Upgrade your plan to get access to our assistants, copilot and more.",
|
||||||
"ASK_ADMIN": "Please reach out to your administrator for the upgrade."
|
"ASK_ADMIN": "Please reach out to your administrator for the upgrade."
|
||||||
},
|
},
|
||||||
@@ -410,6 +409,10 @@
|
|||||||
"PLACEHOLDER": "Enter assistant name",
|
"PLACEHOLDER": "Enter assistant name",
|
||||||
"ERROR": "The name is required"
|
"ERROR": "The name is required"
|
||||||
},
|
},
|
||||||
|
"TEMPERATURE": {
|
||||||
|
"LABEL": "Response Temperature",
|
||||||
|
"DESCRIPTION": "Adjust how creative or restrictive the assistant's responses should be. Lower values produce more focused and deterministic responses, while higher values allow for more creative and varied outputs."
|
||||||
|
},
|
||||||
"DESCRIPTION": {
|
"DESCRIPTION": {
|
||||||
"LABEL": "Description",
|
"LABEL": "Description",
|
||||||
"PLACEHOLDER": "Enter assistant description",
|
"PLACEHOLDER": "Enter assistant description",
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class Api::V1::Accounts::Captain::AssistantsController < Api::V1::Accounts::Base
|
|||||||
config: [
|
config: [
|
||||||
:product_name, :feature_faq, :feature_memory,
|
:product_name, :feature_faq, :feature_memory,
|
||||||
:welcome_message, :handoff_message, :resolution_message,
|
:welcome_message, :handoff_message, :resolution_message,
|
||||||
:instructions
|
:instructions, :temperature
|
||||||
])
|
])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,8 @@ module Captain::ChatHelper
|
|||||||
model: @model,
|
model: @model,
|
||||||
messages: @messages,
|
messages: @messages,
|
||||||
tools: @tool_registry&.registered_tools || [],
|
tools: @tool_registry&.registered_tools || [],
|
||||||
response_format: { type: 'json_object' }
|
response_format: { type: 'json_object' },
|
||||||
|
temperature: @assistant&.config&.[]('temperature').to_f || 1
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user