Skip to content

Dev #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 25 commits into from
May 30, 2025
Merged

Dev #72

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c953d08
analyzer for prompt assist
Khauneesh-AI May 5, 2025
8051687
added analyser files required for previous commit
Khauneesh-AI May 6, 2025
8eba3ec
pagination for list view for generation , evaluation and export
Khauneesh-AI May 7, 2025
1de8d30
test cases modified for pagination
Khauneesh-AI May 7, 2025
1953544
Initial Checkin for free form data generation
Apr 17, 2025
88da812
Merge pull request #67 from cloudera/kv-freeforms
Khauneesh-AI May 14, 2025
de1acd8
Merge branch 'dev' into dev-optimization
Khauneesh-AI May 14, 2025
8d9cbe6
Merge pull request #64 from cloudera/dev-optimization
Khauneesh-AI May 14, 2025
6f5a22b
Fix for SFT Examples Validation
May 14, 2025
2ab9dd8
Merge pull request #68 from cloudera/fix-examples-issue
Khauneesh-AI May 14, 2025
ba7a9ce
Fix for Examples Validation
May 15, 2025
d4d7df3
Merge pull request #69 from cloudera/fix-examples-validation
Khauneesh-AI May 15, 2025
0eec14e
build client with extended time limit for uv
Khauneesh-AI May 16, 2025
f7d1dc5
solving builc client bug
Khauneesh-AI May 19, 2025
c7e5363
project data null values as default for CDP
Khauneesh-AI May 19, 2025
3ac304f
changed status for CDP null token
Khauneesh-AI May 19, 2025
dbdf41c
model endpoints supported and health check for CAII
Khauneesh-AI May 22, 2025
1e40359
Changes for adding seed instructions
May 29, 2025
262115e
freeform and prompt enhancement UI chnages
Khauneesh-AI May 29, 2025
9455baa
New Templates
May 29, 2025
40518b3
Fix for Re-evaluate Action
May 30, 2025
4e9bcda
Merge pull request #71 from cloudera/new-templates-dev
Khauneesh-AI May 30, 2025
02d616b
increasing timeout for aws request
Khauneesh-AI May 30, 2025
a2b9184
Merge branch 'main' into dev
Khauneesh-AI May 30, 2025
ad60a7a
Update app/client/src/pages/DataGenerator/Configure.tsx
Khauneesh-AI May 30, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Initial Checkin for free form data generation
Add Free Form Workflow Type
Add Free From Prompt
Add use case for free form workflow type
Usecase fix for freeform
Show Seed Instructions for FreeForm
Ftech File Content
Add AG Grid
Add Modules
Add Themes
Adding FreeFormTable
Fix Examples Table for Freeform Dataset
Fix Dataset Details Page for Freeforms
Add Dataset Viewer
Hide Exmaples Buttons for Freeforms
Fix for Examples in Dataset Details Page (freeform)
Update Examples Message
Fix for very long seeds
Fix for Dataset Details Page
Fix for Freeform Table in Results Page

Adding Re-generate Dataset Changes

Add Evaluation for Freeforms

Fix for custom prompt modal

Fix Lint Errors
  • Loading branch information
Keivan Vosoughi committed May 14, 2025
commit 1953544467a83ef2fa9c6e98abcda17e30c8d681
1 change: 1 addition & 0 deletions app/client/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default tseslint.config(
'warn',
{ allowConstantExport: true },
],
'@typescript-eslint/no-explicit-any': ['warn', { 'fixToUnknown': true, 'ignoreRestArgs': false }]
},
},
)
2 changes: 2 additions & 0 deletions app/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"@mui/icons-material": "6.1.7",
"@mui/material": "6.1.7",
"@tanstack/react-query": "5.66.0",
"ag-grid-community": "33.2.4",
"ag-grid-react":"33.2.4",
"antd": "5.22.1",
"axios": "1.6.7",
"lodash": "4.17.21",
Expand Down
3 changes: 0 additions & 3 deletions app/client/src/Container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ const PageHeader = styled(Header)`
height: fit-content;
padding: 5px 15px
`;
const StyledImg = styled.img`
height: ${props => props?.height && `${props.height}px`}
`

const StyledText = styled.div`
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji';
Expand Down
11 changes: 7 additions & 4 deletions app/client/src/api/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ export const useFetchModels = (): UseFetchApiReturn<FetchModelsResp> => {
return useFetch(url);
}

export const useFetchDefaultPrompt = (useCase: string): UseFetchApiReturn<FetchDefaultPromptResp> => {
const url = `${baseUrl}/${isEmpty(useCase) ? 'custom' : useCase}/gen_prompt`;
export const useFetchDefaultPrompt = (useCase: string, workflowType?: WorkerType): UseFetchApiReturn<FetchDefaultPromptResp> => {
let url = `${baseUrl}/${isEmpty(useCase) ? 'custom' : useCase}/gen_prompt`;
if (workflowType && workflowType === 'freeform') {
url = `${baseUrl}/${isEmpty(useCase) ? 'custom' : useCase}/gen_freeform_prompt`;
}
return useFetch(url);
}

Expand All @@ -42,7 +45,7 @@ export const useFetchDefaultModelParams = (): UseFetchApiReturn<FetchDefaultPara
return useFetch(url);
}

export const useTriggerDatagen = <T>() => {
const genDatasetUrl = `${import.meta.env.VITE_AMP_URL}/synthesis/generate`;
export const useTriggerDatagen = <T>(workflow_type: string) => {
const genDatasetUrl = `${import.meta.env.VITE_AMP_URL}/synthesis/${workflow_type === 'freeform' ? 'freeform' : 'generate'}`;
return usePostApi<T>(genDatasetUrl);
}
4 changes: 2 additions & 2 deletions app/client/src/api/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,15 @@ interface UsePostApiReturn<T> {
data: T | null;
loading: boolean;
error: Error | null;
triggerPost: (body: Record<string, any>) => Promise<void>;
triggerPost: (body: Record<string, unknown>) => Promise<void>;
}

export function usePostApi<T>(url: string): UsePostApiReturn<T> {
const [data, setData] = useState<T | null>(null);
const [loading, setLoading] = useState(false);
const [error, setError] = useState<Error | null>(null);

const triggerPost = async (body: Record<string, any>) => {
const triggerPost = async (body: Record<string, unknown>) => {
setLoading(true);
setError(null); // Reset error on each request

Expand Down
2 changes: 1 addition & 1 deletion app/client/src/components/RouteAccessControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Navigate, useLocation } from "react-router-dom";
*/
interface RouteACProps{
element: ReactNode;
validator: (state: any | null) => boolean;
validator: (state: unknown | null) => boolean;
reroutePath?: string;
}
const RouteAccessControl: FC<RouteACProps> = ({ element, validator, reroutePath = '/' }) => {
Expand Down
6 changes: 3 additions & 3 deletions app/client/src/components/TelemetryDashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React, { useState, useEffect } from 'react';
import {
BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer,
LineChart, Line, AreaChart, Area
LineChart, Line
} from 'recharts';
import axios from 'axios';
import {
Card, Typography, Row, Col, Statistic, Select, Spin, Empty, Table, Tag, Tabs, Alert, Progress, Space, Badge, Button
} from 'antd';
import {
DashboardOutlined, ApiOutlined, CloudServerOutlined, RocketOutlined, SyncOutlined,
PieChartOutlined, BarChartOutlined, CodeOutlined, WarningOutlined, CheckCircleOutlined, CloseCircleOutlined
CodeOutlined, WarningOutlined, CheckCircleOutlined, CloseCircleOutlined
} from '@ant-design/icons';

const { Title, Text } = Typography;
Expand All @@ -19,7 +19,7 @@ const SUCCESS_COLOR = '#52c41a';
const ERROR_COLOR = '#f5222d';
const WARNING_COLOR = '#faad14';
const INFO_COLOR = '#1890ff';
const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042', '#8884d8', '#4CAF50', '#F44336', '#9C27B0'];
// const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042', '#8884d8', '#4CAF50', '#F44336', '#9C27B0'];

const TelemetryDashboard = () => {
const [loading, setLoading] = useState(true);
Expand Down
45 changes: 36 additions & 9 deletions app/client/src/pages/DataGenerator/Configure.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import endsWith from 'lodash/endsWith';
import isEmpty from 'lodash/isEmpty';
import isFunction from 'lodash/isFunction';
import { useEffect, useState } from 'react';
import { Flex, Form, Input, Select, Typography } from 'antd';
import styled from 'styled-components';
Expand All @@ -10,6 +11,7 @@ import { ModelProviders, ModelProvidersDropdownOpts } from './types';
import { useWizardCtx } from './utils';
import FileSelectorButton from './FileSelectorButton';


const StepContainer = styled(Flex)`
background: white;
padding: 40px 0px;
Expand All @@ -31,7 +33,8 @@ export const USECASE_OPTIONS = [

export const WORKFLOW_OPTIONS = [
{ label: 'Supervised Fine-Tuning', value: 'supervised-fine-tuning' },
{ label: 'Custom Data Generation', value: 'custom' }
{ label: 'Custom Data Generation', value: 'custom' },
{ label: 'Freefrom Data Generation', value: 'freeform' }
];

export const MODEL_TYPE_OPTIONS: ModelProvidersDropdownOpts = [
Expand All @@ -55,16 +58,23 @@ const Configure = () => {
delete values.output_value;

const allFieldsFilled = Object.values(values).every(value => Boolean(value));
if (allFieldsFilled) {
setIsStepValid && setIsStepValid(true)
} else {
setIsStepValid && setIsStepValid(false)
if (allFieldsFilled && isFunction(setIsStepValid)) {
setIsStepValid(true)
} else if (isFunction(setIsStepValid)) {
setIsStepValid(false)
}
}
useEffect(() => {
validateForm()
}, [form, formData])

// keivan
useEffect(() => {
if (formData && formData?.inference_type === undefined) {
form.setFieldValue('inference_type', ModelProviders.CAII);
}
}, [formData]);

const labelCol = {
span: 8
};
Expand All @@ -83,7 +93,7 @@ const Configure = () => {
form.setFieldValue('doc_paths', paths);
}

const onFilesChange = (selections: any) => {
const onFilesChange = (selections: unknown) => {
if (Array.isArray(selections) && !isEmpty(selections)) {
const paths = selections.map((file: File) => (
{
Expand All @@ -106,7 +116,6 @@ const Configure = () => {
setSelectedFiles([]);
}
}


return (
<StepContainer justify='center'>
Expand Down Expand Up @@ -209,7 +218,8 @@ const Configure = () => {
)}
</Select>
</Form.Item>
{formData?.workflow_type === WorkflowType.SUPERVISED_FINE_TUNING &&
{(formData?.workflow_type === WorkflowType.SUPERVISED_FINE_TUNING ||
formData?.workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION) &&
<Form.Item
name='use_case'
label='Template'
Expand All @@ -234,7 +244,7 @@ const Configure = () => {
formData?.workflow_type === WorkflowType.CUSTOM_DATA_GENERATION) &&
<Form.Item
name='doc_paths'
label='Files'
label='Context'
labelCol={labelCol}
dependencies={['workflow_type']}
shouldUpdate
Expand Down Expand Up @@ -319,6 +329,23 @@ const Configure = () => {
<Input />
</Form.Item>
</>}
{/* {formData?.workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION ||
<Form.Item
name='example_path'
label='Example File'
labelCol={labelCol}
dependencies={['workflow_type']}
shouldUpdate
validateTrigger="['onBlur','onChange']"
validateFirst
rules={[]}
>
<Flex>
<Select placeholder={'Select example file'} value={selectedFiles || []} onChange={onFilesChange} allowClear/>
<Input placeholder='Select example file' disabled />
<FileSelectorButton onAddFiles={onAddExampleFiles} workflowType={form.getFieldValue('workflow_type')} />
</Flex>
</Form.Item>} */}
</FormContainer>
</StepContainer>
)
Expand Down
40 changes: 31 additions & 9 deletions app/client/src/pages/DataGenerator/CustomPromptButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { Button, Flex, Form, Input, Modal, notification, Spin } from "antd";
import { Button, Form, Input, Modal, notification } from "antd";
import { useEffect, useState } from "react";
import { useMutation } from "@tanstack/react-query";
import styled from "styled-components";
import { LoadingOutlined } from '@ant-design/icons';
import { fetchCustomPrompt, fetchPrompt } from "./hooks";
import { fetchCustomPrompt } from "./hooks";
import Loading from "../Evaluator/Loading";

interface Props {
Expand All @@ -16,9 +15,30 @@ interface Props {

export const StyledTextArea = styled(Input.TextArea)`
margin-bottom: 10px !important;
min-height: 175px !important;
min-height: 275px !important;
margin-bottom: 10px !important;
padding: 15px 20px !important;
`;

const StyledModal = styled(Modal)`
.ant-modal-content {
max-height: 90vh;
// height: 760px;
height: 85vh;
width: 750px;
.ant-modal-body {
padding-top: 0;
min-height: 70vh;
}
}
// .ant-modal-content {
// border-radius: 8px;
// box-shadow: 0px 4px 16px rgba(0, 0, 0, 0.1);
// background-color: #ffffff;
// padding: 24px;
// }
`

const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_endpoint, use_case, setPrompt }) => {
const [form] = Form.useForm();
const [showModal, setShowModal] = useState(false);
Expand All @@ -39,7 +59,7 @@ const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_en
setShowModal(false);
}
}, [mutation.error, mutation.isSuccess]);

const onFinish = async () => {
const custom_prompt = form.getFieldValue('custom_prompt_instructions');
try {
Expand Down Expand Up @@ -67,7 +87,7 @@ const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_en
<Button onClick={() => setShowModal(true)} style={{ marginLeft: '8px' }}>Generate Custom Prompt</Button>
{showModal &&
(
<Modal
<StyledModal
visible={showModal}
okText={`Generate`}
title={`Generate Cutom Prompt`}
Expand All @@ -80,16 +100,18 @@ const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_en
initialValues={initialValues}
onFinish={onSubmit}
style={{ marginTop: '24px' }}
disabled={mutation.isLoading}
disabled={mutation.isPending}
>
{mutation.isLoading &&
{mutation.isPending &&
<Loading />
}

<Form.Item
name='custom_prompt_instructions'
label='Custom Prompt Instructions'
rules={[{ required: true, message: "This field is required." }]}
labelCol={{ span: 24 }}
wrapperCol={{ span: 24 }}
>
<StyledTextArea
autoSize
Expand All @@ -98,7 +120,7 @@ const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_en
</Form.Item>
</Form>

</Modal>
</StyledModal>
)
}
</>
Expand Down
17 changes: 14 additions & 3 deletions app/client/src/pages/DataGenerator/DataGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import isEmpty from 'lodash/isEmpty';
import isString from 'lodash/isString';
import { useRef, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { Button, Flex, Form, Layout, Steps, Typography } from 'antd';
import { Button, Flex, Form, Layout, Steps } from 'antd';
import type { FormInstance } from 'antd';
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
import ArrowForwardIcon from '@mui/icons-material/ArrowForward';
Expand All @@ -17,6 +17,7 @@ import Finish from './Finish';

import { DataGenWizardSteps, WizardStepConfig, WorkflowType } from './types';
import { WizardCtx } from './utils';
import { useGetDatasetDetails } from '../DatasetDetails/hooks';

const { Content } = Layout;
// const { Title } = Typography;
Expand Down Expand Up @@ -98,10 +99,14 @@ const DataGenerator = () => {
const [isStepValid, setIsStepValid] = useState<boolean>(false);
// Data passed from listing table to prepopulate form
const location = useLocation();
console.log('DatGenerator >> location?.state?.data:', location?.state?.data);
console.log('location?.state?.data:', location?.state?.data);
Copy link
Preview

Copilot AI May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove or replace this debugging console.log with proper error handling or logging before merging.

Copilot uses AI. Check for mistakes.

const initialData = location?.state?.data;

const datasetDetailsReq = location?.state?.data && useGetDatasetDetails(location?.state?.data?.generate_file_name)
Copy link
Preview

Copilot AI May 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling a hook (useGetDatasetDetails) conditionally can break the Rules of Hooks. Invoke the hook unconditionally and branch on its result instead.

Suggested change
const datasetDetailsReq = location?.state?.data && useGetDatasetDetails(location?.state?.data?.generate_file_name)
const datasetDetailsReq = useGetDatasetDetails(location?.state?.data?.generate_file_name || null);

Copilot uses AI. Check for mistakes.

if (initialData?.technique) {
initialData.workflow_type = initialData?.technique === 'sft' ? WorkflowType.SUPERVISED_FINE_TUNING :
initialData.workflow_type = initialData?.technique === 'sft' ?
WorkflowType.SUPERVISED_FINE_TUNING :
initialData?.technique === 'freeform' ? WorkflowType.FREE_FORM_DATA_GENERATION :
WorkflowType.CUSTOM_DATA_GENERATION;
}
if (Array.isArray(initialData?.doc_paths) && !isEmpty(initialData?.doc_paths) ) {
Expand All @@ -111,6 +116,12 @@ const DataGenerator = () => {
}));

}

// if (datasetDetailsReq && datasetDetailsReq.data &&
// !isEmpty(datasetDetailsReq?.data?.generate_file_name)) {
// initialData.example_path = initialData?.example_path;
// }

if (Array.isArray(initialData?.input_paths) && !isEmpty(initialData?.input_paths) ) {
initialData.doc_paths = initialData?.input_paths.map((path: string) => ({
value: path,
Expand Down
Loading