Skip to content

Core Types

genie_tooling.core.types

Core shared types and protocols for the middleware.

Classes

Plugin

Bases: Protocol

Base protocol for all plugins.

Attributes
plugin_id property
plugin_id: str

A unique string identifier for this plugin instance/type.

Functions
setup async
setup(config: Optional[Dict[str, Any]] = None) -> None

Optional asynchronous setup method for plugins.

This method is called by the PluginManager after a plugin is instantiated. It is the primary mechanism for a plugin to receive its configuration.

Parameters:

Name Type Description Default
config Optional[Dict[str, Any]]

A dictionary containing the specific configuration for this plugin instance. This dictionary is sourced from the relevant *_configurations dictionary in MiddlewareConfig, keyed by this plugin's plugin_id.

None
Source code in src/genie_tooling/core/types.py
async def setup(self, config: Optional[Dict[str, Any]] = None) -> None:
    """
    Optional asynchronous setup method for plugins.

    This method is called by the PluginManager after a plugin is instantiated.
    It is the primary mechanism for a plugin to receive its configuration.

    Args:
        config: A dictionary containing the specific configuration for this
            plugin instance. This dictionary is sourced from the relevant
            `*_configurations` dictionary in `MiddlewareConfig`, keyed by this
            plugin's `plugin_id`.
    """
    pass
teardown async
teardown() -> None

Optional asynchronous teardown method for plugins. Called before application shutdown.

Source code in src/genie_tooling/core/types.py
async def teardown(self) -> None:
    """Optional asynchronous teardown method for plugins. Called before application shutdown."""
    pass

Document

Bases: Protocol

Represents a loaded document before splitting.

Chunk

Bases: Protocol

Represents a chunk of a document after splitting.

RetrievedChunk

Bases: Chunk, Protocol

Represents a chunk retrieved from a vector store, with a relevance score.

StructuredError

Bases: TypedDict

Standardized structure for reporting errors, especially to LLMs.