Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [sc-26082] Adopt CI/CD process to NameRank/NameAI rebrand #541

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
590f5ee
Added fixes for lambda
BanaSeba Dec 27, 2024
a0fcc9b
Added directory walk for lambda deployment for docker build
BanaSeba Dec 27, 2024
3d403f7
Fixed directory walk
BanaSeba Dec 27, 2024
73ffcb4
Fixed docker file path
BanaSeba Dec 27, 2024
f09bb9d
Another fix
BanaSeba Dec 27, 2024
d3eea95
Another path fix
BanaSeba Dec 27, 2024
7429145
Fixed path issues
BanaSeba Dec 27, 2024
5bb05cb
Fixed role name
BanaSeba Dec 27, 2024
5d4cb81
Fixed policy name for logging
BanaSeba Dec 27, 2024
054131f
extend pre-commit for namerank
Byczong Dec 30, 2024
c8c8102
copy namerank repo; adjust github workflows
Byczong Dec 30, 2024
7ec8fe9
fix ruff action version
Byczong Dec 30, 2024
e9a905b
add ruff, pytest cache to gitignore
Byczong Dec 30, 2024
25b68d0
rename workflows
Byczong Dec 30, 2024
9d81fa6
add lambda deploy for namerank
Byczong Dec 30, 2024
baf12ea
Fixed env variables (#522)
BanaSeba Jan 2, 2025
5c6900f
Merge branch 'byczong/sc-25983/add-namerank-to-monorepo' into staging
BanaSeba Jan 2, 2025
f90bc93
Added image digest to image uris for lambda deployments
BanaSeba Jan 9, 2025
15e9d2d
Merge branch 'sebastianbana/sc-26081/fix-namekit-lambda-deployments' …
BanaSeba Jan 9, 2025
8824ecc
Initial nameai CI/CD renaming
BanaSeba Jan 10, 2025
3d34e4e
Merge remote-tracking branch 'origin/main' into sebastianbana/sc-2608…
BanaSeba Jan 10, 2025
43e661a
Additional changes for CI/CD renaming
BanaSeba Jan 10, 2025
4281aab
Merge branch 'sebastianbana/sc-26082/adopt-ci-cd-process-to-namerank-…
BanaSeba Jan 10, 2025
0c3c891
Added distinct name for lambda logging role
BanaSeba Jan 10, 2025
0ba8b69
Another disicnt name for IAM policy
BanaSeba Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/namerank-python-unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:

- name: Install dependencies
working-directory: ./apps/api.namerank.io
run: poetry install
run: poetry install --extras "lambda"

- name: Run tests
working-directory: ./apps/api.namerank.io
Expand Down
2 changes: 1 addition & 1 deletion apps/api.nameguard.io/terraform/deploy_lambda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ if ! docker push ${ECR_URL}:latest; then
exit 1
fi

IMAGE_URI="${ECR_URL}:latest"
IMAGE_URI=`docker inspect --format='{{index .RepoDigests 0}}' ${ECR_URL}:latest`
echo "Using Image URI: ${IMAGE_URI}"

# Export individual environment variables for Terraform
Expand Down
2 changes: 1 addition & 1 deletion apps/api.namerank.io/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ WORKDIR /app
RUN yum install gcc -y
COPY pyproject.toml poetry.lock LICENSE README.md ./
COPY namerank ./namerank/
RUN pip install --no-cache-dir .[namerank]
RUN pip install --no-cache-dir .[lambda]
CMD [ "namerank.root_api.handler" ]
22 changes: 21 additions & 1 deletion apps/api.namerank.io/LICENSE
Original file line number Diff line number Diff line change
@@ -1 +1,21 @@
TODO
MIT License

Copyright (c) 2023 NameHash

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 3 additions & 3 deletions apps/api.namerank.io/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
## API
The API extends the NameGuard API and is fully compatible with it.

NameRank-specific endpoints are under the [rank.namekit.io/namerank](https://www.rank.namekit.io/namerank) path prefix.
NameRank-specific endpoints are under the [api.namerank.io/namerank](https://www.api.namerank.io/namerank) path prefix.

API documentation is available at [rank.namekit.io/namerank/docs](https://rank.namekit.io/namerank/docs) and [rank.namekit.io/docs](https://rank.namekit.io/docs) for NameGuard.
API documentation is available at [api.namerank.io/namerank/docs](https://api.namerank.io/namerank/docs) and [api.namerank.io/docs](https://api.namerank.io/docs) for NameGuard.

Lambda is publicly accessible under given domain [rank.namekit.io](https://rank.namekit.io)
Lambda is publicly accessible under given domain [api.namerank.io](https://api.namerank.io)

# AWS deploy
## Requirements
Expand Down
36 changes: 28 additions & 8 deletions apps/api.namerank.io/namerank/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,44 @@ class NLPLabelAnalysis(BaseModel):

inspection: inspector_models.InspectorResult = Field(description='The result of the label inspection')
status: LabelStatus = Field(description='The normalization status of the label')
probability: float = Field(description='The probability of the label')
log_probability: float = Field(description='The natural logarithm of the probability')
word_count: int = Field(description='The number of words in the label')
top_tokenization: Optional[list[str]] = Field(description='The most likely tokenization of the label')
tokenizations: list[dict] = Field(description='All possible tokenizations of the label')
probability: float = Field(
description='The probability that this label represents a meaningful word or phrase in natural language, based on statistical language models. Higher values indicate the label is more likely to be meaningful text rather than random characters.',
ge=0.0,
le=1.0,
)
log_probability: float = Field(
description='The natural logarithm of the probability score. Log probabilities are often more useful for comparing labels since they convert multiplicative relationships to additive ones and better handle very small probabilities.',
le=0.0,
)
word_count: int = Field(
description='The minimum number of words across all valid tokenizations of the label that contain no gaps. '
'Will be 0 if no valid tokenization without gaps is found. For example, labels containing only '
'numbers or special characters may have a word_count of 0.'
'Note: this is not the number of words in the top_tokenization, but the minimum number of words across all valid tokenizations without gaps.',
ge=0,
)
top_tokenization: Optional[list[str]] = Field(
description="The recommended tokenization of the label into words. We give priority to tokenizations that don't have gaps and have fewer words, even if they are less probable. Will be None if: "
'no valid tokenization is found, or the label is not normalized, or the tokenization process was interrupted by recursion limit, or word_count is 0. '
'When present, this contains the tokens from the tokenization with the fewest words (and highest probability among ties) that has no gaps.'
)
tokenizations: list[dict] = Field(
description='Up to 1000 possible tokenizations of the label, ordered by probability from highest to lowest. Each dict '
'contains the tokenization and its probability score. Will be an empty list if no valid '
'tokenizations are found. For very long or complex labels, not all possible tokenizations may be included.'
)


class NameRankReport(BaseModel):
purity_score: float = Field(
title='Purity score of the input',
description='For single labels, returns the score directly. For 2-label names (e.g., "nick.eth"), returns the score for the first label ("nick"). For 3 or more labels, returns 0. If the label is not inspected, this field will be 0.',
description='Score indicating the purity/cleanliness of the name. For single labels, returns the score directly. For 2-label names (e.g., "nick.eth"), returns the score for the first label ("nick"). For 3 or more labels, returns 0. If the label is not inspected, this field will be 0. The score ranges from 0.0 to 1.0 inclusive, where 0.0 indicates lowest purity and 1.0 indicates highest purity.',
ge=0.0,
le=1.0,
)

interesting_score: float = Field(
title='Interesting score of the input',
description='For single labels, returns the score directly. For 2-label names (e.g., "nick.eth"), returns the score for the first label ("nick"). For 3 or more labels, returns 0. If the label is not inspected, this field will be 0.',
description='Score indicating how interesting/memorable the name is. For single labels, returns the score directly. For 2-label names (e.g., "nick.eth"), returns the score for the first label ("nick"). For 3 or more labels, returns 0. If the label is not inspected, this field will be 0. The score ranges from 0.0 to 1.0 inclusive, where 0.0 indicates least interesting and 1.0 indicates most interesting.',
ge=0.0,
le=1.0,
)
Expand Down
6 changes: 3 additions & 3 deletions apps/api.namerank.io/namerank/root_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
from mangum import Mangum

# root app
app = nameguard_app
app = namerank_app

# namerank as sub-app
app.mount('/namerank', namerank_app)
# nameguard as sub-app
app.mount('/nameguard', nameguard_app)

handler = Mangum(app)
Loading
Loading