Skip to content

chains

This module provides the implementation of the API endpoints for chains in the Eleanor backend.

The chains module contains the API endpoints for invoking LLM chains and retrieving token limits for specific chains. It is responsible for handling requests related to chains and interacting with the ChainService.

Attributes

RESOURCE_CHAINS module-attribute

RESOURCE_CHAINS = 'Chains'

chains_router module-attribute

chains_router = APIRouter(
    prefix=format_path(RESOURCE_CHAINS),
    tags=[RESOURCE_CHAINS],
    responses=DEFAULT_HTTP_ERROR_RESPONSES,
)

Classes

Functions

invoke_chain async

invoke_chain(
    fastapi_request: Request,
    request: InvokeChainRequestV1,
    job_pool: ThreadPoolExecutor = Depends(
        job_pool_dependency
    ),
)

Invoke a LLM chain

Parameters:

  • fastapi_request (Request) –

    The FastAPI request object.

  • request (InvokeChainRequestV1) –

    The request object containing the chain details.

  • sa_session (SASession) –

    The SQLAlchemy session.

  • neo4j_session (NJSession) –

    The Neo4j session.

  • job_pool (ThreadPoolExecutor, default: Depends(job_pool_dependency) ) –

    The thread pool executor.

Returns:

  • dto.InvokeChainResponseV1: The response object containing the results of the chain invocation.