HyeonseoNam / auto-classifier

Auto classification plugin for Obsidian using ChatGPT.
MIT License
81 stars 9 forks source link

FR: More template examples? #1

Closed brimwats closed 1 year ago

brimwats commented 1 year ago

In the readme you mention the possibility of "for example, DDC classification for books"; but the current template is like this:

Classify this content:
"""
{{input}}
"""
Answer format is JSON {reliability:0~1, output:selected_category}. 
Even if you are not sure, qualify the reliability and select one. 
Output must be one of these:

{{reference}}

Could we get some more examples of how to create a prompt for classification. For example, say I wanted to just use Wikidata classifications, how would I change the prompt? Or perhaps I want to just use Library of Congress Subject Headings (LCSH), how would I do that?

HyeonseoNam commented 1 year ago

Hi @brimwats ! In the Settings tab, you can set Custom Chat Role and Custom Prompt Templates. This plugin forces ChatGPT to respond in JSON format and uses the value of the output key to deliver the response to the user. Therefore, you can leave the Custom Chat Role as default and just modify some sentences in the Custom Prompt Templates.

Since ChatGPT's responses can be somewhat inconsistent, choosing from the tags you've used tends to be relatively consistent. However, if you want to create a new classification, you can simply remove {{reference}} in the Custom Prompt Templates.

An example of a DDC number classification without using existing tags is as follows:

Classify the DDC number for this content:
"""
{{input}}
"""
Answer format is JSON {reliability:0~1, output:"[ddc_number]:category"}. 
Even if you are not sure, qualify the reliability and select one. 
Convert the blank spaces to "_" in the output.

The LCSH classification for this would be:

Classify the LCSH classification for this content:
"""
{{input}}
"""
Answer format is JSON {reliability:0~1, output:"[First LCSH term]--[Second LCSH term]--[Third LCSH term]"}. 
Even if you are not sure, qualify the reliability and select one. 
Convert the blank spaces to "_" in the output.

I'm not entirely sure if this LSCH example works well as I'm not familiar with LCSH classifications.

brimwats commented 1 year ago

these are great things to include in the readme!

perhaps the prompt would be better like

"Please use Library of Congress Subject Headings to classify this content" and "Please use Dewey Decimal Classification to classify this content"

This is what LCSH looks like: https://www2.lawrence.edu/fast/revieg/guides/HISTLCSH.HTML

Do you think if I was like "Please use Library of Congress Subject Headings to classify this content, and include any broader, narrower and related terms" it would work?

HyeonseoNam commented 1 year ago

Thank you! I updated the README thanks to your effort. It will be more helpful to use this plugin!

I have also chekced that BT NT RT quite works, but it may not be perfect for your working.

Thank you so much :)