To instruct a Large Language Model (LLM) to extract specific elements from a text, you can use a clear and precise prompt. Here’s an example of how you might structure such a prompt:
Prompt:
"Please extract and list only the following elements from the provided text: [Element1, Element2, Element3, ..., ElementN]. Provide the extracted elements in a bullet-point format."
Example:
Text:
"The quick brown fox jumps over the lazy dog. The dog's name is Buddy, and it loves to play fetch. The fox is named Rusty and is very cunning."
Elements to Extract: [animal names, colors, actions]
Expected Output:
- Animal names: fox, dog, Buddy, Rusty
- Colors: brown, lazy (Note: 'lazy' might not be a typical color, but it's included as per the instruction)
- Actions: jumps, play fetch
Detailed Instructions:
- Specify the Elements: Clearly list the elements you want to extract. For example, if you are looking for animal names, colors, and actions, state them explicitly.
- Format the Output: Request the LLM to provide the extracted elements in a specific format, such as bullet points, to make it easy to read and verify.
- Provide Context: If necessary, give a small sample text to illustrate the kind of extraction you expect.
Example with a Different Text and Elements:
Text:
"The conference will be held in New York on June 15th. Participants should register by May 1st. The keynote speaker will be Dr. Jane Smith, an expert in artificial intelligence."
Elements to Extract: [location, date, registration deadline, speaker name, speaker’s expertise]
Expected Output:
- Location: New York
- Date: June 15th
- Registration deadline: May 1st
- Speaker name: Dr. Jane Smith
- Speaker’s expertise: artificial intelligence
This approach ensures that the LLM understands exactly what information you are looking for and how you want it presented.