-
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrate from
fine_tunes
to fine_tuning
- Loading branch information
1 parent
26a1872
commit 0f6e052
Showing
10 changed files
with
329 additions
and
296 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
[package] | ||
name = "fine_tunes" | ||
name = "fine_tuning" | ||
version = "0.1.0" | ||
edition = "2021" | ||
publish = false | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
//! Manage fine-tuning jobs to tailor a model to your specific training data. Related guide: [Fine-tune models](https://platform.openai.com/docs/guides/fine-tuning) | ||
use crate::client::OpenAI; | ||
use crate::interfaces::fine_tuning; | ||
use crate::shared::response_wrapper::OpenAIResponse; | ||
|
||
pub struct FineTuning<'a> { | ||
openai: &'a OpenAI, | ||
} | ||
|
||
impl<'a> FineTuning<'a> { | ||
pub fn new(openai: &'a OpenAI) -> Self { | ||
Self { openai } | ||
} | ||
|
||
/// Creates a job that fine-tunes a specified model from a given dataset. | ||
/// | ||
/// OpenAIResponse includes details of the enqueued job including job status and the name of the fine-tuned models once complete. | ||
/// | ||
/// [Learn more about Fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) | ||
pub async fn create( | ||
&self, | ||
req: &fine_tuning::CreateFineTuningRequest, | ||
) -> OpenAIResponse<fine_tuning::FineTuningResponse> { | ||
self.openai.post("/fine-tuning/jobs", req).await | ||
} | ||
|
||
/// List your organization's fine-tuning jobs | ||
pub async fn list( | ||
&self, | ||
req: &fine_tuning::ListFineTuningRequest, | ||
) -> OpenAIResponse<fine_tuning::FineTuningEventResponse> { | ||
self.openai.get("/fine-tuning/jobs", req).await | ||
} | ||
|
||
/// Get status updates for a fine-tuning job. | ||
pub async fn list_events( | ||
&self, | ||
fine_tuning_job_id: &str, // The ID of the fine-tuning job to get events for. | ||
req: &fine_tuning::ListFineTuningRequest, | ||
) -> OpenAIResponse<fine_tuning::FineTuningEventResponse> { | ||
self.openai | ||
.get( | ||
&format!("/fine-tuning/jobs/{fine_tuning_job_id}/events"), | ||
req, | ||
) | ||
.await | ||
} | ||
|
||
/// Get status updates for a fine-tuning job. | ||
pub async fn list_checkpoints( | ||
&self, | ||
fine_tuning_job_id: &str, // The ID of the fine-tuning job to get checkpoints for. | ||
req: &fine_tuning::ListFineTuningRequest, | ||
) -> OpenAIResponse<fine_tuning::FineTuningCheckpointResponse> { | ||
self.openai | ||
.get( | ||
&format!("/fine-tuning/jobs/{fine_tuning_job_id}/checkpoints"), | ||
req, | ||
) | ||
.await | ||
} | ||
|
||
/// Gets info about the fine-tune job. | ||
/// | ||
/// # Path parameters | ||
/// | ||
/// - `fine_tune_id` - The ID of the fine-tune job | ||
/// | ||
/// [Learn more about Fine-tuning](https://platform.openai.com/docs/guides/fine-tuning) | ||
pub async fn retrieve( | ||
&self, | ||
fine_tuning_job_id: &str, | ||
) -> OpenAIResponse<fine_tuning::FineTuningResponse> { | ||
self.openai | ||
.get(&format!("/fine-tuning/jobs/{fine_tuning_job_id}"), &()) | ||
.await | ||
} | ||
|
||
/// Immediately cancel a fine-tune job. | ||
/// | ||
/// # Path parameters | ||
/// | ||
/// - `fine_tune_job_id` - The ID of the fine-tune job to cancel | ||
pub async fn cancel( | ||
&self, | ||
fine_tune_job_id: &str, | ||
) -> OpenAIResponse<fine_tuning::FineTuningResponse> { | ||
self.openai | ||
.post(&format!("/fine-tuning/jobs/{fine_tune_job_id}/cancel"), &()) | ||
.await | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.