Run the Streamlit viewer to inspect an experience table.
(
url: Annotated[
Optional[str],
typer.Option(
"--url",
help=(
"Database specifier for the experience table. Accepts either a DB URL "
"(e.g. sqlite:////path/to/debug_buffer.db) or a plain path to a .db file "
"(relative or absolute), which is converted to a sqlite URL automatically. "
"Optional when --config is given; a value here overrides the config."
),
),
] = None,
table: Annotated[
Optional[str],
typer.Option("--table", help="Name of the experience table to monitor."),
] = None,
tokenizer: Annotated[
Optional[str],
typer.Option(
"--tokenizer",
help="Tokenizer/model path used to decode token ids in the viewer.",
),
] = None,
config: Annotated[
Optional[str],
typer.Option(
"--config",
help=(
"Path to a Trinity config file. When set, --url/--tokenizer/--table are "
"inferred from it (experience pipeline input database + model.model_path); "
"explicit CLI args still override the config."
),
),
] = None,
schema: Annotated[
str,
typer.Option(
"--schema",
help="Schema type of the table. Supported values: experience, sft.",
),
] = "experience",
port: Annotated[
int,
typer.Option("--port", "-p", help="The port for Experience Viewer."),
] = 8502,
)
| 97 | |
| 98 | |
| 99 | def view_command( |
| 100 | url: Annotated[ |
| 101 | Optional[str], |
| 102 | typer.Option( |
| 103 | "--url", |
| 104 | help=( |
| 105 | "Database specifier for the experience table. Accepts either a DB URL " |
| 106 | "(e.g. sqlite:////path/to/debug_buffer.db) or a plain path to a .db file " |
| 107 | "(relative or absolute), which is converted to a sqlite URL automatically. " |
| 108 | "Optional when --config is given; a value here overrides the config." |
| 109 | ), |
| 110 | ), |
| 111 | ] = None, |
| 112 | table: Annotated[ |
| 113 | Optional[str], |
| 114 | typer.Option("--table", help="Name of the experience table to monitor."), |
| 115 | ] = None, |
| 116 | tokenizer: Annotated[ |
| 117 | Optional[str], |
| 118 | typer.Option( |
| 119 | "--tokenizer", |
| 120 | help="Tokenizer/model path used to decode token ids in the viewer.", |
| 121 | ), |
| 122 | ] = None, |
| 123 | config: Annotated[ |
| 124 | Optional[str], |
| 125 | typer.Option( |
| 126 | "--config", |
| 127 | help=( |
| 128 | "Path to a Trinity config file. When set, --url/--tokenizer/--table are " |
| 129 | "inferred from it (experience pipeline input database + model.model_path); " |
| 130 | "explicit CLI args still override the config." |
| 131 | ), |
| 132 | ), |
| 133 | ] = None, |
| 134 | schema: Annotated[ |
| 135 | str, |
| 136 | typer.Option( |
| 137 | "--schema", |
| 138 | help="Schema type of the table. Supported values: experience, sft.", |
| 139 | ), |
| 140 | ] = "experience", |
| 141 | port: Annotated[ |
| 142 | int, |
| 143 | typer.Option("--port", "-p", help="The port for Experience Viewer."), |
| 144 | ] = 8502, |
| 145 | ) -> None: |
| 146 | """Run the Streamlit viewer to inspect an experience table.""" |
| 147 | schema = schema.lower() |
| 148 | if schema not in {"experience", "sft"}: |
| 149 | raise typer.BadParameter("--schema only supports 'experience' or 'sft'.") |
| 150 | |
| 151 | db_url: Optional[str] = None |
| 152 | table_name: Optional[str] = None |
| 153 | tokenizer_path: Optional[str] = None |
| 154 | |
| 155 | if config is not None: |
| 156 | db_url, table_name, tokenizer_path = _resolve_from_config(config) |
nothing calls this directly
no test coverage detected