API
api_state_verification
Perform cli commands verification (state checking).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ctx |
Context
|
Typer (Click like) special internal object that holds state relevant for the script execution at every single level. |
required |
Source code in src/trecover/app/cli/api.py
api_config
api_config(
url=Option(var.FASTAPI_URL, help="API url"),
param=Option(None, help="Param name to receive"),
)
Receive configuration or specific parameter of the model used for inference.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str, default
|
API url. |
Option(var.FASTAPI_URL, help='API url')
|
param |
str, default
|
Param name whose value to receive. Receive all configuration values if None. |
Option(None, help='Param name to receive')
|
Source code in src/trecover/app/cli/api.py
api_recover
api_recover(
data_path=Argument(
Ellipsis, help="Path to file or dir for data"
),
url=Option(var.FASTAPI_URL, help="API url"),
separator=Option(
" ", help="Columns separator in the input files"
),
noisy=Option(False, help="Input files are noisy texts"),
min_noise=Option(
3,
help="Min noise parameter. Minimum value is alphabet size",
),
max_noise=Option(
5,
help="Max noise parameter. Maximum value is alphabet size",
),
beam_width=Option(
1,
help="Width for beam search algorithm. Maximum value is alphabet size",
),
n_to_show=Option(
0,
help="Number of columns to visualize. Zero value means for no restrictions",
),
delimiter=Option(
"", help="Delimiter for columns visualization"
),
)
Send keyless reading API request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data_path |
Path
|
Path to file or dir for data. |
Argument(Ellipsis, help='Path to file or dir for data')
|
url |
str
|
API url. |
Option(var.FASTAPI_URL, help='API url')
|
separator |
str, default
|
Columns separator in the input files. |
Option(' ', help='Columns separator in the input files')
|
noisy |
bool, default
|
Indicates that input files are noisy texts. |
Option(False, help='Input files are noisy texts')
|
min_noise |
int, default
|
Min noise size per column. Minimum value is zero. |
Option(3, help='Min noise parameter. Minimum value is alphabet size')
|
max_noise |
int, default
|
Max noise size per column. Maximum value is alphabet size. |
Option(5, help='Max noise parameter. Maximum value is alphabet size')
|
beam_width |
int, default
|
Width for beam search algorithm. Maximum value is alphabet size. |
Option(1, help='Width for beam search algorithm. Maximum value is alphabet size')
|
n_to_show |
int, default
|
Number of columns to visualize. Zero value means for no restriction's. |
Option(0, help='Number of columns to visualize. Zero value means for no restrictions')
|
delimiter |
str, default
|
Delimiter for columns visualization. |
Option('', help='Delimiter for columns visualization')
|
Examples:
>>> trecover api recover examples/example_1.txt
╭──────────────────────────────────────────────────── example_1.txt ───────────────────────────────────────────────╮
│ Columns │
│ ajocmbfeafodadbddciafqnahdfeihhkieeaacacafkdchddakhecmmlibfinaehbcbdiicejkeahnfemaeaadbkagacbdmahbibacfddfbbbca… │
│ enpenkhgglrifflheioentrmjenkjnrmlhphdddeihliekeeeolflonpmctjolgkdeljjmljmmjiisjknjghgeelhkbddlpjjekrkdkilgiocii… │
│ gsxtoplqkrtknksinktipwvnlnqqrstotoqspoejtsnoiuoflpohvtovqeutunjojlmksonosskpvxporrltnfgoprdemstnshnssgnronjreqj… │
│ xvzwttqtxvxuoptowuxnxyzrwrrtwtyqwqvutrwrxvtxxwurrtqlwuqzvnwvxossmmpnutosuxlswyuvtttvqulrqzrrwuxtyqouwiuupwsxnrm… │
│ y y yz zy y w zy uz yys u tzs x u wx wy w tuvpuwu x yyowyz z wxyu xyy v yr t yvw… │
│ Predicted │
│ enpeoplearoundthecountrywereintothestreetstickedatheconvictionsspewditnessesinpentlandboardeddytheirwindowsbyra… │
│ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Elapsed: 4.716 s
Notes
A larger "beam_width" parameter value can improve keyless reading, but it will also take longer to compute.
Source code in src/trecover/app/cli/api.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 |
|
api_start
api_start(
host=Option(
var.FASTAPI_HOST,
"--host",
"-h",
help="Bind socket to this host.",
),
port=Option(
var.FASTAPI_PORT,
"--port",
"-p",
help="Bind socket to this port.",
),
loglevel=Option(
var.LogLevel.info,
"--loglevel",
"-l",
help="Logging level.",
),
concurrency=Option(
var.FASTAPI_WORKERS,
"-c",
help="The number of worker processes.",
),
attach=Option(
False,
"--attach",
"-a",
is_flag=True,
help="Attach output and error streams",
),
no_daemon=Option(
False,
"--no-daemon",
is_flag=True,
help="Do not run as a daemon process",
),
)
Start API service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
host |
str, default
|
Bind socket to this host. |
Option(var.FASTAPI_HOST, '--host', '-h', help='Bind socket to this host.')
|
port |
int, default
|
Bind socket to this port. |
Option(var.FASTAPI_PORT, '--port', '-p', help='Bind socket to this port.')
|
loglevel |
var.LogLevel
|
Level of logging. |
'debug'
|
concurrency |
int, default
|
The number of worker processes. |
Option(var.FASTAPI_WORKERS, '-c', help='The number of worker processes.')
|
attach |
bool, default
|
Attach output and error streams. |
Option(False, '--attach', '-a', is_flag=True, help='Attach output and error streams')
|
no_daemon |
bool, default
|
Do not run as a daemon process. |
Option(False, '--no-daemon', is_flag=True, help='Do not run as a daemon process')
|
Source code in src/trecover/app/cli/api.py
api_stop
Stop API service.
Source code in src/trecover/app/cli/api.py
api_status
Display API service status.
api_attach
api_attach(
live=Option(
False,
"--live",
"-l",
is_flag=True,
help="Stream only fresh log records",
)
)
Attach local output stream to a running API service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
live |
bool, Default
|
Stream only fresh log records |
Option(False, '--live', '-l', is_flag=True, help='Stream only fresh log records')
|