compass.plugin.one_shot.generators.generate_website_keywords#

async generate_website_keywords(schema_llm, extraction_schema, add_think_prompt=True)[source]#

Generate website keyword weights for document retrieval

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 keyword weights, so the quality of the generated keywords will depend on the capabilities of the LLM being used and how well it can interpret the provided extraction schema. Highly recommended to use the most powerful/capable instruction-tuned model for this function.

  • extraction_schema (dict) – A dictionary representing the schema of the desired extraction task. The keywords 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 mapping keywords to integer weights for website link prioritization.

Raises:

COMPASSRuntimeError – If the LLM fails to return any valid keyword weights after 3 attempts.