Edits history of script submission #5821 for ' Create fine tuning job (openai)'

  • nativets
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    /**
     * Create fine tuning job
     * Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
    
    Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
    
    Learn more about fine-tuning
    
     */
    export async function main(
      auth: Openai,
      body: {
        model: string | ("babbage-002" | "davinci-002" | "gpt-3.5-turbo");
        training_file: string;
        hyperparameters?: {
          batch_size?: "auto" | number;
          learning_rate_multiplier?: "auto" | number;
          n_epochs?: "auto" | number;
          [k: string]: unknown;
        };
        suffix?: string;
        validation_file?: string;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.openai.com/v1/fine_tuning/jobs`);
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "OpenAI-Organization": auth.organization_id,
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.api_key,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 372 days ago

  • nativets
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    /**
     * Create fine tuning job
     * Creates a fine-tuning job which begins the process of creating a new model from a given dataset.
    
    Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
    
    Learn more about fine-tuning
    
     */
    export async function main(
      auth: Openai,
      body: {
        model: string | ("babbage-002" | "davinci-002" | "gpt-3.5-turbo");
        training_file: string;
        hyperparameters?: {
          batch_size?: "auto" | number;
          learning_rate_multiplier?: "auto" | number;
          n_epochs?: "auto" | number;
          [k: string]: unknown;
        };
        suffix?: string;
        validation_file?: string;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.openai.com/v1/fine_tuning/jobs`);
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "OpenAI-Organization": auth.organization_id,
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.api_key,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 835 days ago

  • nativets
    type Openai = {
      api_key: string;
      organization_id: string;
    };
    /**
     * Create fine tuning job
     * Creates a job that fine-tunes a specified model from a given dataset.
    
    Response includes details of the enqueued job including job status and the name of the fine-tuned models once complete.
    
    Learn more about fine-tuning
    
     */
    export async function main(
      auth: Openai,
      body: {
        model: string | ("babbage-002" | "davinci-002" | "gpt-3.5-turbo");
        training_file: string;
        hyperparameters?: {
          batch_size?: "auto" | number;
          learning_rate_multiplier?: "auto" | number;
          n_epochs?: "auto" | number;
          [k: string]: unknown;
        };
        suffix?: string;
        validation_file?: string;
        [k: string]: unknown;
      }
    ) {
      const url = new URL(`https://api.openai.com/v1/fine_tuning/jobs`);
    
      const response = await fetch(url, {
        method: "POST",
        headers: {
          "OpenAI-Organization": auth.organization_id,
          "Content-Type": "application/json",
          Authorization: "Bearer " + auth.api_key,
        },
        body: JSON.stringify(body),
      });
      if (!response.ok) {
        const text = await response.text();
        throw new Error(`${response.status} ${text}`);
      }
      return await response.json();
    }
    

    Submitted by hugo697 895 days ago