Tabular Tags
nyckel.TabularTagsFunction
Example:
from nyckel import Credentials, TabularTagsFunction, TabularTagsSample, TagsAnnotation, TabularFunctionField
credentials = Credentials(client_id="...", client_secret="...")
func = TabularTagsFunction.create("NewsTopics", credentials)
func.create_fields([
TabularFunctionField(type="Text", name="Title"),
TabularFunctionField(type="Text", name="Abstract")
])
func.create_samples([
TabularTagsSample(data={"Title": "New restaurant in SOHO", "Abstract": "This is the best..."}, annotation=[TagsAnnotation("Food"), TagsAnnotation("Reviews")]),
TabularTagsSample(data={"Title": "Belly-up still going strong", "Abstract": "The Belly-Up tavern in Solana..."}, annotation=[TagsAnnotation("Music"), TagsAnnotation("Reviews")]),
TabularTagsSample(data={"Title": "Carbonara at its best", "Abstract": "Here is how to make the best..."}, annotation=[TagsAnnotation("Food")]),
TabularTagsSample(data={"Title": "New album out!", "Abstract": "Taylor swift just released ..."}, annotation=[TagsAnnotation("Music")]),
])
predictions = func.invoke([{"Title": "Swedish meatballs: the best recipe", "Abstract": "This age-old Swedish classic ..."}])
Source code in src/nyckel/functions/tags/tabular_tags.py
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 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
|
__init__
__init__(function_id: NyckelId, credentials: Credentials)
Source code in src/nyckel/functions/tags/tabular_tags.py
create
classmethod
create(name: str, credentials: Credentials) -> TabularTagsFunction
delete
invoke
invoke(sample_data_list: List[TabularSampleData]) -> List[TagsPrediction]
has_trained_model
create_labels
create_labels(labels: Sequence[Union[ClassificationLabel, str]]) -> List[NyckelId]
Source code in src/nyckel/functions/tags/tabular_tags.py
list_labels
list_labels() -> List[ClassificationLabel]
read_label
read_label(label_id: NyckelId) -> ClassificationLabel
update_label
update_label(label: ClassificationLabel) -> ClassificationLabel
delete_labels
delete_labels(label_ids: List[NyckelId]) -> None
create_fields
create_fields(fields: List[TabularFunctionField]) -> List[NyckelId]
list_fields
read_field
read_field(field_id: NyckelId) -> TabularFunctionField
delete_field
delete_field(field_id: NyckelId) -> None
create_samples
create_samples(samples: Sequence[Union[TabularTagsSample, TabularSampleData]]) -> List[NyckelId]
Source code in src/nyckel/functions/tags/tabular_tags.py
list_samples
list_samples() -> List[TabularTagsSample]
Source code in src/nyckel/functions/tags/tabular_tags.py
read_sample
read_sample(sample_id: NyckelId) -> TabularTagsSample
Source code in src/nyckel/functions/tags/tabular_tags.py
update_annotation
update_annotation(sample: TabularTagsSample) -> None
nyckel.TabularTagsSample
dataclass
Source code in src/nyckel/functions/tags/tags.py
prediction
class-attribute
instance-attribute
prediction: Optional[List[ClassificationPrediction]] = None
__init__
__init__(data: TabularSampleData, id: Optional[NyckelId] = None, external_id: Optional[str] = None, annotation: Optional[List[TagsAnnotation]] = None, prediction: Optional[List[ClassificationPrediction]] = None) -> None
nyckel.TabularSampleData
module-attribute
TabularSampleData = Dict[TabularFieldKey, TabularFieldValue]