Skip to content

Instantly share code, notes, and snippets.

@maxcountryman
Created January 9, 2023 19:57
Show Gist options
  • Save maxcountryman/e164cd42466ee808da2776d18afda8cb to your computer and use it in GitHub Desktop.
Save maxcountryman/e164cd42466ee808da2776d18afda8cb to your computer and use it in GitHub Desktop.
Generating tags with GPT
echo -e $(curl -s https://api.openai.com/v1/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENAI_API_KEY" \
-d '{"model": "text-davinci-003", "prompt": "Extract tags from the following text. Limit five tags. Output JSON.\\n\\nText: Folksonomy is a classification system in which end users apply public tags to online items, typically to make those items easier for themselves or others to find later. Over time, this can give rise to a classification system based on those tags and how often they are applied or searched for, in contrast to a taxonomic classification designed by the owners of the content and specified when it is published.[1][2] This practice is also known as collaborative tagging,[3][4] social classification, social indexing, and social tagging.\\n\\n<Output>", "temperature": 0, "max_tokens": 1000}' | jq .choices[0].text) | tr -d '\\' | sed -r 's/^"|"$//g' | jq .tags
Extract tags from the following text. Limit five tags. Output JSON.
Text: <Text>
<Output>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment