Skip to content

Commit 54f0350

Browse files
authored
Merge pull request #72 from cloudera/dev
Evaluate button in top section is disabled always (now it is fixed) Re-evaluate does not work properly The AiAssitant icon has been added for the Generate Custom Prompt button and the position is moved to the top right MaxToken has been removed from Parameters section. -Examples & Prompt for Dataset Generator Wizard is swapped -For the Seed Instructions users can enter multi line seeds and new line will not be removed -For the Success view of the Dataset Generation the Topics tabbed/table view will have the popover to display the whole seed instruction -For the custom prompt generation if the examples file has been uploaded will be used to generate the custom prompt -Minor improvements for the Generate Custom Prompt Modal
2 parents 64655a2 + ad60a7a commit 54f0350

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+3073
-786
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata.db
44
document_upload
55
test.json
66
cml_test.ipynb
7+
practice.ipynb
78
/app/khauneesh_test.ipynb
89
.env
910
*.pyc

.project-metadata.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ environment_variables:
3434
default: null
3535
description: >-
3636
API key for Cloudera AI Inference
37-
38-
39-
40-
4137
4238
# runtimes
4339
runtimes:

app/client/eslint.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default tseslint.config(
2323
'warn',
2424
{ allowConstantExport: true },
2525
],
26+
'@typescript-eslint/no-explicit-any': ['warn', { 'fixToUnknown': true, 'ignoreRestArgs': false }]
2627
},
2728
},
2829
)

app/client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
"@mui/icons-material": "6.1.7",
1717
"@mui/material": "6.1.7",
1818
"@tanstack/react-query": "5.66.0",
19+
"ag-grid-community": "33.2.4",
20+
"ag-grid-react":"33.2.4",
1921
"antd": "5.22.1",
2022
"axios": "1.6.7",
2123
"lodash": "4.17.21",

app/client/src/Container.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,6 @@ const PageHeader = styled(Header)`
4848
height: fit-content;
4949
padding: 5px 15px
5050
`;
51-
const StyledImg = styled.img`
52-
height: ${props => props?.height && `${props.height}px`}
53-
`
5451

5552
const StyledText = styled.div`
5653
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';

app/client/src/api/Datasets/response.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { PaginatedResponse } from '../common/pagination';
2+
13
export type DatasetResponse = {
24
id: number;
35
timestamp: string;
@@ -37,14 +39,17 @@ export type Example = {
3739

3840
export type DeleteDatasetResponse = {
3941
message: string;
40-
};
42+
};
4143

42-
export type ExportDatasetResponse = {
44+
export type ExportDatasetResponse = {
4345
message: Partial<ExportMessageSuccessResponse>;
44-
};
46+
};
4547

46-
export type ExportMessageSuccessResponse = {
48+
export type ExportMessageSuccessResponse = {
4749
job_name: string;
4850
job_id: string;
4951
hf_link: string;
50-
};
52+
};
53+
54+
// Add paginated response types
55+
export type PaginatedDatasetsResponse = PaginatedResponse<DatasetResponse>;

app/client/src/api/Evaluations/response.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { PaginatedResponse } from '../common/pagination';
2+
13
export type EvaluationResponse = {
24
id: string;
35
timestamp: Date;
@@ -16,21 +18,24 @@ export type EvaluationResponse = {
1618
job_id: string;
1719
job_name: string;
1820
job_status: string;
19-
};
21+
};
2022

21-
export type DeleteEvaluationResponse = {
23+
export type DeleteEvaluationResponse = {
2224
message: string;
23-
};
25+
};
2426

25-
export type ModelParameters = {
27+
export type ModelParameters = {
2628
temperature: number;
2729
top_p: number;
2830
min_p: number;
2931
top_k: number;
3032
max_tokens: number;
31-
}
33+
};
3234

33-
export type Example = {
35+
export type Example = {
3436
score: number;
3537
justification: string;
36-
}
38+
};
39+
40+
// Add paginated response types
41+
export type PaginatedEvaluationsResponse = PaginatedResponse<EvaluationResponse>;
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useQuery } from "@tanstack/react-query";
2-
import { ExportResponse } from "./response";
2+
import { ExportResponse, PaginatedExportsResponse } from "./response";
33

44
const BASE_API_URL = import.meta.env.VITE_AMP_URL;
55
const REFETCHINTERVAL_IN_MS = 10000;
@@ -8,11 +8,11 @@ export const API_ENDPOINTS = {
88
getExports: `${BASE_API_URL}/exports/history`,
99
};
1010

11-
async function getExportJobs(): Promise<ExportResponse[]> {
11+
async function getExportJobs(page = 1, pageSize = 10): Promise<PaginatedExportsResponse> {
1212
let response;
1313

1414
try {
15-
response = await fetch(API_ENDPOINTS.getExports);
15+
response = await fetch(`${API_ENDPOINTS.getExports}?page=${page}&page_size=${pageSize}`);
1616

1717
if (!response.ok) {
1818
return Promise.reject(response.statusText);
@@ -21,13 +21,17 @@ async function getExportJobs(): Promise<ExportResponse[]> {
2121
return Promise.reject(error);
2222
}
2323

24-
const exportResponse: ExportResponse[] = await response.json();
24+
const exportResponse = await response.json();
2525
return exportResponse;
2626
};
2727

28-
29-
const useGetExportJobs = () => {
30-
return useQuery({ queryKey: [`${API_ENDPOINTS.getExports}`], refetchIntervalInBackground: true, refetchInterval: REFETCHINTERVAL_IN_MS, queryFn: getExportJobs })
28+
const useGetExportJobs = (page = 1, pageSize = 10) => {
29+
return useQuery<PaginatedExportsResponse>({
30+
queryKey: [`${API_ENDPOINTS.getExports}`, page, pageSize],
31+
queryFn: () => getExportJobs(page, pageSize),
32+
refetchIntervalInBackground: true,
33+
refetchInterval: REFETCHINTERVAL_IN_MS
34+
});
3135
};
3236

3337
export { useGetExportJobs };

app/client/src/api/Export/response.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ export interface ExportResponse {
1010
job_status: JobStatus;
1111
local_export_path: string;
1212
timestamp: string;
13-
}
13+
};
14+
15+
// Add paginated response types
16+
export type PaginatedExportsResponse = PaginatedResponse<ExportResponse>;

app/client/src/api/api.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ export const useFetchModels = (): UseFetchApiReturn<FetchModelsResp> => {
2727
return useFetch(url);
2828
}
2929

30-
export const useFetchDefaultPrompt = (useCase: string): UseFetchApiReturn<FetchDefaultPromptResp> => {
31-
const url = `${baseUrl}/${isEmpty(useCase) ? 'custom' : useCase}/gen_prompt`;
30+
export const useFetchDefaultPrompt = (useCase: string, workflowType?: WorkerType): UseFetchApiReturn<FetchDefaultPromptResp> => {
31+
let url = `${baseUrl}/${isEmpty(useCase) ? 'custom' : useCase}/gen_prompt`;
32+
if (workflowType && workflowType === 'freeform') {
33+
url = `${baseUrl}/${isEmpty(useCase) ? 'custom' : useCase}/gen_freeform_prompt`;
34+
}
3235
return useFetch(url);
3336
}
3437

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

45-
export const useTriggerDatagen = <T>() => {
46-
const genDatasetUrl = `${import.meta.env.VITE_AMP_URL}/synthesis/generate`;
48+
export const useTriggerDatagen = <T>(workflow_type: string) => {
49+
const genDatasetUrl = `${import.meta.env.VITE_AMP_URL}/synthesis/${workflow_type === 'freeform' ? 'freeform' : 'generate'}`;
4750
return usePostApi<T>(genDatasetUrl);
4851
}

0 commit comments

Comments
 (0)