From 4c68b2df696cebbe05574d9dbb4c8a7069d28ee1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Bana=C5=9B?= <96051496+BanaSeba@users.noreply.github.com> Date: Thu, 9 Jan 2025 18:39:50 +0100 Subject: [PATCH 1/4] Added image digest to image uris for lambda deployments (#540) --- apps/api.nameguard.io/terraform/deploy_lambda.sh | 2 +- apps/api.namerank.io/terraform/deploy_lambda.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/api.nameguard.io/terraform/deploy_lambda.sh b/apps/api.nameguard.io/terraform/deploy_lambda.sh index 8ebd61aa..a744aefb 100644 --- a/apps/api.nameguard.io/terraform/deploy_lambda.sh +++ b/apps/api.nameguard.io/terraform/deploy_lambda.sh @@ -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 diff --git a/apps/api.namerank.io/terraform/deploy_lambda.sh b/apps/api.namerank.io/terraform/deploy_lambda.sh index 116ac781..90ff352c 100644 --- a/apps/api.namerank.io/terraform/deploy_lambda.sh +++ b/apps/api.namerank.io/terraform/deploy_lambda.sh @@ -215,7 +215,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 From b1742c9257d688bf4ee40cd447b23b4f2393e131 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Zawi=C5=9Blan?= <59446552+Byczong@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:02:08 +0100 Subject: [PATCH 2/4] feat: [sc-26077] Rename NameRank to NameAI (Python) (#539) * rename namerank outside of package * rename namerank package * fix api tests * rename namerank in code * revert renaming in deploy lambda * rename nameai.io to nameai.dev * rename nameai.io to nameai.dev * rename namerank --------- Co-authored-by: djstrong --- ...eploy.yml => nameai-api-lambda-deploy.yml} | 22 +++--- ...python-lint.yml => nameai-python-lint.yml} | 10 +-- ...tests.yml => nameai-python-unit-tests.yml} | 10 +-- .pre-commit-config.yaml | 4 +- .../.docker/config.json | 0 .../.env.example | 0 .../Dockerfile | 4 +- .../LICENSE | 0 .../README.md | 18 ++--- .../nameai}/__init__.py | 0 .../nameai}/all_tokenizer.py | 4 +- .../nameai}/config/__init__.py | 6 +- .../nameai}/config/prod_config.yaml | 0 .../nameai}/data/__init__.py | 0 .../nameai}/data/bigram_freq.csv | 0 .../nameai}/data/custom_dictionary.txt | 0 .../data/domain_specific_dictionary.txt | 0 .../nameai}/data/should_be_tokenized.txt | 0 ...ll_tokenizer.AllTokenizer.automaton.pickle | Bin ...nk.ngrams.Ngrams._bigrams_and_count.pickle | Bin ...k.ngrams.Ngrams._unigrams_and_count.pickle | Bin .../nameai}/data/tests/bigram_freq.csv | 0 .../nameai}/data/tests/custom_dictionary.txt | 0 .../data/tests/domain_specific_dictionary.txt | 0 .../nameai}/data/tests/empty.txt | 0 .../nameai}/data/tests/primary.csv | 0 .../nameai}/data/tests/unicode14.txt | 0 .../nameai}/data/tests/unicode15.txt | 0 .../nameai}/data/tests/unicode_numerics.txt | 0 .../nameai}/data/tests/unigram_freq.csv | 0 .../nameai}/data/tests/words.txt | 0 .../nameai}/data/unigram_freq.csv | 0 .../nameai}/data/words.txt | 0 .../nameai/generate_static_data.py | 5 ++ .../nameai}/models.py | 10 +-- .../nameai/name_ai.py} | 36 ++++----- .../nameai/nameai_api.py} | 24 +++--- .../nameai}/ngrams.py | 4 +- .../nameai}/nlp_inspector.py | 6 +- .../nameai}/root_api.py | 4 +- .../nameai}/scorer.py | 4 +- .../nameai}/static_property.py | 14 ++-- .../poetry.lock | 0 .../pyproject.toml | 10 +-- .../start-local.sh | 4 +- .../terraform/backend.tf | 0 .../terraform/deploy_lambda.sh | 0 .../terraform/main.tf | 0 .../terraform/modules/lambda_api/main.tf | 0 .../terraform/modules/lambda_api/variables.tf | 0 .../terraform/modules/lambda_api/versions.tf | 0 .../terraform/variables.tf | 0 .../tests/mocked_static_property.py | 2 +- .../tests/test_api.py | 12 +-- apps/api.nameai.dev/tests/test_nameai.py | 70 +++++++++++++++++ .../tests/test_ngrams.py | 10 +-- .../tests/test_nlp_inspector.py | 8 +- .../tests/test_tokenizer.py | 6 +- .../namerank/generate_static_data.py | 5 -- apps/api.namerank.io/tests/test_namerank.py | 72 ------------------ 60 files changed, 191 insertions(+), 193 deletions(-) rename .github/workflows/{namerank-api-lambda-deploy.yml => nameai-api-lambda-deploy.yml} (87%) rename .github/workflows/{namerank-python-lint.yml => nameai-python-lint.yml} (72%) rename .github/workflows/{namerank-python-unit-tests.yml => nameai-python-unit-tests.yml} (78%) rename apps/{api.namerank.io => api.nameai.dev}/.docker/config.json (100%) rename apps/{api.namerank.io => api.nameai.dev}/.env.example (100%) rename apps/{api.namerank.io => api.nameai.dev}/Dockerfile (75%) rename apps/{api.namerank.io => api.nameai.dev}/LICENSE (100%) rename apps/{api.namerank.io => api.nameai.dev}/README.md (86%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/__init__.py (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/all_tokenizer.py (97%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/config/__init__.py (75%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/config/prod_config.yaml (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/__init__.py (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/bigram_freq.csv (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/custom_dictionary.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/domain_specific_dictionary.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/should_be_tokenized.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/static/namerank.all_tokenizer.AllTokenizer.automaton.pickle (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/static/namerank.ngrams.Ngrams._bigrams_and_count.pickle (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/static/namerank.ngrams.Ngrams._unigrams_and_count.pickle (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/bigram_freq.csv (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/custom_dictionary.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/domain_specific_dictionary.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/empty.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/primary.csv (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/unicode14.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/unicode15.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/unicode_numerics.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/unigram_freq.csv (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/tests/words.txt (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/unigram_freq.csv (100%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/data/words.txt (100%) create mode 100644 apps/api.nameai.dev/nameai/generate_static_data.py rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/models.py (92%) rename apps/{api.namerank.io/namerank/namerank.py => api.nameai.dev/nameai/name_ai.py} (76%) rename apps/{api.namerank.io/namerank/namerank_api.py => api.nameai.dev/nameai/nameai_api.py} (87%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/ngrams.py (97%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/nlp_inspector.py (98%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/root_api.py (70%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/scorer.py (98%) rename apps/{api.namerank.io/namerank => api.nameai.dev/nameai}/static_property.py (81%) rename apps/{api.namerank.io => api.nameai.dev}/poetry.lock (100%) rename apps/{api.namerank.io => api.nameai.dev}/pyproject.toml (85%) rename apps/{api.namerank.io => api.nameai.dev}/start-local.sh (59%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/backend.tf (100%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/deploy_lambda.sh (100%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/main.tf (100%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/modules/lambda_api/main.tf (100%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/modules/lambda_api/variables.tf (100%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/modules/lambda_api/versions.tf (100%) rename apps/{api.namerank.io => api.nameai.dev}/terraform/variables.tf (100%) rename apps/{api.namerank.io => api.nameai.dev}/tests/mocked_static_property.py (79%) rename apps/{api.namerank.io => api.nameai.dev}/tests/test_api.py (87%) create mode 100644 apps/api.nameai.dev/tests/test_nameai.py rename apps/{api.namerank.io => api.nameai.dev}/tests/test_ngrams.py (96%) rename apps/{api.namerank.io => api.nameai.dev}/tests/test_nlp_inspector.py (93%) rename apps/{api.namerank.io => api.nameai.dev}/tests/test_tokenizer.py (97%) delete mode 100644 apps/api.namerank.io/namerank/generate_static_data.py delete mode 100644 apps/api.namerank.io/tests/test_namerank.py diff --git a/.github/workflows/namerank-api-lambda-deploy.yml b/.github/workflows/nameai-api-lambda-deploy.yml similarity index 87% rename from .github/workflows/namerank-api-lambda-deploy.yml rename to .github/workflows/nameai-api-lambda-deploy.yml index a443969c..b06c235e 100644 --- a/.github/workflows/namerank-api-lambda-deploy.yml +++ b/.github/workflows/nameai-api-lambda-deploy.yml @@ -1,4 +1,4 @@ -name: NameRank API - Lambda Deploy +name: NameAI API - Lambda Deploy on: push: @@ -6,9 +6,9 @@ on: - main - staging paths: - - "packages/namerank-python/**" - - "apps/api.namerank.io/**" - - ".github/workflows/namerank-api-lambda-deploy.yml" + - "packages/nameai-python/**" + - "apps/api.nameai.dev/**" + - ".github/workflows/nameai-api-lambda-deploy.yml" workflow_dispatch: permissions: @@ -24,7 +24,7 @@ concurrency: jobs: build-image-deploy: - name: Build and deploy NameRank API Lambda + name: Build and deploy NameAI API Lambda runs-on: ubuntu-latest steps: - name: Checkout this repo @@ -60,7 +60,7 @@ jobs: ENS_SUBGRAPH_URL_MAINNET: ${{ secrets.ENS_SUBGRAPH_URL_MAINNET }} ENS_SUBGRAPH_URL_SEPOLIA: ${{ secrets.ENS_SUBGRAPH_URL_SEPOLIA }} AWS_REGION: ${{ secrets.AWS_REGION }} - CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }} + CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }} # todo: rename secrets to NAMEAI_* (?) HOSTED_ZONE_NAME: ${{ secrets.NAMERANK_HOSTED_ZONE_NAME }} run: | if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then @@ -76,7 +76,7 @@ jobs: cd terraform chmod +x ./deploy_lambda.sh ./deploy_lambda.sh $STAGE $AWS_REGION $DOMAIN_NAME $CERTIFICATE_NAME $HOSTED_ZONE_NAME - working-directory: apps/api.namerank.io + working-directory: apps/api.nameai.dev notify: name: Send Slack deployment event notification @@ -87,21 +87,21 @@ jobs: if: ${{ needs.build-image-deploy.result == 'success'}} run: | echo "STATUS=Success :rocket:" >> $GITHUB_ENV - echo "TEXT=Lambda NameRank deployed successfully! :white_check_mark:" >> $GITHUB_ENV + echo "TEXT=Lambda NameAI deployed successfully! :white_check_mark:" >> $GITHUB_ENV echo "COLOR=good" >> $GITHUB_ENV - name: Output status on deployment failed if: ${{ needs.build-image-deploy.result == 'failure' }} run: | echo "STATUS=Failure :x:" >> $GITHUB_ENV - echo "TEXT=Lambda NameRank deployment failed! :rotating_light:" >> $GITHUB_ENV + echo "TEXT=Lambda NameAI deployment failed! :rotating_light:" >> $GITHUB_ENV echo "COLOR=danger" >> $GITHUB_ENV - name: Output status on deployment cancellation if: ${{ needs.build-image-deploy.result == 'cancelled' }} run: | echo "STATUS=Cancelled :no_entry_sign:" >> $GITHUB_ENV - echo "TEXT=Lambda NameRank deployment was cancelled. :warning:" >> $GITHUB_ENV + echo "TEXT=Lambda NameAI deployment was cancelled. :warning:" >> $GITHUB_ENV echo "COLOR=warning" >> $GITHUB_ENV - name: Send deployment status Slack notification @@ -113,7 +113,7 @@ jobs: { attachments: [{ color: '${{ env.COLOR }}', - title: 'Lambda NameRank deployment.', + title: 'Lambda NameAI deployment.', text: '${{ env.TEXT }}', fields: [ { diff --git a/.github/workflows/namerank-python-lint.yml b/.github/workflows/nameai-python-lint.yml similarity index 72% rename from .github/workflows/namerank-python-lint.yml rename to .github/workflows/nameai-python-lint.yml index aef4bd4d..20d1cc1f 100644 --- a/.github/workflows/namerank-python-lint.yml +++ b/.github/workflows/nameai-python-lint.yml @@ -1,14 +1,14 @@ -name: NameRank Python - Lint +name: NameAI Python - Lint on: push: branches: - main paths: - - "apps/api.namerank.io/**" + - "apps/api.nameai.dev/**" pull_request: branches: ["main", "staging"] paths: - - "apps/api.namerank.io/**" + - "apps/api.nameai.dev/**" jobs: lint: @@ -21,11 +21,11 @@ jobs: uses: chartboost/ruff-action@v1 with: version: 0.6.7 - src: "./apps/api.namerank.io" + src: "./apps/api.nameai.dev" - name: Ruff Format uses: chartboost/ruff-action@v1 with: version: 0.6.7 args: "format --check" - src: "./apps/api.namerank.io" + src: "./apps/api.nameai.dev" diff --git a/.github/workflows/namerank-python-unit-tests.yml b/.github/workflows/nameai-python-unit-tests.yml similarity index 78% rename from .github/workflows/namerank-python-unit-tests.yml rename to .github/workflows/nameai-python-unit-tests.yml index 9bdd496b..43c52086 100644 --- a/.github/workflows/namerank-python-unit-tests.yml +++ b/.github/workflows/nameai-python-unit-tests.yml @@ -1,17 +1,17 @@ -name: NameRank Python - Unit Tests +name: NameAI Python - Unit Tests on: push: branches: - main paths: - - "apps/api.namerank.io/**" + - "apps/api.nameai.dev/**" pull_request: branches: - main - staging paths: - - "apps/api.namerank.io/**" + - "apps/api.nameai.dev/**" jobs: test: @@ -36,9 +36,9 @@ jobs: cache: "poetry" - name: Install dependencies - working-directory: ./apps/api.namerank.io + working-directory: ./apps/api.nameai.dev run: poetry install --extras "lambda" - name: Run tests - working-directory: ./apps/api.namerank.io + working-directory: ./apps/api.nameai.dev run: poetry run pytest -vv diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 07c54bd8..8c2d3702 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,6 +4,6 @@ repos: hooks: - id: ruff args: [ --fix ] - files: '^(packages/nameguard-python|apps/api.namerank.io)/.*\.py' + files: '^(packages/nameguard-python|apps/api.nameai.dev)/.*\.py' - id: ruff-format - files: '^(packages/nameguard-python|apps/api.namerank.io)/.*\.py' + files: '^(packages/nameguard-python|apps/api.nameai.dev)/.*\.py' diff --git a/apps/api.namerank.io/.docker/config.json b/apps/api.nameai.dev/.docker/config.json similarity index 100% rename from apps/api.namerank.io/.docker/config.json rename to apps/api.nameai.dev/.docker/config.json diff --git a/apps/api.namerank.io/.env.example b/apps/api.nameai.dev/.env.example similarity index 100% rename from apps/api.namerank.io/.env.example rename to apps/api.nameai.dev/.env.example diff --git a/apps/api.namerank.io/Dockerfile b/apps/api.nameai.dev/Dockerfile similarity index 75% rename from apps/api.namerank.io/Dockerfile rename to apps/api.nameai.dev/Dockerfile index 7f4f4940..87affa17 100644 --- a/apps/api.namerank.io/Dockerfile +++ b/apps/api.nameai.dev/Dockerfile @@ -2,6 +2,6 @@ FROM --platform=linux/arm64 public.ecr.aws/lambda/python:3.11 WORKDIR /app RUN yum install gcc -y COPY pyproject.toml poetry.lock LICENSE README.md ./ -COPY namerank ./namerank/ +COPY nameai ./nameai/ RUN pip install --no-cache-dir .[lambda] -CMD [ "namerank.root_api.handler" ] \ No newline at end of file +CMD [ "nameai.root_api.handler" ] \ No newline at end of file diff --git a/apps/api.namerank.io/LICENSE b/apps/api.nameai.dev/LICENSE similarity index 100% rename from apps/api.namerank.io/LICENSE rename to apps/api.nameai.dev/LICENSE diff --git a/apps/api.namerank.io/README.md b/apps/api.nameai.dev/README.md similarity index 86% rename from apps/api.namerank.io/README.md rename to apps/api.nameai.dev/README.md index 04440a1d..955dcdf1 100644 --- a/apps/api.namerank.io/README.md +++ b/apps/api.nameai.dev/README.md @@ -1,13 +1,13 @@ -# NameRank +# NameAI ## API The API extends the NameGuard API and is fully compatible with it. -NameRank-specific endpoints are under the [api.namerank.io/namerank](https://www.api.namerank.io/namerank) path prefix. +NameAI-specific endpoints are under the [api.nameai.dev/nameai](https://www.api.nameai.dev/nameai) path prefix. -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. +API documentation is available at [api.nameai.dev/nameai/docs](https://api.nameai.dev/nameai/docs) and [api.nameai.dev/docs](https://api.nameai.dev/docs) for NameGuard. -Lambda is publicly accessible under given domain [api.namerank.io](https://api.namerank.io) +Lambda is publicly accessible under given domain [api.nameai.dev](https://api.nameai.dev) # AWS deploy ## Requirements @@ -94,16 +94,16 @@ You can add these secrets in your GitHub repository settings under the "Secrets" # Getting Started -This section is describing how to setup running NameRank instance on local environment +This section is describing how to setup running NameAI instance on local environment ## Environment variables -NameRank requires certain env variables propagated for it's NameGuard subcomponent. +NameAI requires certain env variables propagated for it's NameGuard subcomponent. Those variables are defined and described in [.env.example](./.env.example) file which is a point of reference. -Script responsible for running local NameRank instance is expecting those variables to be poulated in .env file before execution. +Script responsible for running local NameAI instance is expecting those variables to be poulated in .env file before execution. ## Requirements python3 with pip installed on local env ## Scripts -Running [start-local.sh](./start-local.sh) script will result in creating running NameRank instance on local environment. -This instance can be reached under [localhost:8000](localhost:8000) \ No newline at end of file +Running [start-local.sh](./start-local.sh) script will result in creating running NameAI instance on local environment. +This instance can be reached under [localhost:8000](localhost:8000) diff --git a/apps/api.namerank.io/namerank/__init__.py b/apps/api.nameai.dev/nameai/__init__.py similarity index 100% rename from apps/api.namerank.io/namerank/__init__.py rename to apps/api.nameai.dev/nameai/__init__.py diff --git a/apps/api.namerank.io/namerank/all_tokenizer.py b/apps/api.nameai.dev/nameai/all_tokenizer.py similarity index 97% rename from apps/api.namerank.io/namerank/all_tokenizer.py rename to apps/api.nameai.dev/nameai/all_tokenizer.py index b3b863a6..1d801d3e 100644 --- a/apps/api.namerank.io/namerank/all_tokenizer.py +++ b/apps/api.nameai.dev/nameai/all_tokenizer.py @@ -2,8 +2,8 @@ from typing import Tuple, Iterable import ahocorasick -from namerank.data import get_resource_path -from namerank.static_property import static_property +from nameai.data import get_resource_path +from nameai.static_property import static_property class Gap(str): diff --git a/apps/api.namerank.io/namerank/config/__init__.py b/apps/api.nameai.dev/nameai/config/__init__.py similarity index 75% rename from apps/api.namerank.io/namerank/config/__init__.py rename to apps/api.nameai.dev/nameai/config/__init__.py index 7ff67b6f..d382473e 100644 --- a/apps/api.namerank.io/namerank/config/__init__.py +++ b/apps/api.nameai.dev/nameai/config/__init__.py @@ -6,13 +6,13 @@ @contextmanager -def initialize_namerank_config(config_name: Literal['prod_config']): - with initialize_config_module(version_base=None, config_module='namerank.config'): +def initialize_nameai_config(config_name: Literal['prod_config']): + with initialize_config_module(version_base=None, config_module='nameai.config'): config = compose(config_name=config_name) yield config -def load_namerank_config(config_name: Literal['prod_config']): +def load_nameai_config(config_name: Literal['prod_config']): config_path = Path(__file__).parent / (config_name + '.yaml') with config_path.open('r') as f: config = omegaconf.OmegaConf.load(f) diff --git a/apps/api.namerank.io/namerank/config/prod_config.yaml b/apps/api.nameai.dev/nameai/config/prod_config.yaml similarity index 100% rename from apps/api.namerank.io/namerank/config/prod_config.yaml rename to apps/api.nameai.dev/nameai/config/prod_config.yaml diff --git a/apps/api.namerank.io/namerank/data/__init__.py b/apps/api.nameai.dev/nameai/data/__init__.py similarity index 100% rename from apps/api.namerank.io/namerank/data/__init__.py rename to apps/api.nameai.dev/nameai/data/__init__.py diff --git a/apps/api.namerank.io/namerank/data/bigram_freq.csv b/apps/api.nameai.dev/nameai/data/bigram_freq.csv similarity index 100% rename from apps/api.namerank.io/namerank/data/bigram_freq.csv rename to apps/api.nameai.dev/nameai/data/bigram_freq.csv diff --git a/apps/api.namerank.io/namerank/data/custom_dictionary.txt b/apps/api.nameai.dev/nameai/data/custom_dictionary.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/custom_dictionary.txt rename to apps/api.nameai.dev/nameai/data/custom_dictionary.txt diff --git a/apps/api.namerank.io/namerank/data/domain_specific_dictionary.txt b/apps/api.nameai.dev/nameai/data/domain_specific_dictionary.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/domain_specific_dictionary.txt rename to apps/api.nameai.dev/nameai/data/domain_specific_dictionary.txt diff --git a/apps/api.namerank.io/namerank/data/should_be_tokenized.txt b/apps/api.nameai.dev/nameai/data/should_be_tokenized.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/should_be_tokenized.txt rename to apps/api.nameai.dev/nameai/data/should_be_tokenized.txt diff --git a/apps/api.namerank.io/namerank/data/static/namerank.all_tokenizer.AllTokenizer.automaton.pickle b/apps/api.nameai.dev/nameai/data/static/namerank.all_tokenizer.AllTokenizer.automaton.pickle similarity index 100% rename from apps/api.namerank.io/namerank/data/static/namerank.all_tokenizer.AllTokenizer.automaton.pickle rename to apps/api.nameai.dev/nameai/data/static/namerank.all_tokenizer.AllTokenizer.automaton.pickle diff --git a/apps/api.namerank.io/namerank/data/static/namerank.ngrams.Ngrams._bigrams_and_count.pickle b/apps/api.nameai.dev/nameai/data/static/namerank.ngrams.Ngrams._bigrams_and_count.pickle similarity index 100% rename from apps/api.namerank.io/namerank/data/static/namerank.ngrams.Ngrams._bigrams_and_count.pickle rename to apps/api.nameai.dev/nameai/data/static/namerank.ngrams.Ngrams._bigrams_and_count.pickle diff --git a/apps/api.namerank.io/namerank/data/static/namerank.ngrams.Ngrams._unigrams_and_count.pickle b/apps/api.nameai.dev/nameai/data/static/namerank.ngrams.Ngrams._unigrams_and_count.pickle similarity index 100% rename from apps/api.namerank.io/namerank/data/static/namerank.ngrams.Ngrams._unigrams_and_count.pickle rename to apps/api.nameai.dev/nameai/data/static/namerank.ngrams.Ngrams._unigrams_and_count.pickle diff --git a/apps/api.namerank.io/namerank/data/tests/bigram_freq.csv b/apps/api.nameai.dev/nameai/data/tests/bigram_freq.csv similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/bigram_freq.csv rename to apps/api.nameai.dev/nameai/data/tests/bigram_freq.csv diff --git a/apps/api.namerank.io/namerank/data/tests/custom_dictionary.txt b/apps/api.nameai.dev/nameai/data/tests/custom_dictionary.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/custom_dictionary.txt rename to apps/api.nameai.dev/nameai/data/tests/custom_dictionary.txt diff --git a/apps/api.namerank.io/namerank/data/tests/domain_specific_dictionary.txt b/apps/api.nameai.dev/nameai/data/tests/domain_specific_dictionary.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/domain_specific_dictionary.txt rename to apps/api.nameai.dev/nameai/data/tests/domain_specific_dictionary.txt diff --git a/apps/api.namerank.io/namerank/data/tests/empty.txt b/apps/api.nameai.dev/nameai/data/tests/empty.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/empty.txt rename to apps/api.nameai.dev/nameai/data/tests/empty.txt diff --git a/apps/api.namerank.io/namerank/data/tests/primary.csv b/apps/api.nameai.dev/nameai/data/tests/primary.csv similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/primary.csv rename to apps/api.nameai.dev/nameai/data/tests/primary.csv diff --git a/apps/api.namerank.io/namerank/data/tests/unicode14.txt b/apps/api.nameai.dev/nameai/data/tests/unicode14.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/unicode14.txt rename to apps/api.nameai.dev/nameai/data/tests/unicode14.txt diff --git a/apps/api.namerank.io/namerank/data/tests/unicode15.txt b/apps/api.nameai.dev/nameai/data/tests/unicode15.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/unicode15.txt rename to apps/api.nameai.dev/nameai/data/tests/unicode15.txt diff --git a/apps/api.namerank.io/namerank/data/tests/unicode_numerics.txt b/apps/api.nameai.dev/nameai/data/tests/unicode_numerics.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/unicode_numerics.txt rename to apps/api.nameai.dev/nameai/data/tests/unicode_numerics.txt diff --git a/apps/api.namerank.io/namerank/data/tests/unigram_freq.csv b/apps/api.nameai.dev/nameai/data/tests/unigram_freq.csv similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/unigram_freq.csv rename to apps/api.nameai.dev/nameai/data/tests/unigram_freq.csv diff --git a/apps/api.namerank.io/namerank/data/tests/words.txt b/apps/api.nameai.dev/nameai/data/tests/words.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/tests/words.txt rename to apps/api.nameai.dev/nameai/data/tests/words.txt diff --git a/apps/api.namerank.io/namerank/data/unigram_freq.csv b/apps/api.nameai.dev/nameai/data/unigram_freq.csv similarity index 100% rename from apps/api.namerank.io/namerank/data/unigram_freq.csv rename to apps/api.nameai.dev/nameai/data/unigram_freq.csv diff --git a/apps/api.namerank.io/namerank/data/words.txt b/apps/api.nameai.dev/nameai/data/words.txt similarity index 100% rename from apps/api.namerank.io/namerank/data/words.txt rename to apps/api.nameai.dev/nameai/data/words.txt diff --git a/apps/api.nameai.dev/nameai/generate_static_data.py b/apps/api.nameai.dev/nameai/generate_static_data.py new file mode 100644 index 00000000..546f0baf --- /dev/null +++ b/apps/api.nameai.dev/nameai/generate_static_data.py @@ -0,0 +1,5 @@ +from nameai.static_property import generate_static_data + + +if __name__ == '__main__': + generate_static_data() diff --git a/apps/api.namerank.io/namerank/models.py b/apps/api.nameai.dev/nameai/models.py similarity index 92% rename from apps/api.namerank.io/namerank/models.py rename to apps/api.nameai.dev/nameai/models.py index 098b2b1f..532857df 100644 --- a/apps/api.namerank.io/namerank/models.py +++ b/apps/api.nameai.dev/nameai/models.py @@ -46,7 +46,7 @@ class NLPLabelAnalysis(BaseModel): ) -class NameRankReport(BaseModel): +class NameAIReport(BaseModel): purity_score: float = Field( title='Purity score of the input', 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.', @@ -64,14 +64,14 @@ class NameRankReport(BaseModel): ) -class NameRankRequest(inspector_models.InspectorSingleRequest): +class NameAIRequest(inspector_models.InspectorSingleRequest): pass -class NameRankResponse(BaseModel): +class NameAIResponse(BaseModel): """ - Represents the combined response from NameRank and NameGuard analyses. + Represents the combined response from NameAI and NameGuard analyses. """ - namerank: NameRankReport = Field(description='The NameRank analysis report on the first label of the input name') + nameai: NameAIReport = Field(description='The NameAI analysis report on the first label of the input name') nameguard: NameGuardReport = Field(description='The NameGuard analysis report') diff --git a/apps/api.namerank.io/namerank/namerank.py b/apps/api.nameai.dev/nameai/name_ai.py similarity index 76% rename from apps/api.namerank.io/namerank/namerank.py rename to apps/api.nameai.dev/nameai/name_ai.py index ed0a3d7f..7d556e1a 100644 --- a/apps/api.namerank.io/namerank/namerank.py +++ b/apps/api.nameai.dev/nameai/name_ai.py @@ -1,31 +1,31 @@ -from namerank.nlp_inspector import NLPInspector -from namerank.scorer import Scorer -from namerank.config import load_namerank_config -from namerank.models import ( - NameRankResponse, - NameRankReport, +from nameai.nlp_inspector import NLPInspector +from nameai.scorer import Scorer +from nameai.config import load_nameai_config +from nameai.models import ( + NameAIResponse, + NameAIReport, NLPLabelAnalysis, ) from nameguard import NameGuard -class NameRank: +class NameAI: def __init__(self, config=None): if config is None: - config = load_namerank_config('prod_config') + config = load_nameai_config('prod_config') self.nlp_inspector = NLPInspector(config) self.nameguard = NameGuard() self.scorer = Scorer() - def inspect_label(self, label: str) -> NameRankResponse: + def inspect_label(self, label: str) -> NameAIResponse: nameguard_report = self.nameguard.inspect_name_sync(label) if nameguard_report.inspected: nlp_analysis = self.nlp_inspector.nlp_analyse_label(label) purity, interesting = self.scorer.score_label(nlp_analysis) - namerank_report = NameRankReport( + nameai_report = NameAIReport( purity_score=purity, interesting_score=interesting, analysis=NLPLabelAnalysis( @@ -39,18 +39,18 @@ def inspect_label(self, label: str) -> NameRankResponse: ), ) else: - namerank_report = NameRankReport( + nameai_report = NameAIReport( purity_score=0, interesting_score=0, analysis=None, ) - return NameRankResponse( - namerank=namerank_report, + return NameAIResponse( + nameai=nameai_report, nameguard=nameguard_report, ) - def inspect_name(self, name: str) -> NameRankResponse: + def inspect_name(self, name: str) -> NameAIResponse: labels = [] if len(name) == 0 else name.split('.') if len(labels) == 0: @@ -65,7 +65,7 @@ def inspect_name(self, name: str) -> NameRankResponse: nameguard_report = self.nameguard.inspect_name_sync(labels[0]) if nameguard_report.inspected: nlp_analysis = self.nlp_inspector.nlp_analyse_label(labels[0]) - namerank_report = NameRankReport( + nameai_report = NameAIReport( purity_score=0, interesting_score=0, analysis=NLPLabelAnalysis( @@ -79,13 +79,13 @@ def inspect_name(self, name: str) -> NameRankResponse: ), ) else: - namerank_report = NameRankReport( + nameai_report = NameAIReport( purity_score=0, interesting_score=0, analysis=None, ) - return NameRankResponse( - namerank=namerank_report, + return NameAIResponse( + nameai=nameai_report, nameguard=nameguard_report, ) diff --git a/apps/api.namerank.io/namerank/namerank_api.py b/apps/api.nameai.dev/nameai/nameai_api.py similarity index 87% rename from apps/api.namerank.io/namerank/namerank_api.py rename to apps/api.nameai.dev/nameai/nameai_api.py index 64c33375..298026e4 100644 --- a/apps/api.namerank.io/namerank/namerank_api.py +++ b/apps/api.nameai.dev/nameai/nameai_api.py @@ -2,8 +2,8 @@ from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel, Field from enum import Enum -from namerank.namerank import NameRank -from namerank.models import NameRankResponse +from nameai.name_ai import NameAI +from nameai.models import NameAIResponse class ApiVersion(str, Enum): @@ -11,12 +11,12 @@ class ApiVersion(str, Enum): app = FastAPI( - title='NameRank API', + title='NameAI API', version=ApiVersion.V08_BETA.value, - description="""Welcome to NameRank, an extension of NameGuard developed by [NameHash Labs](https://namehashlabs.org) to provide NLP analysis and scoring for Ethereum Name Service (ENS) names. + description="""Welcome to NameAI, an extension of NameGuard developed by [NameHash Labs](https://namehashlabs.org) to provide NLP analysis and scoring for Ethereum Name Service (ENS) names. ## Documentation -These documentation pages focus specifically on the NameRank API. For information on the NameGuard Library, SDK, and UI Kit, please refer to the [NameKit GitHub repository](https://github.com/namehash/namekit). +These documentation pages focus specifically on the NameAI API. For information on the NameGuard Library, SDK, and UI Kit, please refer to the [NameKit GitHub repository](https://github.com/namehash/namekit). """, ) @@ -29,7 +29,7 @@ class ApiVersion(str, Enum): allow_headers=['*'], ) -nrank = NameRank() +nrank = NameAI() # -- inspect-label -- @@ -52,7 +52,7 @@ async def inspect_label_get( description='Label to inspect. Should be url-encoded (except when using the Swagger UI).', examples=['vitalìk'], ), -) -> NameRankResponse: +) -> NameAIResponse: """ ## Inspects a single label with NameRank and NameGuard. @@ -71,7 +71,7 @@ async def inspect_label_get( tags=['label'], summary='Inspect Label', ) -async def inspect_label_post(request: InspectLabelRequest) -> NameRankResponse: +async def inspect_label_post(request: InspectLabelRequest) -> NameAIResponse: """ ## Inspects a single label with NameRank and NameGuard. @@ -86,7 +86,7 @@ async def inspect_label_post(request: InspectLabelRequest) -> NameRankResponse: @app.get('/inspect-label', include_in_schema=False) -async def inspect_label_empty() -> NameRankResponse: +async def inspect_label_empty() -> NameAIResponse: return nrank.inspect_label('') @@ -110,7 +110,7 @@ async def inspect_name_get( description='**Name should be url-encoded (except when using the Swagger UI). Name can be empty.**', examples=['vitalìk.eth'], ), -) -> NameRankResponse: +) -> NameAIResponse: """ ## Inspects a single name with NameRank and NameGuard. @@ -138,7 +138,7 @@ async def inspect_name_get( tags=['name'], summary='Inspect Name', ) -async def inspect_name_post(request: InspectNameRequest) -> NameRankResponse: +async def inspect_name_post(request: InspectNameRequest) -> NameAIResponse: """ ## Inspects a single name with NameRank and NameGuard. @@ -162,5 +162,5 @@ async def inspect_name_post(request: InspectNameRequest) -> NameRankResponse: @app.get('/inspect-name', include_in_schema=False) -async def inspect_name_empty() -> NameRankResponse: +async def inspect_name_empty() -> NameAIResponse: return nrank.inspect_name('') diff --git a/apps/api.namerank.io/namerank/ngrams.py b/apps/api.nameai.dev/nameai/ngrams.py similarity index 97% rename from apps/api.namerank.io/namerank/ngrams.py rename to apps/api.nameai.dev/nameai/ngrams.py index 5f40a84f..42124dfb 100644 --- a/apps/api.namerank.io/namerank/ngrams.py +++ b/apps/api.nameai.dev/nameai/ngrams.py @@ -1,8 +1,8 @@ import csv import math from typing import Optional -from namerank.data import get_resource_path -from namerank.static_property import static_property +from nameai.data import get_resource_path +from nameai.static_property import static_property ALPHA = 0.4 diff --git a/apps/api.namerank.io/namerank/nlp_inspector.py b/apps/api.nameai.dev/nameai/nlp_inspector.py similarity index 98% rename from apps/api.namerank.io/namerank/nlp_inspector.py rename to apps/api.nameai.dev/nameai/nlp_inspector.py index a5d005aa..7167c9da 100644 --- a/apps/api.namerank.io/namerank/nlp_inspector.py +++ b/apps/api.nameai.dev/nameai/nlp_inspector.py @@ -4,12 +4,12 @@ from label_inspector.inspector import Inspector from label_inspector.config import initialize_inspector_config -from namerank.models import ( +from nameai.models import ( NLPLabelAnalysis, LabelStatus, ) -from namerank.all_tokenizer import AllTokenizer -from namerank.ngrams import Ngrams +from nameai.all_tokenizer import AllTokenizer +from nameai.ngrams import Ngrams def init_inspector(): diff --git a/apps/api.namerank.io/namerank/root_api.py b/apps/api.nameai.dev/nameai/root_api.py similarity index 70% rename from apps/api.namerank.io/namerank/root_api.py rename to apps/api.nameai.dev/nameai/root_api.py index 444dc637..cc84f524 100644 --- a/apps/api.namerank.io/namerank/root_api.py +++ b/apps/api.nameai.dev/nameai/root_api.py @@ -1,9 +1,9 @@ -from namerank.namerank_api import app as namerank_app +from nameai.nameai_api import app as nameai_app from nameguard.web_api import app as nameguard_app from mangum import Mangum # root app -app = namerank_app +app = nameai_app # nameguard as sub-app app.mount('/nameguard', nameguard_app) diff --git a/apps/api.namerank.io/namerank/scorer.py b/apps/api.nameai.dev/nameai/scorer.py similarity index 98% rename from apps/api.namerank.io/namerank/scorer.py rename to apps/api.nameai.dev/nameai/scorer.py index ff22206a..eea1677d 100644 --- a/apps/api.namerank.io/namerank/scorer.py +++ b/apps/api.nameai.dev/nameai/scorer.py @@ -1,7 +1,7 @@ from typing import Optional, Tuple import re -from namerank.models import NLPLabelAnalysis +from nameai.models import NLPLabelAnalysis IS_NAMEHASH_REGEX = re.compile(r'^\[[0-9a-f]{64}\]$') @@ -120,7 +120,7 @@ def label_contains_simple_number(self, label_analysis: NLPLabelAnalysis) -> bool def word_count(self, label_analysis: NLPLabelAnalysis) -> Optional[int]: return label_analysis.word_count - def short_label_bonus(self, label_analysis: NLPLabelAnalysis) -> int: + def short_label_bonus(self, label_analysis: NLPLabelAnalysis) -> float: return 1 - ( min(self.label_length(label_analysis), 99) / 100 + min(len(label_analysis.inspection.label), 99) / 10000 diff --git a/apps/api.namerank.io/namerank/static_property.py b/apps/api.nameai.dev/nameai/static_property.py similarity index 81% rename from apps/api.namerank.io/namerank/static_property.py rename to apps/api.nameai.dev/nameai/static_property.py index 417775ea..02bbd5b1 100644 --- a/apps/api.namerank.io/namerank/static_property.py +++ b/apps/api.nameai.dev/nameai/static_property.py @@ -3,8 +3,8 @@ import os import pickle import shutil -from namerank.data import get_resource_path -from namerank.config import initialize_namerank_config +from nameai.data import get_resource_path +from nameai.config import initialize_nameai_config R = TypeVar('R') @@ -16,8 +16,8 @@ def static_property(func: Callable[..., R]) -> cached_property[R]: """ Works like functools.cached_property, but uses pickle to store the value. - Data is generated manually with `python -m namerank.generate_static_data`. - The pickle path is `namerank/data/static/{module}.{class}.{func}.pickle`. + Data is generated manually with `python -m nameai.generate_static_data`. + The pickle path is `nameai/data/static/{module}.{class}.{func}.pickle`. """ pickle_name = f'{func.__module__}.{func.__qualname__}' @@ -32,7 +32,7 @@ def wrapper(self): except FileNotFoundError: raise FileNotFoundError( f'Static data file for {pickle_name} not found. ' - 'Run `python -m namerank.generate_static_data` to generate it.' + 'Run `python -m nameai.generate_static_data` to generate it.' ) # register function for static data generation @@ -48,11 +48,11 @@ def generate_static_data(): Generates static data for all registered static_property functions. Writes the data to `{DATA_DIR}/{module}.{class}.{func}.pickle` """ - with initialize_namerank_config('prod_config') as config: + with initialize_nameai_config('prod_config') as config: print('Removing old static data') shutil.rmtree(DATA_DIR, ignore_errors=True) os.makedirs(DATA_DIR, exist_ok=False) - import namerank.namerank # noqa: F401 + import nameai.name_ai # noqa: F401 for module, class_name, func_name, func in REGISTERED_FUNCTIONS: print(f'Generating {module}.{class_name}.{func_name}') diff --git a/apps/api.namerank.io/poetry.lock b/apps/api.nameai.dev/poetry.lock similarity index 100% rename from apps/api.namerank.io/poetry.lock rename to apps/api.nameai.dev/poetry.lock diff --git a/apps/api.namerank.io/pyproject.toml b/apps/api.nameai.dev/pyproject.toml similarity index 85% rename from apps/api.namerank.io/pyproject.toml rename to apps/api.nameai.dev/pyproject.toml index d524bcf1..9cf00d24 100644 --- a/apps/api.namerank.io/pyproject.toml +++ b/apps/api.nameai.dev/pyproject.toml @@ -1,14 +1,14 @@ [tool.poetry] -name = "namerank" +name = "nameai" version = "0.1.4" -description = "NameHash NameRank API" +description = "NameHash NameAI API" authors = ["NameHash Team "] maintainers = ["NameHash Team "] -homepage = "https://www.namerank.io/" -repository = "https://github.com/namehash/namerank" +homepage = "https://www.nameai.dev/" +repository = "https://github.com/namehash/nameai" readme = "README.md" license = "LICENSE" -packages = [{ include = "namerank" }] +packages = [{ include = "nameai" }] [tool.poetry.dependencies] diff --git a/apps/api.namerank.io/start-local.sh b/apps/api.nameai.dev/start-local.sh similarity index 59% rename from apps/api.namerank.io/start-local.sh rename to apps/api.nameai.dev/start-local.sh index 3f5ee074..d9349784 100644 --- a/apps/api.namerank.io/start-local.sh +++ b/apps/api.nameai.dev/start-local.sh @@ -2,5 +2,5 @@ source .env pip install --upgrade pip pip install poetry pip install uvicorn -pip install .[namerank] -uvicorn namerank.root_api:app \ No newline at end of file +pip install .[lambda] +uvicorn nameai.root_api:app \ No newline at end of file diff --git a/apps/api.namerank.io/terraform/backend.tf b/apps/api.nameai.dev/terraform/backend.tf similarity index 100% rename from apps/api.namerank.io/terraform/backend.tf rename to apps/api.nameai.dev/terraform/backend.tf diff --git a/apps/api.namerank.io/terraform/deploy_lambda.sh b/apps/api.nameai.dev/terraform/deploy_lambda.sh similarity index 100% rename from apps/api.namerank.io/terraform/deploy_lambda.sh rename to apps/api.nameai.dev/terraform/deploy_lambda.sh diff --git a/apps/api.namerank.io/terraform/main.tf b/apps/api.nameai.dev/terraform/main.tf similarity index 100% rename from apps/api.namerank.io/terraform/main.tf rename to apps/api.nameai.dev/terraform/main.tf diff --git a/apps/api.namerank.io/terraform/modules/lambda_api/main.tf b/apps/api.nameai.dev/terraform/modules/lambda_api/main.tf similarity index 100% rename from apps/api.namerank.io/terraform/modules/lambda_api/main.tf rename to apps/api.nameai.dev/terraform/modules/lambda_api/main.tf diff --git a/apps/api.namerank.io/terraform/modules/lambda_api/variables.tf b/apps/api.nameai.dev/terraform/modules/lambda_api/variables.tf similarity index 100% rename from apps/api.namerank.io/terraform/modules/lambda_api/variables.tf rename to apps/api.nameai.dev/terraform/modules/lambda_api/variables.tf diff --git a/apps/api.namerank.io/terraform/modules/lambda_api/versions.tf b/apps/api.nameai.dev/terraform/modules/lambda_api/versions.tf similarity index 100% rename from apps/api.namerank.io/terraform/modules/lambda_api/versions.tf rename to apps/api.nameai.dev/terraform/modules/lambda_api/versions.tf diff --git a/apps/api.namerank.io/terraform/variables.tf b/apps/api.nameai.dev/terraform/variables.tf similarity index 100% rename from apps/api.namerank.io/terraform/variables.tf rename to apps/api.nameai.dev/terraform/variables.tf diff --git a/apps/api.namerank.io/tests/mocked_static_property.py b/apps/api.nameai.dev/tests/mocked_static_property.py similarity index 79% rename from apps/api.namerank.io/tests/mocked_static_property.py rename to apps/api.nameai.dev/tests/mocked_static_property.py index 3df8a7d1..1e0d26bc 100644 --- a/apps/api.namerank.io/tests/mocked_static_property.py +++ b/apps/api.nameai.dev/tests/mocked_static_property.py @@ -14,5 +14,5 @@ def wrapper(self): @contextmanager def mock_static_property(): - with patch('namerank.static_property.static_property', mocked_static_property): + with patch('nameai.static_property.static_property', mocked_static_property): yield diff --git a/apps/api.namerank.io/tests/test_api.py b/apps/api.nameai.dev/tests/test_api.py similarity index 87% rename from apps/api.namerank.io/tests/test_api.py rename to apps/api.nameai.dev/tests/test_api.py index 03f52fb0..fb5ecf92 100644 --- a/apps/api.namerank.io/tests/test_api.py +++ b/apps/api.nameai.dev/tests/test_api.py @@ -16,13 +16,13 @@ @pytest.fixture(scope='module') def test_client(): with mock_static_property(): - from namerank.root_api import app + from nameai.root_api import app client = TestClient(app) return client -def test_included_namerank(test_client): +def test_included_nameai(test_client): response = test_client.get('/inspect-label/a') assert response.status_code == 200 @@ -35,7 +35,7 @@ def test_included_nameguard(test_client): def test_empty_label(test_client): response = test_client.get('/inspect-label') assert response.status_code == 200 - assert response.json()['namerank']['analysis']['inspection']['label'] == '' + assert response.json()['nameai']['analysis']['inspection']['label'] == '' def test_inspect_name_post_long(test_client): @@ -47,7 +47,7 @@ def test_inspect_name_post_long(test_client): res_json = response.json() assert res_json['nameguard']['highest_risk']['check'] == 'normalized' assert res_json['nameguard']['inspected'] - assert res_json['namerank']['analysis']['status'] == 'unnormalized' + assert res_json['nameai']['analysis']['status'] == 'unnormalized' pprint(res_json) @@ -61,7 +61,7 @@ def test_inspect_name_post_too_long(test_client): assert res_json['nameguard']['highest_risk']['check'] == 'uninspected' assert res_json['nameguard']['normalization'] == 'unnormalized' assert not res_json['nameguard']['inspected'] - assert res_json['namerank']['analysis'] is None + assert res_json['nameai']['analysis'] is None pprint(res_json) @@ -74,5 +74,5 @@ def test_inspect_name_post_too_long_normalized(test_client): res_json = response.json() assert res_json['nameguard']['highest_risk']['check'] == 'uninspected' assert res_json['nameguard']['normalization'] == 'normalized' - assert res_json['namerank']['analysis'] is None + assert res_json['nameai']['analysis'] is None pprint(res_json) diff --git a/apps/api.nameai.dev/tests/test_nameai.py b/apps/api.nameai.dev/tests/test_nameai.py new file mode 100644 index 00000000..a04eac35 --- /dev/null +++ b/apps/api.nameai.dev/tests/test_nameai.py @@ -0,0 +1,70 @@ +from typing import TYPE_CHECKING +import pytest + +if TYPE_CHECKING: + from nameai.name_ai import NameAI + +from mocked_static_property import mock_static_property + + +@pytest.fixture(scope='module') +def nameai(): + with mock_static_property(): + from nameai.name_ai import NameAI + + return NameAI() + + +def test_normalized(nameai: 'NameAI'): + result = nameai.inspect_label('nick') + assert abs(result.nameai.purity_score - 0.9976234705882353) < 0.0001, result.nameai.purity_score + assert abs(result.nameai.interesting_score - 0.9354685918689098) < 0.0001, result.nameai.interesting_score + assert result.nameai.analysis.status == 'normalized' + assert abs(result.nameai.analysis.probability - 0.0000317942695746393) < 0.0001, result.nameai.analysis.probability + assert ( + abs(result.nameai.analysis.log_probability - -10.356224486471852) < 0.0001 + ), result.nameai.analysis.log_probability + assert result.nameai.analysis.word_count == 1 + assert result.nameguard.rating.name == 'WARN' + + +def test_name(nameai: 'NameAI'): + result = nameai.inspect_name('') + assert result.nameai.analysis.inspection.label == '' + assert result.nameai.purity_score == 0 + assert result.nameai.interesting_score == 0 + assert result.nameai.analysis.status == 'normalized' + + result = nameai.inspect_name('nick') + assert result.nameai.analysis.inspection.label == 'nick' + assert abs(result.nameai.purity_score - 0.9976234705882353) < 0.0001, result.nameai.purity_score + assert abs(result.nameai.interesting_score - 0.9354685918689098) < 0.0001, result.nameai.interesting_score + assert result.nameai.analysis.status == 'normalized' + + result = nameai.inspect_name('nick.eth') + assert result.nameai.analysis.inspection.label == 'nick' + assert abs(result.nameai.purity_score - 0.9976234705882353) < 0.0001, result.nameai.purity_score + assert abs(result.nameai.interesting_score - 0.9354685918689098) < 0.0001, result.nameai.interesting_score + assert result.nameai.analysis.status == 'normalized' + + result = nameai.inspect_name('nick.eth.eth') + assert result.nameai.analysis.inspection.label == 'nick' + assert result.nameai.purity_score == 0 + assert result.nameai.interesting_score == 0 + assert result.nameai.analysis.status == 'normalized' + + +def test_top_tokenization(nameai: 'NameAI'): + def top_tok(label): + return nameai.inspect_label(label).nameai.analysis.top_tokenization + + assert top_tok('Unnormalized') is None + + # word count 0 + assert top_tok('sdfbgfdbgjkdfjgdfhjfgdjfgdsjh') is None + + assert top_tok('ilikeyourcat') == ['i', 'like', 'your', 'cat'] + assert top_tok('maybe') == ['maybe'] + assert top_tok('expertsexchange') == ['experts', 'exchange'] + # higher prob than [i, teach] + assert top_tok('iteach') == ['it', 'each'] diff --git a/apps/api.namerank.io/tests/test_ngrams.py b/apps/api.nameai.dev/tests/test_ngrams.py similarity index 96% rename from apps/api.namerank.io/tests/test_ngrams.py rename to apps/api.nameai.dev/tests/test_ngrams.py index d97d86dc..82fa41c8 100644 --- a/apps/api.namerank.io/tests/test_ngrams.py +++ b/apps/api.nameai.dev/tests/test_ngrams.py @@ -7,9 +7,9 @@ @contextmanager def init_ngrams(overrides=None): with mock_static_property(): - from namerank.ngrams import Ngrams + from nameai.ngrams import Ngrams - with initialize_config_module(version_base=None, config_module='namerank.config'): + with initialize_config_module(version_base=None, config_module='nameai.config'): config = compose(config_name='prod_config', overrides=overrides) ngrams = Ngrams(config) yield ngrams @@ -18,10 +18,10 @@ def init_ngrams(overrides=None): @contextmanager def init_ngrams_tokenizer(overrides=None): with mock_static_property(): - from namerank.ngrams import Ngrams - from namerank.all_tokenizer import AllTokenizer + from nameai.ngrams import Ngrams + from nameai.all_tokenizer import AllTokenizer - with initialize_config_module(version_base=None, config_module='namerank.config'): + with initialize_config_module(version_base=None, config_module='nameai.config'): config = compose(config_name='prod_config', overrides=overrides) ngrams = Ngrams(config) tokenizer = AllTokenizer(config) diff --git a/apps/api.namerank.io/tests/test_nlp_inspector.py b/apps/api.nameai.dev/tests/test_nlp_inspector.py similarity index 93% rename from apps/api.namerank.io/tests/test_nlp_inspector.py rename to apps/api.nameai.dev/tests/test_nlp_inspector.py index 922e41ec..ea76dd3c 100644 --- a/apps/api.namerank.io/tests/test_nlp_inspector.py +++ b/apps/api.nameai.dev/tests/test_nlp_inspector.py @@ -2,7 +2,7 @@ from typing import TYPE_CHECKING if TYPE_CHECKING: - from namerank.nlp_inspector import NLPInspector + from nameai.nlp_inspector import NLPInspector from mocked_static_property import mock_static_property @@ -10,10 +10,10 @@ @pytest.fixture(scope='module') def nlp_inspector(): with mock_static_property(): - from namerank.nlp_inspector import NLPInspector - from namerank.config import load_namerank_config + from nameai.nlp_inspector import NLPInspector + from nameai.config import load_nameai_config - return NLPInspector(load_namerank_config('prod_config')) + return NLPInspector(load_nameai_config('prod_config')) # this is xfail in original inspector diff --git a/apps/api.namerank.io/tests/test_tokenizer.py b/apps/api.nameai.dev/tests/test_tokenizer.py similarity index 97% rename from apps/api.namerank.io/tests/test_tokenizer.py rename to apps/api.nameai.dev/tests/test_tokenizer.py index 30cd3bd1..535a7163 100644 --- a/apps/api.namerank.io/tests/test_tokenizer.py +++ b/apps/api.nameai.dev/tests/test_tokenizer.py @@ -10,9 +10,9 @@ @contextmanager def init_tokenizer(overrides): with mock_static_property(): - from namerank.all_tokenizer import AllTokenizer + from nameai.all_tokenizer import AllTokenizer - with initialize_config_module(version_base=None, config_module='namerank.config'): + with initialize_config_module(version_base=None, config_module='nameai.config'): config = compose(config_name='prod_config', overrides=overrides) tokenizer = AllTokenizer(config) yield tokenizer @@ -203,7 +203,7 @@ def test_all_tokenizer_custom_dict(): def test_all_tokenizer_quality(): with init_tokenizer([]) as tokenizer: - from namerank.data import get_resource_path + from nameai.data import get_resource_path for multiword in open(get_resource_path('should_be_tokenized.txt')): multiword = multiword.strip() diff --git a/apps/api.namerank.io/namerank/generate_static_data.py b/apps/api.namerank.io/namerank/generate_static_data.py deleted file mode 100644 index d316ef22..00000000 --- a/apps/api.namerank.io/namerank/generate_static_data.py +++ /dev/null @@ -1,5 +0,0 @@ -from namerank.static_property import generate_static_data - - -if __name__ == '__main__': - generate_static_data() diff --git a/apps/api.namerank.io/tests/test_namerank.py b/apps/api.namerank.io/tests/test_namerank.py deleted file mode 100644 index 0ee8700f..00000000 --- a/apps/api.namerank.io/tests/test_namerank.py +++ /dev/null @@ -1,72 +0,0 @@ -from typing import TYPE_CHECKING -import pytest - -if TYPE_CHECKING: - from namerank.namerank import NameRank - -from mocked_static_property import mock_static_property - - -@pytest.fixture(scope='module') -def namerank(): - with mock_static_property(): - from namerank.namerank import NameRank - - return NameRank() - - -def test_normalized(namerank: 'NameRank'): - result = namerank.inspect_label('nick') - assert abs(result.namerank.purity_score - 0.9976234705882353) < 0.0001, result.namerank.purity_score - assert abs(result.namerank.interesting_score - 0.9354685918689098) < 0.0001, result.namerank.interesting_score - assert result.namerank.analysis.status == 'normalized' - assert ( - abs(result.namerank.analysis.probability - 0.0000317942695746393) < 0.0001 - ), result.namerank.analysis.probability - assert ( - abs(result.namerank.analysis.log_probability - -10.356224486471852) < 0.0001 - ), result.namerank.analysis.log_probability - assert result.namerank.analysis.word_count == 1 - assert result.nameguard.rating.name == 'WARN' - - -def test_name(namerank: 'NameRank'): - result = namerank.inspect_name('') - assert result.namerank.analysis.inspection.label == '' - assert result.namerank.purity_score == 0 - assert result.namerank.interesting_score == 0 - assert result.namerank.analysis.status == 'normalized' - - result = namerank.inspect_name('nick') - assert result.namerank.analysis.inspection.label == 'nick' - assert abs(result.namerank.purity_score - 0.9976234705882353) < 0.0001, result.namerank.purity_score - assert abs(result.namerank.interesting_score - 0.9354685918689098) < 0.0001, result.namerank.interesting_score - assert result.namerank.analysis.status == 'normalized' - - result = namerank.inspect_name('nick.eth') - assert result.namerank.analysis.inspection.label == 'nick' - assert abs(result.namerank.purity_score - 0.9976234705882353) < 0.0001, result.namerank.purity_score - assert abs(result.namerank.interesting_score - 0.9354685918689098) < 0.0001, result.namerank.interesting_score - assert result.namerank.analysis.status == 'normalized' - - result = namerank.inspect_name('nick.eth.eth') - assert result.namerank.analysis.inspection.label == 'nick' - assert result.namerank.purity_score == 0 - assert result.namerank.interesting_score == 0 - assert result.namerank.analysis.status == 'normalized' - - -def test_top_tokenization(namerank: 'NameRank'): - def top_tok(label): - return namerank.inspect_label(label).namerank.analysis.top_tokenization - - assert top_tok('Unnormalized') is None - - # word count 0 - assert top_tok('sdfbgfdbgjkdfjgdfhjfgdjfgdsjh') is None - - assert top_tok('ilikeyourcat') == ['i', 'like', 'your', 'cat'] - assert top_tok('maybe') == ['maybe'] - assert top_tok('expertsexchange') == ['experts', 'exchange'] - # higher prob than [i, teach] - assert top_tok('iteach') == ['it', 'each'] From 8824ecc502667f8652bee6e5c254700b686b5a20 Mon Sep 17 00:00:00 2001 From: BanaSeba Date: Fri, 10 Jan 2025 11:26:33 +0100 Subject: [PATCH 3/4] Initial nameai CI/CD renaming --- .../workflows/namerank-api-lambda-deploy.yml | 20 +++++++++---------- apps/api.namerank.io/README.md | 16 +++++++-------- .../terraform/deploy_lambda.sh | 6 +++--- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/namerank-api-lambda-deploy.yml b/.github/workflows/namerank-api-lambda-deploy.yml index a443969c..c8d7380e 100644 --- a/.github/workflows/namerank-api-lambda-deploy.yml +++ b/.github/workflows/namerank-api-lambda-deploy.yml @@ -1,4 +1,4 @@ -name: NameRank API - Lambda Deploy +name: NameAI API - Lambda Deploy on: push: @@ -24,7 +24,7 @@ concurrency: jobs: build-image-deploy: - name: Build and deploy NameRank API Lambda + name: Build and deploy NameAI API Lambda runs-on: ubuntu-latest steps: - name: Checkout this repo @@ -60,15 +60,15 @@ jobs: ENS_SUBGRAPH_URL_MAINNET: ${{ secrets.ENS_SUBGRAPH_URL_MAINNET }} ENS_SUBGRAPH_URL_SEPOLIA: ${{ secrets.ENS_SUBGRAPH_URL_SEPOLIA }} AWS_REGION: ${{ secrets.AWS_REGION }} - CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }} - HOSTED_ZONE_NAME: ${{ secrets.NAMERANK_HOSTED_ZONE_NAME }} + CERTIFICATE_NAME: ${{ secrets.NAMEAI_CERTIFICATE_NAME }} + HOSTED_ZONE_NAME: ${{ secrets.NAMEAI_HOSTED_ZONE_NAME }} run: | if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then STAGE="prod" - DOMAIN_NAME=${{ secrets.NAMERANK_PROD_DOMAIN_NAME }} + DOMAIN_NAME=${{ secrets.NAMEAI_PROD_DOMAIN_NAME }} elif [[ ${{ github.ref }} == 'refs/heads/staging' ]]; then STAGE="staging" - DOMAIN_NAME=${{ secrets.NAMERANK_STAGING_DOMAIN_NAME }} + DOMAIN_NAME=${{ secrets.NAMEAI_STAGING_DOMAIN_NAME }} else echo "Deployment is only supported for main and staging branches" exit 1 @@ -87,21 +87,21 @@ jobs: if: ${{ needs.build-image-deploy.result == 'success'}} run: | echo "STATUS=Success :rocket:" >> $GITHUB_ENV - echo "TEXT=Lambda NameRank deployed successfully! :white_check_mark:" >> $GITHUB_ENV + echo "TEXT=Lambda NameAI deployed successfully! :white_check_mark:" >> $GITHUB_ENV echo "COLOR=good" >> $GITHUB_ENV - name: Output status on deployment failed if: ${{ needs.build-image-deploy.result == 'failure' }} run: | echo "STATUS=Failure :x:" >> $GITHUB_ENV - echo "TEXT=Lambda NameRank deployment failed! :rotating_light:" >> $GITHUB_ENV + echo "TEXT=Lambda NameAI deployment failed! :rotating_light:" >> $GITHUB_ENV echo "COLOR=danger" >> $GITHUB_ENV - name: Output status on deployment cancellation if: ${{ needs.build-image-deploy.result == 'cancelled' }} run: | echo "STATUS=Cancelled :no_entry_sign:" >> $GITHUB_ENV - echo "TEXT=Lambda NameRank deployment was cancelled. :warning:" >> $GITHUB_ENV + echo "TEXT=Lambda NameAI deployment was cancelled. :warning:" >> $GITHUB_ENV echo "COLOR=warning" >> $GITHUB_ENV - name: Send deployment status Slack notification @@ -113,7 +113,7 @@ jobs: { attachments: [{ color: '${{ env.COLOR }}', - title: 'Lambda NameRank deployment.', + title: 'Lambda NameAI deployment.', text: '${{ env.TEXT }}', fields: [ { diff --git a/apps/api.namerank.io/README.md b/apps/api.namerank.io/README.md index 04440a1d..62f4a622 100644 --- a/apps/api.namerank.io/README.md +++ b/apps/api.namerank.io/README.md @@ -1,13 +1,13 @@ -# NameRank +# NameAI ## API The API extends the NameGuard API and is fully compatible with it. -NameRank-specific endpoints are under the [api.namerank.io/namerank](https://www.api.namerank.io/namerank) path prefix. +NameAI-specific endpoints are under the [api.nameai.io/nameai](https://www.api.nameai.io/nameai) path prefix. -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. +API documentation is available at [api.nameai.io/nameai/docs](https://api.nameai.io/nameai/docs) and [api.nameai.io/docs](https://api.nameai.io/docs) for NameGuard. -Lambda is publicly accessible under given domain [api.namerank.io](https://api.namerank.io) +Lambda is publicly accessible under given domain [api.nameai.io](https://api.nameai.io) # AWS deploy ## Requirements @@ -94,16 +94,16 @@ You can add these secrets in your GitHub repository settings under the "Secrets" # Getting Started -This section is describing how to setup running NameRank instance on local environment +This section is describing how to setup running NameAI instance on local environment ## Environment variables -NameRank requires certain env variables propagated for it's NameGuard subcomponent. +NameAI requires certain env variables propagated for it's NameGuard subcomponent. Those variables are defined and described in [.env.example](./.env.example) file which is a point of reference. -Script responsible for running local NameRank instance is expecting those variables to be poulated in .env file before execution. +Script responsible for running local NameAI instance is expecting those variables to be poulated in .env file before execution. ## Requirements python3 with pip installed on local env ## Scripts -Running [start-local.sh](./start-local.sh) script will result in creating running NameRank instance on local environment. +Running [start-local.sh](./start-local.sh) script will result in creating running NameAI instance on local environment. This instance can be reached under [localhost:8000](localhost:8000) \ No newline at end of file diff --git a/apps/api.namerank.io/terraform/deploy_lambda.sh b/apps/api.namerank.io/terraform/deploy_lambda.sh index 116ac781..0bbf6a17 100644 --- a/apps/api.namerank.io/terraform/deploy_lambda.sh +++ b/apps/api.namerank.io/terraform/deploy_lambda.sh @@ -75,7 +75,7 @@ DOMAIN_NAME="$3" CERTIFICATE_NAME="$4" HOSTED_ZONE_NAME="$5" -APPLICATION_NAME="namerank-${STAGE}" +APPLICATION_NAME="nameai-${STAGE}" S3_BUCKET_NAME="${APPLICATION_NAME}-terraform" ECR_NAME="${APPLICATION_NAME}-ecr" @@ -198,13 +198,13 @@ if [ ! -f "../Dockerfile" ]; then fi echo "Building Docker image..." -if ! docker build ../ -t namerank; then +if ! docker build ../ -t nameai; then echo "Error: Docker build failed" exit 1 fi echo "Tagging Docker image..." -if ! docker tag namerank:latest ${ECR_URL}:latest; then +if ! docker tag nameai:latest ${ECR_URL}:latest; then echo "Error: Failed to tag Docker image" exit 1 fi From 43e661af3f789d2cf86e7816a0215aae6fa9d210 Mon Sep 17 00:00:00 2001 From: BanaSeba Date: Fri, 10 Jan 2025 11:48:14 +0100 Subject: [PATCH 4/4] Additional changes for CI/CD renaming --- .github/workflows/nameai-api-lambda-deploy.yml | 8 ++++---- .../terraform/modules/lambda_api/main.tf | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/nameai-api-lambda-deploy.yml b/.github/workflows/nameai-api-lambda-deploy.yml index b06c235e..146e5077 100644 --- a/.github/workflows/nameai-api-lambda-deploy.yml +++ b/.github/workflows/nameai-api-lambda-deploy.yml @@ -60,15 +60,15 @@ jobs: ENS_SUBGRAPH_URL_MAINNET: ${{ secrets.ENS_SUBGRAPH_URL_MAINNET }} ENS_SUBGRAPH_URL_SEPOLIA: ${{ secrets.ENS_SUBGRAPH_URL_SEPOLIA }} AWS_REGION: ${{ secrets.AWS_REGION }} - CERTIFICATE_NAME: ${{ secrets.NAMERANK_CERTIFICATE_NAME }} # todo: rename secrets to NAMEAI_* (?) - HOSTED_ZONE_NAME: ${{ secrets.NAMERANK_HOSTED_ZONE_NAME }} + CERTIFICATE_NAME: ${{ secrets.NAMEAI_CERTIFICATE_NAME }} + HOSTED_ZONE_NAME: ${{ secrets.NAMEAI_HOSTED_ZONE_NAME }} run: | if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then STAGE="prod" - DOMAIN_NAME=${{ secrets.NAMERANK_PROD_DOMAIN_NAME }} + DOMAIN_NAME=${{ secrets.NAMEAI_PROD_DOMAIN_NAME }} elif [[ ${{ github.ref }} == 'refs/heads/staging' ]]; then STAGE="staging" - DOMAIN_NAME=${{ secrets.NAMERANK_STAGING_DOMAIN_NAME }} + DOMAIN_NAME=${{ secrets.NAMEAI_STAGING_DOMAIN_NAME }} else echo "Deployment is only supported for main and staging branches" exit 1 diff --git a/apps/api.nameai.dev/terraform/modules/lambda_api/main.tf b/apps/api.nameai.dev/terraform/modules/lambda_api/main.tf index 66eca48e..9bb64b1c 100644 --- a/apps/api.nameai.dev/terraform/modules/lambda_api/main.tf +++ b/apps/api.nameai.dev/terraform/modules/lambda_api/main.tf @@ -14,7 +14,7 @@ data "aws_iam_policy_document" "assume_role" { locals { common_tags = { Environment = var.env - Project = "namerank" + Project = "nameai" ManagedBy = "terraform" } } @@ -52,8 +52,8 @@ resource "aws_iam_role_policy_attachment" "lambda_logs" { } -resource "aws_lambda_function" "namerank_lambda" { - function_name = "namerank-lambda-${var.env}" +resource "aws_lambda_function" "nameai_lambda" { + function_name = "nameai-lambda-${var.env}" role = aws_iam_role.iam_for_lambda.arn memory_size = "1769" timeout = 60 @@ -74,24 +74,24 @@ resource "aws_lambda_function" "namerank_lambda" { } tags = merge(local.common_tags, { - Function = "namerank-api" + Function = "nameai-api" }) } resource "aws_lambda_provisioned_concurrency_config" "concurrency_config" { - function_name = aws_lambda_function.namerank_lambda.function_name + function_name = aws_lambda_function.nameai_lambda.function_name provisioned_concurrent_executions = 1 - qualifier = aws_lambda_function.namerank_lambda.version + qualifier = aws_lambda_function.nameai_lambda.version } resource "aws_lambda_function_url" "lambda_url" { - function_name = aws_lambda_function.namerank_lambda.function_name + function_name = aws_lambda_function.nameai_lambda.function_name authorization_type = "NONE" } resource "aws_cloudfront_distribution" "api_distribution" { enabled = true - comment = "Distribution for namerank API ${var.env}" + comment = "Distribution for nameai API ${var.env}" price_class = "PriceClass_100" aliases = [var.domain_name]