Skip to content

Commit

Permalink
✨ (model-choice-group.tsx): Introduce AnalysisModel enum and update m…
Browse files Browse the repository at this point in the history
…odel values to use
  • Loading branch information
romantech committed Apr 5, 2024
1 parent 41b29b8 commit b3250fc
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,21 @@ import { Control, Controller } from 'react-hook-form';

import {
AnalysisFormValues,
GPT_3_DECREMENT_COUNT,
AnalysisModel,
GPT_3_5_DECREMENT_COUNT,
GPT_4_DECREMENT_COUNT,
} from '@/features/syntax-analyzer';

const MODEL_FIELDS = [
{
value: 'gpt-3.5-turbo',
label: 'GPT-3.5 (Fine-tuned)',
value: AnalysisModel.GPT_3_5_FT,
label: 'GPT-3.5 (Fine-Tuned)',
desc: '정확도는 GPT 4와 비슷하거나 다소 낮지만 속도가 빨라요',
count: GPT_3_DECREMENT_COUNT,
count: GPT_3_5_DECREMENT_COUNT,
recommend: true,
},
{
value: 'gpt-4',
value: AnalysisModel.GPT_4,
label: 'GPT-4',
desc: '정확도는 높지만 속도가 느려요',
count: GPT_4_DECREMENT_COUNT,
Expand Down
7 changes: 6 additions & 1 deletion src/features/syntax-analyzer/constants/settings.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const DAILY_ANALYSIS_LIMIT = 10;

export const GPT_4_DECREMENT_COUNT = 5;
export const GPT_3_DECREMENT_COUNT = 1;
export const GPT_3_5_DECREMENT_COUNT = 1;

export const MAX_TOPIC_ADDITION = 3;
export const DAILY_SENTENCE_LIMIT = 20;
Expand All @@ -15,3 +15,8 @@ export const DEFAULT_PICKER_COUNT = 3;

export const MAX_SENTENCE_LENGTH = 80;
export const MIN_SENTENCE_WORDS = 3;

export enum AnalysisModel {
GPT_3_5_FT = 'gpt-3.5-ft',
GPT_4 = 'gpt-4',
}
2 changes: 1 addition & 1 deletion src/features/syntax-analyzer/hooks/use-analysis-form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
tokenizer,
} from '@/base';
import {
AnalysisModel,
createAnalysisFormSchema,
REMAINING_COUNT_BASE_KEY,
type RemainingCountResponse as PlaceholderData,
Expand All @@ -19,7 +20,6 @@ import {
import { updateAnalysisMetaData } from '@/features/syntax-editor';
import { getSyntaxEditorPath } from '@/routes';

export type AnalysisModel = 'gpt-3.5-turbo' | 'gpt-4';
export type AnalysisFormValues = { model: AnalysisModel; sentence: string };

const placeholderData: PlaceholderData = { analysis: 0, random_sentence: 0 };
Expand Down
4 changes: 2 additions & 2 deletions src/features/syntax-analyzer/schemes/analysis-form-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const addSentenceFormSchema = yup.object({
export const createAnalysisFormSchema = yup.object({
model: yup
.mixed<AnalysisModel>()
.oneOf(['gpt-3.5-turbo', 'gpt-4'])
.default('gpt-3.5-turbo'),
.oneOf(Object.values(AnalysisModel))
.default(AnalysisModel.GPT_3_5_FT),
sentence: englishSentenceSchema.ensure(),
});

0 comments on commit b3250fc

Please sign in to comment.