Skip to content

Instantly share code, notes, and snippets.

@taf2
Created November 19, 2023 23:00
Show Gist options
  • Save taf2/f4cea2771ab7310b9a82448ebedde6bb to your computer and use it in GitHub Desktop.
Save taf2/f4cea2771ab7310b9a82448ebedde6bb to your computer and use it in GitHub Desktop.
sub_topics = [ ... ] # say you give it like 800 topics.
prompt =
Here is a set of JSON encoded topics: #{sub_topics.to_json}.
Please generalize these into a smaller set of no more then 10 topics.
Your new generalized topics may be expressed as multiple words.
Output as a JSON object of the new topics and the sub topics that belong to each topic.
e.g. given ['sub topic 1', 'sub topic 2', 'sub topic 3', ...] group them into parent topics like {'topic1': ['sub topic 1', 'sub topic
outputing as JSON
system = You are an expert at generalizing topics. You review lists of topics and group them into similar topics.
Output as a JSON object of the new topics and the sub topics that belong to each topic.\n e.g. given ['sub topic 1', 'sub topic 2', 'sub topic 3', ...] group them into parent topics like {'topic1': ['sub topic 1', 'sub topic 2'], 'topic2': ['sub topic 3', ...]}\n outputing as JSON
@taf2
Copy link
Author

taf2 commented Nov 20, 2023

generates a broken response and seems to be looping the output like : ```",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "finishing touches",\n "
},
"finish_reason": "length"
}
],
"usage": {
"prompt_tokens": 4756,
"completion_tokens": 4096,
"total_tokens": 8852
},
"system_fingerprint": "fp_a24b4d720c"
}````

vs gpt-4 was not having repeated sub topics.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment