fix(ui/): add langsmith sampling rate

Closes LIT-879
This commit is contained in:
Krrish Dholakia
2025-09-19 18:43:48 -07:00
parent dec15a80a2
commit 2a827c515a
2 changed files with 30 additions and 8 deletions
@@ -46,7 +46,7 @@ const asset_logos_folder = '/ui/assets/logos/';
interface CallbackInfo {
logo: string;
supports_key_team_logging: boolean;
dynamic_params: Record<string, "text" | "password" | "select" | "upload">;
dynamic_params: Record<string, "text" | "password" | "select" | "upload" | "number">;
description: string | null;
}
@@ -86,7 +86,8 @@ export const callbackInfo: Record<string, CallbackInfo> = {
dynamic_params: {
"langsmith_api_key": "password",
"langsmith_project": "text",
"langsmith_base_url": "text"
"langsmith_base_url": "text",
"langsmith_sampling_rate": "number"
},
description: "Langsmith Logging Integration"
},
@@ -6,6 +6,7 @@ import { InfoCircleOutlined } from '@ant-design/icons';
import { Button, Card, TextInput } from '@tremor/react';
import { PlusIcon, TrashIcon, CogIcon, BanIcon } from '@heroicons/react/outline';
import { callbackInfo, Callbacks, callback_map, mapDisplayToInternalNames } from '../callback_info_helpers';
import NumericalInput from '../shared/numerical_input';
const { Option } = Select;
@@ -126,13 +127,33 @@ const LoggingSettings: React.FC<LoggingSettingsProps> = ({
Sensitive
</span>
)}
{paramType === 'number' && (
<span className="inline-flex items-center px-2 py-0.5 rounded text-xs font-medium bg-yellow-100 text-yellow-800">
Number
</span>
)}
</label>
<TextInput
type={paramType === 'password' ? 'password' : 'text'}
placeholder={`os.environ/${paramName.toUpperCase()}`}
value={config.callback_vars[paramName] || ''}
onChange={(e) => updateCallbackVar(configIndex, paramName, e.target.value)}
/>
{paramType === 'number' && (
<span className="text-xs text-gray-500">
Value must be between 0 and 1
</span>
)}
{paramType === 'number' ? (
<NumericalInput
step={0.01}
width={400}
placeholder={`os.environ/${paramName.toUpperCase()}`}
value={config.callback_vars[paramName] || ''}
onChange={(e: any) => updateCallbackVar(configIndex, paramName, e.target.value)}
/>
) : (
<TextInput
type={paramType === 'password' ? 'password' : 'text'}
placeholder={`os.environ/${paramName.toUpperCase()}`}
value={config.callback_vars[paramName] || ''}
onChange={(e) => updateCallbackVar(configIndex, paramName, e.target.value)}
/>
)}
</div>
))}
</div>