Skip to content

Commit

Permalink
Fix "fine-tune-results" being an file upload type option
Browse files Browse the repository at this point in the history
  • Loading branch information
abrenneke committed Feb 16, 2024
1 parent 2823734 commit 51a57d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/src/plugins/openai/nodes/UploadFileNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {
import { newId, dedent, getInputOrData, coerceType, coerceTypeOptional } from '../../../utils/index.js';
import { pluginNodeDefinition } from '../../../model/NodeDefinition.js';
import { handleOpenAIError } from '../handleOpenaiError.js';
import { openAIFilePurposeOptions } from '../../../utils/openai.js';
import { openAIFileUploadPurposeOptions } from '../../../utils/openai.js';

export type UploadFileNode = ChartNode<'openaiUploadFile', UploadFileNodeData>;

export type UploadFileNodeData = {
purpose: 'fine-tune' | 'fine-tune-results' | 'assistants' | 'assistants_output';
purpose: 'fine-tune' | 'assistants' | 'assistants_output';
};

export const UploadFileNodeImpl: PluginNodeImpl<UploadFileNode> = {
Expand Down Expand Up @@ -91,15 +91,15 @@ export const UploadFileNodeImpl: PluginNodeImpl<UploadFileNode> = {
type: 'dropdown',
dataKey: 'purpose',
label: 'Purpose',
options: openAIFilePurposeOptions,
options: openAIFileUploadPurposeOptions,
defaultValue: 'assistants',
},
];
},

getBody(data) {
return dedent`
Purpose: ${openAIFilePurposeOptions.find(({ value }) => value === data.purpose)?.label ?? 'Unknown'}
Purpose: ${openAIFileUploadPurposeOptions.find(({ value }) => value === data.purpose)?.label ?? 'Unknown'}
`;
},

Expand Down
6 changes: 6 additions & 0 deletions packages/core/src/utils/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,12 @@ export const openAIFilePurposeOptions = [
{ value: 'assistants_output', label: 'Assistants Output' },
];

export const openAIFileUploadPurposeOptions = [
{ value: 'fine-tune', label: 'Fine-tuning' },
{ value: 'assistants', label: 'Assistants' },
{ value: 'assistants_output', label: 'Assistants Output' },
];

export type OpenAIThread = {
/** The identifier, which can be referenced in API endpoints. */
id: string;
Expand Down

0 comments on commit 51a57d4

Please sign in to comment.