compass.plugin.one_shot.generators.generate_heuristic_keywords#
- async generate_heuristic_keywords(schema_llm, extraction_schema, add_think_prompt=True)[source]#
Generate keyword lists for a heuristic text check
- Parameters:
schema_llm (
SchemaOutputLLMCaller) – A LLM caller configured to output structured data according to a provided schema. This function relies on the LLM to generate the heuristic keyword lists, so the quality of the generated output will depend on the capabilities of the LLM being used and how well it can interpret the provided extraction schema.extraction_schema (
dict) – A dictionary representing the schema of the desired extraction task. The keyword lists will be generated based on the content of this schema, so it should be as detailed and specific as possible, and should include domain-specific terminology if applicable. See the wind ordinance schema for an example.add_think_prompt (
bool, optional) – Option to add a “Think before you answer” instruction to the end of the prompt (useful for thinking models). By default,True.
- Returns:
dict– Dictionary containing the keyword lists for a heuristic text check:not_tech_words,good_tech_keywords,good_tech_acronyms, andgood_tech_phrases.- Raises:
COMPASSRuntimeError – If the LLM fails to return any valid heuristic keywords after 3 attempts.