Skip to content

Commit

Permalink
Merge branch 'main' into DEV-1887
Browse files Browse the repository at this point in the history
  • Loading branch information
marcobottaro authored Sep 24, 2024
2 parents 7cac14b + c787b27 commit cc4acfa
Show file tree
Hide file tree
Showing 44 changed files with 2,105 additions and 1,338 deletions.
9 changes: 0 additions & 9 deletions .github/actions/build-nextjs-website/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,6 @@ runs:
shell: bash
run: npm run update-docs-ci -w nextjs-website

- name: Restore NextJS cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
path: ${{ github.workspace }}/apps/nextjs-website/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-${{ hashFiles('**/*.[jt]s') }}-${{ hashFiles('**/*.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/package-lock.json') }}-

- name: Build static website
env:
ENVIRONMENT: ${{ inputs.environment }}
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/changelog.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,20 @@ jobs:
- name: Install dependencies
run: npm ci --audit=false --fund=false

- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "devportal-portalsandtools-github-bot"
- name: Create PR for next release
uses: changesets/action@f13b1baaa620fde937751f5d2c3572b9da32af23 # v1.4.5
with:
# Note: `npm i` after versioning is necessary to refresh package-lock.json file with new version
version: npm run version
publish: npm run tag
commit: "Update CHANGELOG and prepare next release"
title: "Push next releases"
title: ${{ vars.CHANGESET_PR_TITLE }}
createGithubReleases: false
setupGitUser: false
env:
GITHUB_TOKEN: ${{ secrets.TAG_GITHUB_PAT }}
7 changes: 4 additions & 3 deletions .github/workflows/code_review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,24 @@ defaults:
jobs:
changes:
runs-on: ubuntu-latest
if: github.event_name != 'pull_request' || github.event.pull_request.title != ${{ vars.CHANGESET_PR_TITLE }}
permissions:
pull-requests: read
outputs:
nextjswebsite: ${{ steps.filter.outputs.nextjswebsite }}
steps:
- name: Checkout code
# Checkout is not needed if triggered by a PR
if: ${{ github.event_name != 'pull_request' }}
# Checkout is needed if not triggered by a PR
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

- uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0
id: filter
with:
filters: |
nextjswebsite:
- 'apps/nextjs-website/**'
compile:
name: Compile project
runs-on: ubuntu-latest
Expand Down Expand Up @@ -63,9 +66,7 @@ jobs:
code_checks:
name: Code checks
runs-on: ubuntu-latest

needs: [changes, compile]
if: ${{ needs.changes.outputs.nextjswebsite == 'true' }}

steps:
- name: Restore cache
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/move_latest_tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ name: Move Latest Tag to New Commit
on:
push:
tags:
- '*'
# Trigger this workflow when a tag `nextjs-website@<sem-ver>` is pushed.
- 'nextjs-website@[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
jobs:
move-latest-tag:
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/pr_enrich.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,12 @@ name: Enrich Pull Request

on:
pull_request:
# Ignore Changeset PRs
paths-ignore:
- '**/package.json'
- '**/CHANGELOG.md'
- '.changeset/**'
- 'package-lock.json'

jobs:

add_labels:
name: Add labels
if: github.event.pull_request.title != ${{ vars.CHANGESET_PR_TITLE }}
permissions:
contents: read
pull-requests: write
Expand All @@ -36,6 +31,7 @@ jobs:

add_assignee:
name: Add assignee
needs: add_labels
runs-on: ubuntu-latest

steps:
Expand Down
27 changes: 22 additions & 5 deletions apps/chatbot/.env.example
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
CHB_AWS_ACCESS_KEY_ID=xxx
CHB_AWS_SECRET_ACCESS_KEY=xxx
environment=local
CORS_DOMAINS=["*"]
PYTHONPATH=app-path
LOG_LEVEL=DEBUG
CHB_AWS_ACCESS_KEY_ID=...
CHB_AWS_SECRET_ACCESS_KEY=...
CHB_AWS_DEFAULT_REGION=eu-west-3
CHB_AWS_S3_BUCKET=xxx
CHB_AWS_GUARDRAIL_ID=xxx
CHB_AWS_GUARDRAIL_VERSION=DRAFT
CHB_AWS_S3_BUCKET=...
CHB_AWS_GUARDRAIL_ID=...
CHB_AWS_GUARDRAIL_VERSION=...
CHB_REDIS_URL=...
CHB_WEBSITE_URL=...
CHB_GOOGLE_API_KEY=...
CHB_PROVIDER=...
CHB_MODEL_ID=...
CHB_MODEL_TEMPERATURE=...
CHB_MODEL_MAXTOKENS=...
CHB_EMBED_MODEL_ID=...
CHB_ENGINE_SIMILARITY_TOPK=...
CHB_ENGINE_SIMILARITY_CUTOFF=...
CHB_ENGINE_USE_ASYNC=...
CHB_ENGINE_USE_STREAMING=...
CHB_QUERY_TABLE_PREFIX=chatbot-local
6 changes: 6 additions & 0 deletions apps/chatbot/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# chatbot

## 2.4.0

### Minor Changes

- d6f0518: Allowing the usage of Google Gemini generation and embedding models

## 2.3.0

### Minor Changes
Expand Down
39 changes: 26 additions & 13 deletions apps/chatbot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,41 @@ In this way, `PYTHONPATH` points to where the Python packages and modules are, n

Create a `.env` file inside the folder and write to the file the following environment variables:

AWS_ACCESS_KEY_ID=...
AWS_SECRET_ACCESS_KEY=...
AWS_DEFAULT_REGION=...
AWS_S3_BUCKET=...
AWS_GUARDRAIL_ID=...
AWS_GUARDRAIL_VERSION=...
CHB_AWS_ACCESS_KEY_ID=...
CHB_AWS_SECRET_ACCESS_KEY=...
CHB_AWS_DEFAULT_REGION=...
CHB_AWS_S3_BUCKET=...
CHB_AWS_GUARDRAIL_ID=...
CHB_AWS_GUARDRAIL_VERSION=...
CHB_REDIS_URL=...
WEBSITE_URL=...
CHB_WEBSITE_URL=...
CHB_GOOGLE_API_KEY=...
CHB_PROVIDER=...
CHB_MODEL_ID=...
CHB_MODEL_TEMPERATURE=...
CHB_MODEL_MAXTOKENS=...
CHB_EMBED_MODEL_ID=...
CHB_ENGINE_SIMILARITY_TOPK=...
CHB_ENGINE_SIMILARITY_CUTOFF=...
CHB_ENGINE_USE_ASYNC=...
CHB_ENGINE_USE_STREAMING=...

## Knowledge vector database

First of all, verify that the HTML files that compose the Developer Portal documentation exist in a directory. Otherwise create the documentation. Once you have the documentation directory ready, put its path in `params` and, in the end, create the vector index doing:

To reach the remote redis instance, it is necessary to open a tunnel:

```
./scripts/redis-tunnel.sh
```

Verify that the HTML files that compose the Developer Portal documentation exist in a directory. Otherwise create the documentation. Once you have the documentation directory ready, put its path in `params` and, in the end, create the vector index doing:

Then, to start the indexing:
```
python src/modules/create_vector_index.py --params config/params.yaml
```

python src/modules/create_vector_index.py --params config/params.yaml --use-redis
This script reads the documentation, split it into chucks with gerarchical organization, and stores it on Redis.

This script reads the documentation, split it into chucks with gerarchical organization, and stores it on Redis. If the input `--use-redis` is missing, then the index is stored on a AWS S3 bucket.
Check out the params in order to store your vector index accordingly.

## Web App

Expand Down
11 changes: 0 additions & 11 deletions apps/chatbot/config/params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,6 @@ vector_index:
use_redis: True
use_s3: False

models:
model_id: amazon.titan-text-express-v1
emded_model_id: cohere.embed-multilingual-v3
temperature: 0.5
topP: 0.95
max_tokens: 784

engine:
similarity_top_k: 5
similarity_cutoff: 0.55
response_mode: compact
verbose: False
use_async: True
streaming: False
2 changes: 1 addition & 1 deletion apps/chatbot/docker/app.local.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ RUN poetry install

COPY . .

CMD ["fastapi", "run", "src/app/main.py", "--port", "8080"]
CMD ["fastapi", "dev", "src/app/main.py", "--port", "8080"]
2 changes: 1 addition & 1 deletion apps/chatbot/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "chatbot",
"version": "2.3.0",
"version": "2.4.0",
"private": true
}
Loading

0 comments on commit cc4acfa

Please sign in to comment.