Skip to content

Commit f01d1bc

Browse files
authored
Release SDS-1-0-2
-Seed Instruction Upload via JSON (List Format) —Users can now upload multiple seed instructions as a list within a JSON file, replacing the earlier manual entry process. This significantly reduces time and effort, especially when working with large or complex datasets. -Dynamic Rendering of Seed Instructions —Upon uploading a JSON file, the seed instructions are now automatically rendered in the UI, allowing users to review the pre-filled data in real time. -Flexible Seed Management Users still retain full control over the seed data — they can edit, remove, or add new instructions directly from the interface even after uploading a file. -Enhanced Prompt Generation with AI Assistance —The Generate Prompt feature has been upgraded with: A new AI Assistant icon to generate intelligent prompts based on the uploaded examples and instructions. —A Restore icon that enables users to revert to their previously generated or edited prompt, offering more flexibility and iteration during prompt crafting. -Schema-aware Prompt Synthesis —The AI-assisted prompt generation leverages user-provided examples and instructions to produce a context-aware prompt. This ensures that the generated prompt is well-aligned with the schema of the sample data, improving the relevance and consistency of the generated output. —Stability Improvements and Bug Fixes Addressed and resolved intermittent errors experienced during example uploads. These fixes enhance overall reliability and provide a smoother, uninterrupted user experience.
2 parents 394dce6 + 0ec824c commit f01d1bc

26 files changed

+1697
-243
lines changed

.github/workflows/python-app.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,25 +14,30 @@ jobs:
1414
python-version: ["3.10"]
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818

1919
- name: Set up Python ${{ matrix.python-version }}
20-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v4
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24-
- name: Install dependencies
24+
# ---------- install uv -------------------------------------------------
25+
- name: Install uv (fast dependency resolver)
2526
run: |
26-
python -m pip install --upgrade pip
27-
pip install pytest pytest-asyncio pytest-cov requests-mock boto3 moto
28-
pip install -r requirements.txt
27+
python -m pip install --upgrade pip uv
2928
29+
# ---------- reproduce locked env --------------------------------------
30+
- name: Sync project dependencies from uv.lock
31+
run: |
32+
uv sync
33+
34+
# ---------- run test suite -----------------------------------
3035
- name: Run tests and generate coverage report
3136
run: |
32-
pytest tests/ --cov=app --cov-report=xml
37+
uv run pytest tests/ --cov=app --cov-report=xml
3338
3439
- name: Upload coverage report as an artifact
3540
uses: actions/upload-artifact@v4
3641
with:
3742
name: coverage-report
38-
path: coverage.xml
43+
path: coverage.xml

.gitignore

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,13 @@ app/frontend/
7474
app/launch_streamlit.py
7575

7676
# Virtual environment
77-
.venv/
77+
.venv/freeform_data_claude_*
78+
row_data_claude_*
79+
freeform_data_claude_*
80+
housing_example.json
81+
seeds_test.json
82+
test.csv
83+
sample_200x100.csv
84+
Raw_Web_Visit_sample.csv
85+
Raw_Web_Visit_Sample.csv
86+
Raw_Web_Visit_Sample.csv

.project-metadata.yaml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,37 @@ date: "2024-10-30"
1111

1212
environment_variables:
1313
AWS_ACCESS_KEY_ID:
14-
default: "your access key"
14+
default: null
1515
description: >-
1616
AWS Key ID. Check the Amazon Bedrock documentation for information about role access
1717
AWS_SECRET_ACCESS_KEY:
18-
default: "your secret access key"
18+
default: null
1919
description: >-
2020
AWS Secret Key
2121
AWS_DEFAULT_REGION:
2222
default: "us-east-1"
2323
description: >-
2424
AWS region
2525
hf_token:
26-
default: "hf_token"
26+
default: null
2727
description: >-
2828
your huggingface token
2929
hf_username:
30-
default: "hf_username"
30+
default: null
3131
description: >-
3232
your huggingface username
3333
CDP_TOKEN:
3434
default: null
3535
description: >-
3636
API key for Cloudera AI Inference
37-
37+
OPENAI_API_KEY:
38+
default: null
39+
description: >-
40+
OpenAI API Key. Check the OpenAI documentation for information about role access
41+
GEMINI_API_KEY:
42+
default: null
43+
description: >-
44+
Gemini API Key. Check the Google Gemini documentation for information about role access
3845
# runtimes
3946
runtimes:
4047
- editor: JupyterLab

app/client/.eslintrc.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"rules": {
3+
"@typescript-eslint/no-explicit-any": "warn"
4+
}
5+
}

app/client/src/Container.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,15 @@ const StyledText = styled.div`
5555
font-weight: normal;
5656
`;
5757

58+
const StyledSection = styled.div`
59+
margin-left: 24px;
60+
color: #adb2b6;
61+
flex-grow: 1;
62+
font-family: Roboto Mono, monospace;
63+
font-size: 12px;
64+
overflow: hidden;
65+
`;
66+
5867
const pages: MenuItem[] = [
5968
{
6069
key: Pages.HOME,
@@ -96,6 +105,11 @@ const pages: MenuItem[] = [
96105
<span style={{ marginLeft: '4px' }}>Join the discussion on GitHub</span>
97106
</a>
98107
</div>
108+
<Flex justify='center' align='center' vertical style={{ marginTop: '12px' }}>
109+
<StyledSection>
110+
{`SDS-1.0.2`}
111+
</StyledSection>
112+
</Flex>
99113
</Flex>
100114
<br/>
101115
</div>

app/client/src/pages/DataGenerator/CustomPromptButton.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import styled from "styled-components";
55
import { fetchCustomPrompt } from "./hooks";
66
import Loading from "../Evaluator/Loading";
77
import AiAssistantIcon from "./AiAssistantIcon";
8+
import { isEmpty } from "lodash";
89

910
interface Props {
1011
model_id: string;
@@ -56,11 +57,18 @@ const StyledIcon = styled.div`
5657
const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_endpoint, use_case, example_path, setPrompt }) => {
5758
const [form] = Form.useForm();
5859
const [showModal, setShowModal] = useState(false);
60+
const [disabled, setDisabled] = useState(false);
61+
const custom_prompt_instructions = Form.useWatch('custom_prompt_instructions', { form, preserve: true });
62+
console.log('custom_prompt_instructions', custom_prompt_instructions);
5963

6064
const mutation = useMutation({
6165
mutationFn: fetchCustomPrompt
6266
});
6367

68+
useEffect(() => {
69+
setDisabled(isEmpty(custom_prompt_instructions));
70+
}, [custom_prompt_instructions]);
71+
6472
useEffect(() => {
6573
if (mutation.isError) {
6674
notification.error({
@@ -112,12 +120,13 @@ const CustomPromptButton: React.FC<Props> = ({ model_id, inference_type, caii_en
112120
okText={`Generate`}
113121
title={`Generate Custom Prompt`}
114122
onClose={() => setShowModal(false)}
123+
onCancel={() => setShowModal(false)}
115124
footer={
116125
<Row>
117126
<Col sm={12} />
118127
<Col sm={12}>
119128
<StyledFlex key="footer-right">
120-
<Button type="primary" style={{ marginLeft: '12px' }} disabled={mutation.isPending} onClick={() => onFinish()}>{'Generate Custom Prompt'}</Button>
129+
<Button type="primary" style={{ marginLeft: '12px' }} disabled={mutation.isPending || disabled} onClick={() => onFinish()}>{'Generate Custom Prompt'}</Button>
121130
<Button disabled={mutation.isPending} style={{ marginLeft: '12px' }} onClick={() => setShowModal(false)}>{'Cancel'}</Button>
122131
</StyledFlex>
123132
</Col>

app/client/src/pages/DataGenerator/DataGenerator.tsx

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import isEmpty from 'lodash/isEmpty';
22
import isString from 'lodash/isString';
3-
import { useRef, useState } from 'react';
4-
import { useLocation } from 'react-router-dom';
3+
import { useEffect, useRef, useState } from 'react';
4+
import { useLocation, useParams } from 'react-router-dom';
5+
56
import { Button, Flex, Form, Layout, Steps } from 'antd';
67
import type { FormInstance } from 'antd';
78
import ArrowBackIcon from '@mui/icons-material/ArrowBack';
@@ -17,7 +18,8 @@ import Finish from './Finish';
1718

1819
import { DataGenWizardSteps, WizardStepConfig, WorkflowType } from './types';
1920
import { WizardCtx } from './utils';
20-
import { useGetDatasetDetails } from '../DatasetDetails/hooks';
21+
import { fetchDatasetDetails, useGetDatasetDetails } from '../DatasetDetails/hooks';
22+
import { useMutation } from '@tanstack/react-query';
2123

2224
const { Content } = Layout;
2325
// const { Title } = Typography;
@@ -97,12 +99,30 @@ const DataGenerator = () => {
9799
const [current, setCurrent] = useState(0);
98100
const [maxStep, setMaxStep] = useState(0);
99101
const [isStepValid, setIsStepValid] = useState<boolean>(false);
102+
100103
// Data passed from listing table to prepopulate form
101104
const location = useLocation();
102-
console.log('location?.state?.data:', location?.state?.data);
105+
const { generate_file_name } = useParams();
103106
const initialData = location?.state?.data;
107+
const mutation = useMutation({
108+
mutationFn: fetchDatasetDetails
109+
});
110+
111+
112+
useEffect(() => {
113+
if (generate_file_name && !mutation.data) {
114+
mutation.mutate(generate_file_name);
115+
}
116+
if (mutation.data && mutation?.data?.dataset) {
117+
form.setFieldsValue({
118+
...initialData,
119+
...(mutation?.data?.dataset as any)
120+
});
121+
}
122+
123+
}, [generate_file_name]);
124+
104125

105-
const datasetDetailsReq = location?.state?.data && useGetDatasetDetails(location?.state?.data?.generate_file_name)
106126
if (initialData?.technique) {
107127
initialData.workflow_type = initialData?.technique === 'sft' ?
108128
WorkflowType.SUPERVISED_FINE_TUNING :

app/client/src/pages/DataGenerator/Finish.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ const Finish = () => {
132132

133133
const isDemo = isDemoMode(num_questions, topics, form);
134134

135-
useEffect(() => {
135+
useEffect(() => {
136136
const formValues = form.getFieldsValue(true);
137+
137138
const doc_paths = formValues.doc_paths;
138139
if (Array.isArray(doc_paths) && !isEmpty(doc_paths)) {
139140
if (formValues.workflow_type === WorkflowType.SUPERVISED_FINE_TUNING) {
@@ -178,10 +179,12 @@ const Finish = () => {
178179
}
179180

180181
if (formValues.workflow_type === WorkflowType.FREE_FORM_DATA_GENERATION) {
182+
formValues.example_custom = formValues.examples;
181183
delete formValues.examples;
182184
}
183185

184186
const args = {...formValues, is_demo: isDemo, model_params: formValues.model_parameters }
187+
console.log('Triggering data generation with args:', args);
185188
triggerPost(args)
186189
}, []);
187190

0 commit comments

Comments
 (0)