From 5191283f868aac7df00c4f362ebc643685fafcac Mon Sep 17 00:00:00 2001 From: Jason Liu Date: Mon, 16 Oct 2023 20:28:31 -0400 Subject: [PATCH] blog --- docs/blog/posts/distilation-part1.md | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/blog/posts/distilation-part1.md b/docs/blog/posts/distilation-part1.md index 5b636b2..e1fa041 100644 --- a/docs/blog/posts/distilation-part1.md +++ b/docs/blog/posts/distilation-part1.md @@ -50,8 +50,14 @@ Traditional approaches would require you to manually save logs, extract the logs ```python from instructor import Instructions +import logging -instructions = Instructions(name="sales_follow_up") +logging.basicConfig(level=logging.INFO) + +instructions = Instructions( + name="sales_follow_up", + log_handlers=[FileHandler("complex_chain_finetune.jsonl")] +) @instructions.distil def complex_chain(video_transcript: str) -> Email: @@ -61,7 +67,8 @@ def complex_chain(video_transcript: str) -> Email: return emails[-1] ``` -This allows you to replace the function with a fine-tuned model without altering the response type or breaking existing code. +This now results in a log file that can be used to finetune a model, you can use the `instructor` cli or upload the file directly to OpenAI. Note that its building using log handlers, so if you want to save to a DB or S3 you can do that by saving your logs elsewhere. + ## I trained the model. Now what?