Skip to content

Commit ddb319d

Browse files
Invalid formatting test
1 parent a216e3d commit ddb319d

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

examples/vector_databases/chroma/hyde-with-chroma-and-openai.ipynb

+13-12
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@
236236
"def build_prompt(claim):\n",
237237
" return [\n",
238238
" {\"role\": \"system\", \"content\": \"I will ask you to assess a scientific claim. Output only the text 'True' if the claim is true, 'False' if the claim is false, or 'NEE' if there's not enough evidence.\"},\n",
239-
" {\"role\": \"user\", \"content\": f\"\"\" \n",
239+
" {\"role\": \"user\", \"content\": f\"\"\"\n",
240240
"Example:\n",
241241
"\n",
242242
"Claim:\n",
@@ -298,7 +298,7 @@
298298
"# Let's take a look at 50 claims\n",
299299
"samples = claim_df.sample(50)\n",
300300
"\n",
301-
"claims = samples['claim'].tolist() \n"
301+
"claims = samples['claim'].tolist()\n"
302302
]
303303
},
304304
{
@@ -317,7 +317,7 @@
317317
"def get_groundtruth(evidence):\n",
318318
" groundtruth = []\n",
319319
" for e in evidence:\n",
320-
" # Evidence is empty \n",
320+
" # Evidence is empty\n",
321321
" if len(e) == 0:\n",
322322
" groundtruth.append('NEE')\n",
323323
" else:\n",
@@ -631,13 +631,13 @@
631631
"outputs": [],
632632
"source": [
633633
"def build_prompt_with_context(claim, context):\n",
634-
" return [{'role': 'system', 'content': \"I will ask you to assess whether a particular scientific claim, based on evidence provided. Output only the text 'True' if the claim is true, 'False' if the claim is false, or 'NEE' if there's not enough evidence.\"}, \n",
634+
" return [{'role': 'system', 'content': \"I will ask you to assess whether a particular scientific claim, based on evidence provided. Output only the text 'True' if the claim is true, 'False' if the claim is false, or 'NEE' if there's not enough evidence.\"},\n",
635635
" {'role': 'user', 'content': f\"\"\"\"\n",
636636
"The evidence is the following:\n",
637637
"\n",
638638
"{' '.join(context)}\n",
639639
"\n",
640-
"Assess the following claim on the basis of the evidence. Output only the text 'True' if the claim is true, 'False' if the claim is false, or 'NEE' if there's not enough evidence. Do not output any other text. \n",
640+
"Assess the following claim on the basis of the evidence. Output only the text 'True' if the claim is true, 'False' if the claim is false, or 'NEE' if there's not enough evidence. Do not output any other text.\n",
641641
"\n",
642642
"Claim:\n",
643643
"{claim}\n",
@@ -843,19 +843,19 @@
843843
"source": [
844844
"def build_hallucination_prompt(claim):\n",
845845
" return [{'role': 'system', 'content': \"\"\"I will ask you to write an abstract for a scientific paper which supports or refutes a given claim. It should be written in scientific language, include a title. Output only one abstract, then stop.\n",
846-
" \n",
846+
"\n",
847847
" An Example:\n",
848848
"\n",
849849
" Claim:\n",
850850
" A high microerythrocyte count raises vulnerability to severe anemia in homozygous alpha (+)- thalassemia trait subjects.\n",
851851
"\n",
852852
" Abstract:\n",
853-
" BACKGROUND The heritable haemoglobinopathy alpha(+)-thalassaemia is caused by the reduced synthesis of alpha-globin chains that form part of normal adult haemoglobin (Hb). Individuals homozygous for alpha(+)-thalassaemia have microcytosis and an increased erythrocyte count. Alpha(+)-thalassaemia homozygosity confers considerable protection against severe malaria, including severe malarial anaemia (SMA) (Hb concentration < 50 g/l), but does not influence parasite count. We tested the hypothesis that the erythrocyte indices associated with alpha(+)-thalassaemia homozygosity provide a haematological benefit during acute malaria. \n",
854-
" METHODS AND FINDINGS Data from children living on the north coast of Papua New Guinea who had participated in a case-control study of the protection afforded by alpha(+)-thalassaemia against severe malaria were reanalysed to assess the genotype-specific reduction in erythrocyte count and Hb levels associated with acute malarial disease. We observed a reduction in median erythrocyte count of approximately 1.5 x 10(12)/l in all children with acute falciparum malaria relative to values in community children (p < 0.001). We developed a simple mathematical model of the linear relationship between Hb concentration and erythrocyte count. This model predicted that children homozygous for alpha(+)-thalassaemia lose less Hb than children of normal genotype for a reduction in erythrocyte count of >1.1 x 10(12)/l as a result of the reduced mean cell Hb in homozygous alpha(+)-thalassaemia. In addition, children homozygous for alpha(+)-thalassaemia require a 10% greater reduction in erythrocyte count than children of normal genotype (p = 0.02) for Hb concentration to fall to 50 g/l, the cutoff for SMA. We estimated that the haematological profile in children homozygous for alpha(+)-thalassaemia reduces the risk of SMA during acute malaria compared to children of normal genotype (relative risk 0.52; 95% confidence interval [CI] 0.24-1.12, p = 0.09). \n",
853+
" BACKGROUND The heritable haemoglobinopathy alpha(+)-thalassaemia is caused by the reduced synthesis of alpha-globin chains that form part of normal adult haemoglobin (Hb). Individuals homozygous for alpha(+)-thalassaemia have microcytosis and an increased erythrocyte count. Alpha(+)-thalassaemia homozygosity confers considerable protection against severe malaria, including severe malarial anaemia (SMA) (Hb concentration < 50 g/l), but does not influence parasite count. We tested the hypothesis that the erythrocyte indices associated with alpha(+)-thalassaemia homozygosity provide a haematological benefit during acute malaria.\n",
854+
" METHODS AND FINDINGS Data from children living on the north coast of Papua New Guinea who had participated in a case-control study of the protection afforded by alpha(+)-thalassaemia against severe malaria were reanalysed to assess the genotype-specific reduction in erythrocyte count and Hb levels associated with acute malarial disease. We observed a reduction in median erythrocyte count of approximately 1.5 x 10(12)/l in all children with acute falciparum malaria relative to values in community children (p < 0.001). We developed a simple mathematical model of the linear relationship between Hb concentration and erythrocyte count. This model predicted that children homozygous for alpha(+)-thalassaemia lose less Hb than children of normal genotype for a reduction in erythrocyte count of >1.1 x 10(12)/l as a result of the reduced mean cell Hb in homozygous alpha(+)-thalassaemia. In addition, children homozygous for alpha(+)-thalassaemia require a 10% greater reduction in erythrocyte count than children of normal genotype (p = 0.02) for Hb concentration to fall to 50 g/l, the cutoff for SMA. We estimated that the haematological profile in children homozygous for alpha(+)-thalassaemia reduces the risk of SMA during acute malaria compared to children of normal genotype (relative risk 0.52; 95% confidence interval [CI] 0.24-1.12, p = 0.09).\n",
855855
" CONCLUSIONS The increased erythrocyte count and microcytosis in children homozygous for alpha(+)-thalassaemia may contribute substantially to their protection against SMA. A lower concentration of Hb per erythrocyte and a larger population of erythrocytes may be a biologically advantageous strategy against the significant reduction in erythrocyte count that occurs during acute infection with the malaria parasite Plasmodium falciparum. This haematological profile may reduce the risk of anaemia by other Plasmodium species, as well as other causes of anaemia. Other host polymorphisms that induce an increased erythrocyte count and microcytosis may confer a similar advantage.\n",
856856
"\n",
857-
" End of example. \n",
858-
" \n",
857+
" End of example.\n",
858+
"\n",
859859
" \"\"\"}, {'role': 'user', 'content': f\"\"\"\"\n",
860860
" Perform the task for the following claim.\n",
861861
"\n",
@@ -922,7 +922,7 @@
922922
},
923923
{
924924
"cell_type": "code",
925-
"execution_count": 23,
925+
"execution_count": null,
926926
"metadata": {},
927927
"outputs": [
928928
{
@@ -951,7 +951,8 @@
951951
],
952952
"source": [
953953
"gpt_with_hallucinated_context_evaluation = assess_claims_with_context(claims, filtered_hallucinated_query_result['documents'])\n",
954-
"confusion_matrix(gpt_with_hallucinated_context_evaluation, groundtruth)"
954+
"confusion_matrix(gpt_with_hallucinated_context_evaluation, groundtruth)\n",
955+
">>>> INVALID TEST"
955956
]
956957
},
957958
{

0 commit comments

Comments
 (0)