Skip to content

Commit

Permalink
Upgrade pydantic
Browse files Browse the repository at this point in the history
  • Loading branch information
Hironsan committed Jul 20, 2023
1 parent 6352807 commit 2759143
Show file tree
Hide file tree
Showing 2 changed files with 127 additions and 31 deletions.
148 changes: 121 additions & 27 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions auto_labeling_pipeline/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def get_all_subclasses(cls):
return all_subclasses

for subclass in get_all_subclasses(RequestModel):
if not hasattr(subclass, "Config"):
continue
if subclass.Config.title == model_name:
return subclass
raise NameError(f'{model_name} is not found.')
Expand Down Expand Up @@ -84,7 +86,7 @@ class GCPEntitiesRequestModel(RequestModel):

class Config:
title = 'GCP Entity Analysis'
schema_extra = {
json_schema_extra = {
# https://cloud.google.com/natural-language/docs/reference/rest/v1/Entity#Type
'types': [
'UNKNOWN', 'PERSON', 'LOCATION', 'ORGANIZATION', 'EVENT', 'WORK_OF_ART',
Expand Down Expand Up @@ -152,7 +154,7 @@ class AmazonComprehendSentimentRequestModel(AmazonComprehendRequestModel):

class Config:
title = 'Amazon Comprehend Sentiment Analysis'
schema_extra = {
json_schema_extra = {
# https://docs.aws.amazon.com/comprehend/latest/dg/how-sentiment.html
'types': [
'POSITIVE', 'NEGATIVE', 'NEUTRAL', 'MIXED'
Expand All @@ -175,7 +177,7 @@ class AmazonComprehendEntityRequestModel(AmazonComprehendRequestModel):

class Config:
title = 'Amazon Comprehend Entity Recognition'
schema_extra = {
json_schema_extra = {
# https://docs.aws.amazon.com/comprehend/latest/dg/how-entities.html
'types': [
'PERSON', 'LOCATION', 'ORGANIZATION', 'COMMERCIAL_ITEM',
Expand All @@ -200,7 +202,7 @@ class AmazonComprehendPIIEntityRequestModel(AmazonComprehendRequestModel):

class Config:
title = 'Amazon Comprehend PII Entity Recognition'
schema_extra = {
json_schema_extra = {
# https://docs.aws.amazon.com/comprehend/latest/dg/how-pii.html
'types': [
'BANK_ACCOUNT_NUMBER', 'BANK_ROUTING', 'CREDIT_DEBIT_NUMBER',
Expand Down

0 comments on commit 2759143

Please sign in to comment.