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: add e2e gen ai app starter kit #1098

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,4 @@
/generative-ai/open-models/serving/vertex_ai_text_generation_inference_gemma.ipynb @alvarobartt @philschmid @pagezyhf @jeffboudier
/generative-ai/gemini/use-cases/applying-llms-to-data/semantic-search-in-bigquery/stackoverflow_questions_semantic_search.ipynb @sethijaideep @GoogleCloudPlatform/generative-ai-devrel
/generative-ai/gemini/use-cases/retrieval-augmented-generation/raw_with_bigquery.ipynb @jeffonelson @GoogleCloudPlatform/generative-ai-devrel
/generative-ai/gemini/sample-apps/e2e-gen-ai-app-starter-kit @eliasecchig @lspatarog @GoogleCloudPlatform/generative-ai-devrel
11 changes: 11 additions & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ Kohli
Kraizt
Kubeflow
Kudrow
LangGraph
LCEL
LLMs
LOOKBACK
Expand Down Expand Up @@ -202,6 +203,7 @@ Oort
PDFs
PEFT
PLOTLYENV
PYINK
Parmar
Persero
Phaidon
Expand Down Expand Up @@ -270,6 +272,7 @@ Testables
Tetsuo
Tianli
Topolino
Traceloop
Trapp
Tribbiani
Tricyle
Expand Down Expand Up @@ -360,13 +363,15 @@ cfbundle
chatbots
chromadb
claude
cicd
clickable
cmap
codebase
codebases
codefile
codelab
codelabs
codespell
colab
coldline
coloraxis
Expand Down Expand Up @@ -473,6 +478,7 @@ gsutil
gtk
guanciale
gunicorn
hadolint
hashtag
hashtags
hdlr
Expand Down Expand Up @@ -671,19 +677,23 @@ sxs
tabular
tagline
tencel
terraform
termcolor
terraform
textno
tfhub
tfidf
tfvars
tgz
thelook
tiktoken
timechart
titlebar
tobytes
toself
toset
tqdm
traceloop
tritan
tsv
ubuntu
Expand All @@ -698,6 +708,7 @@ usernames
uvb
uvicorn
vapo
uvicorn
vectordb
vertexai
vesselin
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Conversational Gen AI template - Lint and Test

on:
push:
paths:
- "gemini/sample-apps/e2e-gen-ai-app-starter-kit/**"
pull_request:
paths:
- "gemini/sample-apps/e2e-gen-ai-app-starter-kit/**"

jobs:
lint-and-test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: gemini/sample-apps/e2e-gen-ai-app-starter-kit
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Poetry and dependencies
run: |
pip install poetry==1.8.3 --user
python -m poetry install --with lint,streamlit
- name: Lint python code
run: |
poetry run codespell
poetry run ruff .
poetry run mypy .
poetry run black . --check
- name: Run tests
run: |
poetry run pytest tests/unit
2 changes: 1 addition & 1 deletion .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
FILTER_REGEX_EXCLUDE: 'gemini/sample-apps/finance-advisor-spanner/.*\.sql'
FILTER_REGEX_EXCLUDE: 'gemini/sample-apps/finance-advisor-spanner/.*\.sql|gemini/sample-apps/e2e-gen-ai-app-starter-kit/.*'
JAVASCRIPT_DEFAULT_STYLE: prettier
LOG_LEVEL: WARN
SHELLCHECK_OPTS: -e SC1091 -e 2086
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ dmypy.json
# User-specific files
language/examples/prompt-design/train.csv
README-TOC*.md
gemini/sample-apps/e2e-gen-ai-app-starter-kit/deployment/terraform/terraform.tfstate*

.terraform*
.Terraform*
Expand Down
Empty file added core
Empty file.
1 change: 1 addition & 0 deletions gemini/sample-apps/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
| Description | Application Name | Technologies Used |
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ | -------------------------------------------------------------------------- |
| Develop a Gemini application using [Streamlit](https://streamlit.io/) framework and Vertex AI Gemini API model. | [gemini-streamlit-cloudrun](gemini-streamlit-cloudrun) | Cloud Run, Streamlit, Python |
| Deploy a RAG + Gemini sample application to troubleshoot your car using the owner's manual. | [fixmycar/](fixmycar/) | Chat, Grounding, RAG, Java, Streamlit |

Check warning on line 16 in gemini/sample-apps/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`fixmycar` is not a recognized word. (unrecognized-spelling)

Check warning on line 16 in gemini/sample-apps/README.md

View workflow job for this annotation

GitHub Actions / Check Spelling

`fixmycar` is not a recognized word. (unrecognized-spelling)
| Try Gemini image recognition in `bash` and see Text-to-Speech read the description to you in ~any language. All from CLI! | [image-bash-jam/](image-bash-jam/) | Text-to-Speech, Bash |
| This demo showcases how you can combine the data and documents you already have and the skills you already know with the power of [AlloyDB AI](https://cloud.google.com/alloydb/ai?hl=en), [Vertex AI](https://cloud.google.com/vertex-ai?hl=en), [Cloud Run](https://cloud.google.com/run?hl=en), and [Cloud Functions](https://cloud.google.com/functions?hl=en) to build trustworthy Gen AI features into your existing applications. | [GenWealth](genwealth/) | Vertex AI, AlloyDB, Document AI, Cloud Run, Cloud Functions, Cloud Storage |
| E2E Gen AI App Starter kit: This folder provides a template starter kit for building a Generative AI application on Google Cloud. We provide a comprehensive set of resources to guide you through the entire development process, from prototype to production. | [e2e-gen-ai-app-starter-kit](e2e-gen-ai-app-starter-kit/) | Vertex AI, FastAPI, LangChain, Cloud Run, Cloud Build, Terraform, Streamlit |
194 changes: 194 additions & 0 deletions gemini/sample-apps/e2e-gen-ai-app-starter-kit/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,194 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*.pyc
*$py.class
**/dist
/tmp
/out-tsc
/bazel-out

# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
pip-wheel-metadata/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
Pipfile.lock
Pipfile

# PEP 582; used by e.g. github.com/David-OConnor/pyflow
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
.venv*
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# macOS
.DS_Store

# PyCharm
.idea

# User-specific files
.terraform*
.Terraform*


tmp*

# Node
**/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
**/.angular/*
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings

# System files
.DS_Store
Thumbs.db
*.vscode*

.persist_vector_store
tests/load_test/.results/*.html
tests/load_test/.results/*.csv
locust_env
my_env.tfvars
.streamlit_chats
.saved_chats
47 changes: 47 additions & 0 deletions gemini/sample-apps/e2e-gen-ai-app-starter-kit/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# How to Contribute

We'd love to accept your patches and contributions to this sample. There are
just a few small guidelines you need to follow.

## Contributor License Agreement

Contributions to this project must be accompanied by a Contributor License Agreement. You (or your employer) retain the copyright to your contribution; this simply gives us permission to use and redistribute your contributions as part of the project. Head over to [Google Developers CLA](https://cla.developers.google.com/) to see your current agreements on file or to sign a new one.

You generally only need to submit a CLA once, so if you've already submitted one (even if it was for a different project), you probably don't need to do it again.

## Community Guidelines, Code Reviews, Contributor Guide

Please refer to the [root repository CONTRIBUTING.md file](https://github.com/GoogleCloudPlatform/generative-ai/blob/main/CONTRIBUTING.md) for Community Guidelines, Code Reviews, Contributor Guide, or specific guidance for Google Employees.

## Code Quality Checks

To ensure code quality, we utilize automated checks. Before submitting a pull request, please run the following commands locally:

```bash
poetry install --with streamlit,jupyter,lint
```

This installs development dependencies, including linting tools.

Then, execute the following Makefile targets:

```bash
make lint
```

This command runs the following linters to check for code style, potential errors, and type hints:

- **codespell**: Detects common spelling mistakes in code and documentation.
- **ruff**: A fast linter that combines the functionality of several popular tools like flake8, isort, pycodestyle, and others.
- **mypy**: Performs static type checking to catch type errors before runtime.

```bash
make test
```

This command runs the test suite using pytest, covering both unit and integration tests:

- **`poetry run pytest tests/unit`**: Executes unit tests located in the `tests/unit` directory.
- **`poetry run pytest tests/integration`**: Executes integration tests located in the `tests/integration` directory.

Your pull request will also be automatically checked by these tools using GitHub Actions. Ensuring your code passes these checks locally will help expedite the review process.
Loading
Loading