recap.api

Submodules

recap.api.app

class recap.api.app.ChatRequest(*, message: str, session_id: str | None = None)[source]

Bases: BaseModel

message: str
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

session_id: str | None
class recap.api.app.ChatResponse(*, session_id: str, response: str, history: list[dict])[source]

Bases: BaseModel

history: list[dict]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

response: str
session_id: str
class recap.api.app.RECAPApi(orchestrator: Orchestrator)[source]

Bases: object

SCREApi - Simplified STPA Analysis Orchestrator.

Generates FastAPI app for interacting with the scre pipeline via the api.

get_app()[source]

Returns FastAPI app generated

run(host: str = '0.0.0.0', port: int = 8000)[source]

Runs the api using uvicorn

class recap.api.app.SessionResponse(*, session_id: str, history: list[dict])[source]

Bases: BaseModel

history: list[dict]
model_config = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

session_id: str

recap.api.session

class recap.api.session.InMemorySessionStore[source]

Bases: object

A basic implementation using in memory dictionary for storing chat sessions

delete(session_id: str)[source]
get(session_id: str) list[dict][source]
update(session_id: str, value: Any)[source]
class recap.api.session.SQLiteSessionStorage(db_url: str = 'sqlite:///:memory:')[source]

Bases: object

A implementation that leverages persistent sqlite database for storing chat session information

class Base(**kwargs: Any)[source]

Bases: DeclarativeBase

metadata: ClassVar[MetaData] = MetaData()

Refers to the _schema.MetaData collection that will be used for new _schema.Table objects.

See also

orm_declarative_metadata

registry: ClassVar[registry] = <sqlalchemy.orm.decl_api.registry object>

Refers to the _orm.registry in use where new _orm.Mapper objects will be associated.

class RecapSession(**kwargs)[source]

Bases: Base

id
state
delete(session_id: str)[source]
get(session_id: str) list[dict][source]
update(session_id: str, value: list[dict])[source]
class recap.api.session.SessionStorage[source]

Bases: ABC

An abstract class for different session storages.

abstractmethod delete(session_id: str) dict[source]
abstractmethod get(session_id: str) list[dict][source]
abstractmethod update(session_id: str, value: list[dict])[source]

Module contents