64bit / async-openai

Rust library for OpenAI
https://docs.rs/async-openai
MIT License
1.17k stars 178 forks source link

FIX: finetuningjob deserialize crash #155

Open inszee opened 11 months ago

inszee commented 11 months ago

let job = open_ai_client .fine_tuning() .create(fine_tune_request) .await?; FineTuningJob struct is like:
{ "object": "fine_tuning.job", "id": "ftjob xxx", "model": "gpt-3.5-turbo-0613", "created_at": 1700626516, "finished_at": null, "fine_tuned_model": null, "organization_id": "org-zxxx", "result_files": [], "status": "validating_files", "validation_file": null, "training_file": "file-xxx", "hyperparameters": { "batch_size": "auto", "learning_rate_multiplier": "auto" }, "trained_tokens": null, "error": null } have not n_epochs variable ,cause deserialize exception.

64bit commented 11 months ago

Hey thanks for PR, I'm not sure I follow what's going on.

My guess is that #[serde(skip_serializing_if = "Option::is_none")] is missing attribute on CreateFineTuningJobRequest struct's hyperparameters field.

64bit commented 11 months ago

Hmm there's perhaps confusion between deprecated and new fine tuning APIs.

inszee commented 11 months ago

Hey thanks for PR, I'm not sure I follow what's going on.

My guess is that #[serde(skip_serializing_if = "Option::is_none")] is missing attribute on CreateFineTuningJobRequest struct's hyperparameters field.

 There's not impact on the structure of CreateFineTuningJobRequest。#[serde(skip_serializing_if = "Option::is_none")] is used to declare that a field in the structure may not exist during deserialization