Creating custom spacy-llm tasks
In this section, we’re going to create a task where, given a quote from https://dummyjson.com/docs/quotes, the model should provide the context of the quote. Here’s an example:
Quote: We must balance conspicuous consumption with conscious capitalism. Context: Business ethics.
The first step of creating a custom spacy-llm task is to create the prompt and save it as a Jinja template. Here is the template for this task:
You are an expert at extracting context from text.
Your tasks is to accept a quote as input and provide the context of the quote.
This context will be used to group the quotes together.
Do not put any other text in your answer and provide the context in 3 words max. The quote should have one context only.
{# whitespace #}
{# whitespace #}
Here is the quote that needs classification
{# whitespace #}
{# whitespace #}
Quote:
'''
{{ text }} We’ll save this in a file named templates/quote_context_extract...