Extract Key Topics as JSON

Pulls the topics worth remembering out of a document extract as short phrases and returns them in a JSON object.

  • 🤖 Any chat LLM
  • 🗂️ Data

Last verified: write-up checked

Prompt by Microsoft (microsoft/semantic-kernel) · Original source (opens in a new tab)

Extract Key Topics as JSON — prompt preview

The prompt

prompt
Analyze the following extract taken from a document and extract key topics.
- Topics only worth remembering.
- Be brief. Short phrases.
- Can use broken English.
- Conciseness is very important.
- Topics can include names of memories you want to recall.
- NO LONG SENTENCES. SHORT PHRASES.
- Return in JSON
[Input]
My name is Macbeth. I used to be King of Scotland, but I died. My wife's name is Lady Macbeth and we were married for 15 years. We had no children. Our beloved dog Toby McDuff was a famous hunter of rats in the forest.
My tragic story was immortalized by Shakespeare in a play.
[Output]
{
  "topics": [
    "Macbeth",
    "King of Scotland",
    "Lady Macbeth",
    "Dog",
    "Toby McDuff",
    "Shakespeare",
    "Play",
    "Tragedy"
  ]
}
+++++
[Input]
{{$input}}
[Output]

What it is

Pulls the topics worth remembering out of a document extract as short phrases and returns them in a JSON object. The prompt text comes from the semantic-kernel repository (MIT licence, Copyright (c) Microsoft Corporation). The text is copied unchanged from its skprompt.txt file. Original author: Microsoft (microsoft/semantic-kernel).

Who it's for

  • Developers tagging documents
  • Knowledge base editors

يستخرج من مقطع مستند الموضوعات التي تستحق التذكر في عبارات قصيرة ويعيدها في كائن JSON.

Examples

The worked example inside the prompt

text
text
[Input]
My name is Macbeth. I used to be King of Scotland, but I died. My wife's name is Lady Macbeth and we were married for 15 years. We had no children. Our beloved dog Toby McDuff was a famous hunter of rats in the forest.
My tragic story was immortalized by Shakespeare in a play.
[Output]
{
  "topics": [
    "Macbeth",
    "King of Scotland",
    "Lady Macbeth",
    "Dog",
    "Toby McDuff",
    "Shakespeare",
    "Play",
    "Tragedy"
  ]
}

What it does: Sample input and the JSON output shown in the source.

Tips

  • Fill {{$input}} with the extract.
  • The one example in the prompt fixes the JSON shape: an object with a topics array.