From 88be182fe297ce28a28f2077abc7f788e8274bc6 Mon Sep 17 00:00:00 2001 From: Maheswaran Sathiamoorthy Date: Tue, 17 Dec 2024 21:25:51 -0800 Subject: [PATCH] Put the examples in respective folders and add requirements.txt everywhere. --- .../litellm_recipe_prompting.py | 4 ++-- .../litellm_recipe_structured_output.py | 5 +++++ examples/litellm-recipe-generation/requirements.txt | 1 + examples/{ => poem-generation}/poem.py | 0 examples/poem-generation/requirements.txt | 1 + examples/{ => poem-generation}/simple_poem.py | 0 examples/{distill.py => reannotation/main.py} | 0 examples/reannotation/requirements.txt | 1 + examples/ungrounded-qa/requirements.txt | 1 + examples/{camel.py => ungrounded-qa/ungrounded_qa.py} | 7 ++++++- 10 files changed, 17 insertions(+), 3 deletions(-) rename examples/{ => litellm-recipe-generation}/litellm_recipe_prompting.py (95%) rename examples/{ => litellm-recipe-generation}/litellm_recipe_structured_output.py (95%) create mode 100644 examples/litellm-recipe-generation/requirements.txt rename examples/{ => poem-generation}/poem.py (100%) create mode 100644 examples/poem-generation/requirements.txt rename examples/{ => poem-generation}/simple_poem.py (100%) rename examples/{distill.py => reannotation/main.py} (100%) create mode 100644 examples/reannotation/requirements.txt create mode 100644 examples/ungrounded-qa/requirements.txt rename examples/{camel.py => ungrounded-qa/ungrounded_qa.py} (84%) diff --git a/examples/litellm_recipe_prompting.py b/examples/litellm-recipe-generation/litellm_recipe_prompting.py similarity index 95% rename from examples/litellm_recipe_prompting.py rename to examples/litellm-recipe-generation/litellm_recipe_prompting.py index 85449389..4a8dd430 100644 --- a/examples/litellm_recipe_prompting.py +++ b/examples/litellm-recipe-generation/litellm_recipe_prompting.py @@ -1,5 +1,5 @@ -from typing import List -from pydantic import BaseModel, Field +"""Generate synthetic recipes for different cuisines.""" + from bespokelabs import curator from datasets import Dataset diff --git a/examples/litellm_recipe_structured_output.py b/examples/litellm-recipe-generation/litellm_recipe_structured_output.py similarity index 95% rename from examples/litellm_recipe_structured_output.py rename to examples/litellm-recipe-generation/litellm_recipe_structured_output.py index bb9ad12b..b3ff05f1 100644 --- a/examples/litellm_recipe_structured_output.py +++ b/examples/litellm-recipe-generation/litellm_recipe_structured_output.py @@ -1,3 +1,8 @@ +"""Generate synthetic recipes for different cuisines. + +Demonstrates how to use a structured output format with Litellm. +""" + from typing import List from pydantic import BaseModel, Field from bespokelabs import curator diff --git a/examples/litellm-recipe-generation/requirements.txt b/examples/litellm-recipe-generation/requirements.txt new file mode 100644 index 00000000..0ac1faf1 --- /dev/null +++ b/examples/litellm-recipe-generation/requirements.txt @@ -0,0 +1 @@ +bespokelabs-curator \ No newline at end of file diff --git a/examples/poem.py b/examples/poem-generation/poem.py similarity index 100% rename from examples/poem.py rename to examples/poem-generation/poem.py diff --git a/examples/poem-generation/requirements.txt b/examples/poem-generation/requirements.txt new file mode 100644 index 00000000..0ac1faf1 --- /dev/null +++ b/examples/poem-generation/requirements.txt @@ -0,0 +1 @@ +bespokelabs-curator \ No newline at end of file diff --git a/examples/simple_poem.py b/examples/poem-generation/simple_poem.py similarity index 100% rename from examples/simple_poem.py rename to examples/poem-generation/simple_poem.py diff --git a/examples/distill.py b/examples/reannotation/main.py similarity index 100% rename from examples/distill.py rename to examples/reannotation/main.py diff --git a/examples/reannotation/requirements.txt b/examples/reannotation/requirements.txt new file mode 100644 index 00000000..0ac1faf1 --- /dev/null +++ b/examples/reannotation/requirements.txt @@ -0,0 +1 @@ +bespokelabs-curator \ No newline at end of file diff --git a/examples/ungrounded-qa/requirements.txt b/examples/ungrounded-qa/requirements.txt new file mode 100644 index 00000000..0ac1faf1 --- /dev/null +++ b/examples/ungrounded-qa/requirements.txt @@ -0,0 +1 @@ +bespokelabs-curator \ No newline at end of file diff --git a/examples/camel.py b/examples/ungrounded-qa/ungrounded_qa.py similarity index 84% rename from examples/camel.py rename to examples/ungrounded-qa/ungrounded_qa.py index b9bdfee1..1f7c1376 100644 --- a/examples/camel.py +++ b/examples/ungrounded-qa/ungrounded_qa.py @@ -1,3 +1,8 @@ +"""Generate diverse set of questions and answers by generating diverse subjects and subsubjects. + +This is similar to how data is generated for the Camel dataset. +See section F (appendix) of https://arxiv.org/pdf/2303.17760. +""" from typing import List from pydantic import BaseModel, Field @@ -23,7 +28,7 @@ class QAs(BaseModel): subject_prompter = curator.LLM( - prompt_func=lambda: f"Generate a diverse list of 3 subjects. Keep it high-level (e.g. Math, Science).", + prompt_func=lambda: "Generate a diverse list of 3 subjects. Keep it high-level (e.g. Math, Science).", parse_func=lambda _, subjects: [subject for subject in subjects.subjects], model_name="gpt-4o-mini", response_format=Subjects,