Skip to content

Commit

Permalink
2.2.0 - add ZeroShotTokenClassifier
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjoyo committed Apr 2, 2024
1 parent c74d835 commit c381017
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from abc import ABC, abstractmethod
from typing import Tuple

from pydantic import BaseModel


class TokenClassificationResult(BaseModel):
tags: list[Tuple[str, str]]


class ZeroShotTokenClassifier(ABC):
"""
Zero Shot Token Classification Model
"""

@abstractmethod
async def _do_classify(
self,
text: str,
classes: list[str],
confidence_threshold: float | None = None
) -> TokenClassificationResult:
pass

async def classify(
self,
text: str,
classes: list[str],
confidence_threshold: float | None = None
) -> TokenClassificationResult:
return await self._do_classify(
text=text,
classes=classes,
confidence_threshold=confidence_threshold
)
2 changes: 1 addition & 1 deletion bpm-ai-core/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "bpm-ai-core"
version = "2.1.0"
version = "2.2.0"
description = "Core AI abstractions and helpers."
authors = ["Bennet Krause <[email protected]>"]
repository = "https://github.com/holunda-io/bpm-ai"
Expand Down

0 comments on commit c381017

Please sign in to comment.