Skip to content

Commit

Permalink
remove redundant _examples field (run-llama#265)
Browse files Browse the repository at this point in the history
* remove redundant _examples field

* formatting
  • Loading branch information
svlandeg authored Aug 17, 2023
1 parent 6874426 commit 498826c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions spacy_llm/tasks/sentiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def __init__(
field (str): The name of the doc extension in which to store the summary.
"""
self._template = template
self._examples = examples
self._prompt_examples = examples or []
self._field = field
self._check_doc_extension()
Expand Down Expand Up @@ -100,7 +99,7 @@ def generate_prompts(self, docs: Iterable[Doc]) -> Iterable[str]:
for doc in docs:
prompt = _template.render(
text=doc.text,
examples=self._examples,
examples=self._prompt_examples,
)
yield prompt

Expand Down
5 changes: 3 additions & 2 deletions spacy_llm/tasks/summarization.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ def __init__(
field (str): The name of the doc extension in which to store the summary.
"""
self._template = template
self._examples = examples
self._max_n_words = max_n_words
self._field = field
self._prompt_examples = examples or []
Expand Down Expand Up @@ -126,7 +125,9 @@ def generate_prompts(self, docs: Iterable[Doc]) -> Iterable[str]:
_template = environment.from_string(self._template)
for doc in docs:
prompt = _template.render(
text=doc.text, examples=self._examples, max_n_words=self._max_n_words
text=doc.text,
examples=self._prompt_examples,
max_n_words=self._max_n_words,
)
yield prompt

Expand Down

0 comments on commit 498826c

Please sign in to comment.