Skip to content

Commit

Permalink
Fix notebooks
Browse files Browse the repository at this point in the history
  • Loading branch information
steventkrawczyk committed Jul 17, 2023
1 parent b34cbf1 commit 8523246
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 487 deletions.
5 changes: 3 additions & 2 deletions examples/notebooks/AutoEval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@
"outputs": [],
"source": [
"from typing import Dict\n",
"from prompttools.harness import PromptTemplateExperimentationHarness"
"from prompttools.harness import PromptTemplateExperimentationHarness\n",
"from prompttools.experiment import OpenAICompletionExperiment"
]
},
{
Expand Down Expand Up @@ -308,7 +309,7 @@
"metadata": {},
"outputs": [],
"source": [
"harness = PromptTemplateExperimentationHarness(\"text-davinci-003\", prompt_templates, user_inputs)"
"harness = PromptTemplateExperimentationHarness(OpenAICompletionExperiment, \"text-davinci-003\", prompt_templates, user_inputs)"
]
},
{
Expand Down
14 changes: 12 additions & 2 deletions examples/notebooks/HuggingFaceHub.ipynb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"id": "0a13ddc8",
"metadata": {},
Expand All @@ -9,6 +10,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "623f0cfe",
"metadata": {},
Expand All @@ -27,6 +29,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "2eac35f8",
"metadata": {},
Expand All @@ -35,6 +38,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "5edba05a",
"metadata": {},
Expand Down Expand Up @@ -63,10 +67,11 @@
"outputs": [],
"source": [
"from typing import Dict, List, Tuple\n",
"from prompttools.experiment.huggingface_hub_experiment import HuggingFaceHubExperiment"
"from prompttools.experiment import HuggingFaceHubExperiment"
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "622dea9a",
"metadata": {},
Expand All @@ -75,6 +80,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "3babfe5a",
"metadata": {},
Expand All @@ -101,6 +107,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "f3fa5450",
"metadata": {},
Expand All @@ -119,6 +126,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "266c13eb",
"metadata": {},
Expand All @@ -127,6 +135,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "bebb8023",
"metadata": {},
Expand Down Expand Up @@ -166,6 +175,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"id": "974d6065",
"metadata": {},
Expand All @@ -182,7 +192,7 @@
},
"outputs": [],
"source": [
"experiment.evaluate(\"similar_to_expected\", measure_similarity)\n"
"experiment.evaluate(\"similar_to_expected\", measure_similarity)"
]
},
{
Expand Down
5 changes: 3 additions & 2 deletions examples/notebooks/HumanFeedback.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,8 @@
"metadata": {},
"outputs": [],
"source": [
"from prompttools.harness import PromptTemplateExperimentationHarness"
"from prompttools.harness import PromptTemplateExperimentationHarness\n",
"from prompttools.experiment import OpenAICompletionExperiment"
]
},
{
Expand Down Expand Up @@ -307,7 +308,7 @@
"metadata": {},
"outputs": [],
"source": [
"harness = PromptTemplateExperimentationHarness(\"text-davinci-003\", prompt_templates, user_inputs)"
"harness = PromptTemplateExperimentationHarness(OpenAICompletionExperiment, \"text-davinci-003\", prompt_templates, user_inputs)"
]
},
{
Expand Down
245 changes: 8 additions & 237 deletions examples/notebooks/ModelComparison.ipynb

Large diffs are not rendered by default.

318 changes: 76 additions & 242 deletions examples/notebooks/SemanticSimilarity.ipynb

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion prompttools/harness/prompt_template_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ class PromptTemplateExperimentationHarness(ExperimentationHarness):

def __init__(
self,
experiment_classname,
model_name: str,
prompt_templates: List[str],
user_inputs: List[Dict[str, str]],
model_arguments: Optional[Dict[str, object]] = None,
):
self.environment = jinja2.Environment()
self.experiment_classname = model_arguments["experiment_classname"]
self.experiment_classname = experiment_classname
self.model_name = model_name
self.prompt_templates = prompt_templates
self.user_inputs = user_inputs
Expand Down
3 changes: 2 additions & 1 deletion prompttools/harness/system_prompt_harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ class SystemPromptExperimentationHarness(ExperimentationHarness):

def __init__(
self,
experiment_classname,
model_name: str,
system_prompts: List[str],
human_messages: List[str],
model_arguments: Optional[Dict[str, object]] = None,
):
self.experiment_classname = model_arguments["experiment_classname"]
self.experiment_classname = experiment_classname,
self.model_name = model_name
self.system_prompts = system_prompts
self.human_messages = human_messages
Expand Down

0 comments on commit 8523246

Please sign in to comment.