ExposoGraph.llm_extractor

LLM-powered entity and relation extraction using pluggable backends.

extract_graph(...) and extract_graph_with_usage(...) accept a mode argument:

  • exploratory keeps provisional nodes and edges after grounding

  • strict returns only canonically grounded content

ExposoGraph.llm_extractor.extract_graph(text, *, model='gpt-4o', api_key=None, base_url=None, backend=None, mode=GraphMode.EXPLORATORY)[source]

Send text to the LLM and return a validated KnowledgeGraph.

If backend is provided it is used directly; otherwise an OpenAIBackend is created from the given credentials.

Parameters:
Return type:

KnowledgeGraph

ExposoGraph.llm_extractor.SYSTEM_PROMPT

The system prompt sent to the LLM, containing the full schema specification and extraction guidelines.

ExposoGraph.llm_extractor.EXAMPLE_INPUT

Example input text describing the Benzo[a]pyrene metabolism pathway, useful for testing and demonstration.