MCPcopy Create free account
hub / github.com/UX-Decoder/Semantic-SAM / prompt_engineering

Function prompt_engineering

utils/prompt_engineering.py:90–99  ·  view source on GitHub ↗
(classnames, topk=1, suffix='.')

Source from the content-addressed store, hash-verified

88 return prompt_templates
89
90def prompt_engineering(classnames, topk=1, suffix='.'):
91 prompt_templates = get_prompt_templates()
92 temp_idx = np.random.randint(min(len(prompt_templates), topk))
93
94 if isinstance(classnames, list):
95 classname = random.choice(classnames)
96 else:
97 classname = classnames
98
99 return prompt_templates[temp_idx].replace('.', suffix).format(classname.replace(',', '').replace('+', ' '))

Callers 2

get_text_embeddingsMethod · 0.90
get_text_embeddingsMethod · 0.90

Calls 1

get_prompt_templatesFunction · 0.85

Tested by

no test coverage detected