graphragzen.prompt_tuning.utils.generate_domain
- graphragzen.prompt_tuning.utils.generate_domain(llm, documents, prompt='\nYou are an intelligent assistant that helps a human to analyze the information in a text document.\nGiven a sample text, help the user by assigning a descriptive domain that summarizes what the text is about.\nExample domains are: "Social studies", "Algorithmic analysis", "Medical science", among others.\n\nText: {input_text}\nDomain:', domain=None)[source]
Generate a domain to use for GraphRAG prompts.
- Parameters:
llm (LLM)
documents (List[str]) – Sample of documents that later will be used to create a graph. You likely want this to be chunks of the whole documents.
prompt (str, optional) – Prompt to use for generating a domain. If domain is not specified this will be used to infer the domain. Defaults to graphragzen.prompts.prompt_tuning.domain.GENERATE_DOMAIN_PROMPT.
domain (str, optional) – The domain relevant to a set of documents. If not specified, the prompt will be used to infer the domain. Defaults to None.
- Returns:
domain
- Return type:
str