Skip to content

Commit

Permalink
use node.text instead of node.source_text (run-llama#8622)
Browse files Browse the repository at this point in the history
* use node.text  instead of node.source_text

* fix lint. update `analyze_outcome_llm_single` to use node.text too.
  • Loading branch information
AlexZhangji authored Nov 1, 2023
1 parent de36139 commit 049ce38
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions examples/test_wiki/TestNYC-Benchmark-GPT4.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,7 @@
" def is_correct_source(self) -> bool:\n",
" is_correct = True\n",
" for answer in self.test.must_contain:\n",
" if all(\n",
" answer not in node.source_text for node in self.response.source_nodes\n",
" ):\n",
" if all(answer not in node.text for node in self.response.source_nodes):\n",
" is_correct = False\n",
" return is_correct"
]
Expand Down Expand Up @@ -352,7 +350,7 @@
" outcome: TestOutcome, llm_predictor: LLMPredictor\n",
") -> Tuple[bool, bool]:\n",
" try:\n",
" source_text = outcome.response.source_nodes[0].source_text\n",
" source_text = outcome.response.source_nodes[0].text\n",
" except:\n",
" source_text = \"Failed to retrieve any context\"\n",
" result_str, _ = llm_predictor.predict(\n",
Expand Down

0 comments on commit 049ce38

Please sign in to comment.