Skip to content

Commit

Permalink
Skip whatsapp agent e2e tests, add whatsapp unit tests (#540)
Browse files Browse the repository at this point in the history
* Skip whatsapp agent e2e tests, add whatsapp unit tests

* Rebuild docs
  • Loading branch information
sternakt authored Nov 7, 2024
1 parent 66080f2 commit cc5e29d
Show file tree
Hide file tree
Showing 16 changed files with 308 additions and 15 deletions.
34 changes: 34 additions & 0 deletions docs/docs/en/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,40 @@ hide:
---

# Release Notes
## v0.3.3

### What's Changed

* Polish tutorials by [@davorrunje](https://github.com/davorrunje){.external-link target="_blank"} in [#473](https://github.com/airtai/fastagency/pull/473){.external-link target="_blank"}
* Add user guide on how to use cookiecutter by [@kumaranvpl](https://github.com/kumaranvpl){.external-link target="_blank"} in [#474](https://github.com/airtai/fastagency/pull/474){.external-link target="_blank"}
* Update tutorial docs by [@rjambrecic](https://github.com/rjambrecic){.external-link target="_blank"} in [#479](https://github.com/airtai/fastagency/pull/479){.external-link target="_blank"}
* Patch "Exception: modular references are not supported in this version" by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#478](https://github.com/airtai/fastagency/pull/478){.external-link target="_blank"}
* Fix patching order by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#481](https://github.com/airtai/fastagency/pull/481){.external-link target="_blank"}
* Update Adapter Docs by [@harishmohanraj](https://github.com/harishmohanraj){.external-link target="_blank"} in [#472](https://github.com/airtai/fastagency/pull/472){.external-link target="_blank"}
* Add Playwright by [@davorinrusevljan](https://github.com/davorinrusevljan){.external-link target="_blank"} in [#469](https://github.com/airtai/fastagency/pull/469){.external-link target="_blank"}
* Add cookiecutter as an alternative option by [@kumaranvpl](https://github.com/kumaranvpl){.external-link target="_blank"} in [#480](https://github.com/airtai/fastagency/pull/480){.external-link target="_blank"}
* Fix: modular references are not supported in this version exception by [@rjambrecic](https://github.com/rjambrecic){.external-link target="_blank"} in [#484](https://github.com/airtai/fastagency/pull/484){.external-link target="_blank"}
* Keep cookiecutter project setup in single place and embed it in getting started by [@kumaranvpl](https://github.com/kumaranvpl){.external-link target="_blank"} in [#485](https://github.com/airtai/fastagency/pull/485){.external-link target="_blank"}
* Fix create message by adding workflow_uuid by [@davorrunje](https://github.com/davorrunje){.external-link target="_blank"} in [#486](https://github.com/airtai/fastagency/pull/486){.external-link target="_blank"}
* Update giphy end2end test by [@rjambrecic](https://github.com/rjambrecic){.external-link target="_blank"} in [#502](https://github.com/airtai/fastagency/pull/502){.external-link target="_blank"}
* Raise warning if openapi schema contains non supported security schema by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#499](https://github.com/airtai/fastagency/pull/499){.external-link target="_blank"}
* Upgrade package versions by [@kumaranvpl](https://github.com/kumaranvpl){.external-link target="_blank"} in [#506](https://github.com/airtai/fastagency/pull/506){.external-link target="_blank"}
* Define servers in openapi factory by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#501](https://github.com/airtai/fastagency/pull/501){.external-link target="_blank"}
* Reroute whatsapp_e2e test by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#507](https://github.com/airtai/fastagency/pull/507){.external-link target="_blank"}
* Add fastagency docker build and run commands by [@kumaranvpl](https://github.com/kumaranvpl){.external-link target="_blank"} in [#508](https://github.com/airtai/fastagency/pull/508){.external-link target="_blank"}
* Mesop: do not scroll for keep alive by [@davorinrusevljan](https://github.com/davorinrusevljan){.external-link target="_blank"} in [#503](https://github.com/airtai/fastagency/pull/503){.external-link target="_blank"}
* Update package versions by [@kumaranvpl](https://github.com/kumaranvpl){.external-link target="_blank"} in [#525](https://github.com/airtai/fastagency/pull/525){.external-link target="_blank"}
* Fix parsing of Infobip whatsapp API schema by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#516](https://github.com/airtai/fastagency/pull/516){.external-link target="_blank"}
* Fix docs by [@davorrunje](https://github.com/davorrunje){.external-link target="_blank"} in [#528](https://github.com/airtai/fastagency/pull/528){.external-link target="_blank"}
* Add firebase authentication in Mesop by [@harishmohanraj](https://github.com/harishmohanraj){.external-link target="_blank"} in [#512](https://github.com/airtai/fastagency/pull/512){.external-link target="_blank"}
* Polishing docs by [@davorrunje](https://github.com/davorrunje){.external-link target="_blank"} in [#530](https://github.com/airtai/fastagency/pull/530){.external-link target="_blank"}
* Implement Whatsapp agent with infobip api integration by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#532](https://github.com/airtai/fastagency/pull/532){.external-link target="_blank"}
* Fix failing test import by [@sternakt](https://github.com/sternakt){.external-link target="_blank"} in [#533](https://github.com/airtai/fastagency/pull/533){.external-link target="_blank"}
* Update documentation with new features by [@davorrunje](https://github.com/davorrunje){.external-link target="_blank"} in [#534](https://github.com/airtai/fastagency/pull/534){.external-link target="_blank"}


**Full Changelog**: [#v0.3.2...v0.3.3](https://github.com/airtai/fastagency/compare/v0.3.2...v0.3.3){.external-link target="_blank"}

## v0.3.2

### What's Changed
Expand Down
1 change: 1 addition & 0 deletions docs/docs_src/getting_started/fastapi/folder_structure.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
my_fastagency_app
├── docker
│   ├── Dockerfile
│   ├── nginx.conf.template
│   └── run_fastagency.sh
├── my_fastagency_app
│   ├── deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ FROM python:3.12

WORKDIR /app

# Install nginx
RUN apt-get update && apt-get install -y --no-install-recommends nginx gettext \
&& rm -rf /var/lib/apt/lists/*

COPY my_fastagency_app /app/my_fastagency_app

COPY pyproject.toml README.md docker/run_fastagency.sh /app/
COPY pyproject.toml README.md docker/run_fastagency.sh docker/nginx.conf.template /app/

RUN pip install --upgrade pip && pip install --no-cache-dir -e "."

RUN adduser --disabled-password --gecos '' appuser && chown -R appuser /app
# Add user appuser with root permissions
RUN adduser --disabled-password --gecos '' appuser \
&& chown -R appuser /app \
&& chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid

USER appuser

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
upstream mesop_backend {
# Enable sticky sessions with IP hash
ip_hash;


}

server {
listen $MESOP_PORT;
server_name localhost;

# Security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";

location / {
proxy_pass http://mesop_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;

# WSGI support
proxy_set_header X-Forwarded-Host $server_name;

# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,35 @@

FASTAPI_PORT=${FASTAPI_PORT:-8008}


MESOP_PORT=${MESOP_PORT:-8888}
export MESOP_PORT=${MESOP_PORT:-8888}

# Default number of workers if not set
WORKERS=${WORKERS:-1}
echo "Number of workers: $WORKERS"

# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &

# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_1_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &

# Run gunicorn server
gunicorn --workers=$WORKERS my_fastagency_app.deployment.main_2_mesop:app --bind 0.0.0.0:$MESOP_PORT
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done

# Wait for all background processes
wait
1 change: 1 addition & 0 deletions docs/docs_src/getting_started/mesop/folder_structure.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
my_fastagency_app
├── docker
│   ├── Dockerfile
│   ├── nginx.conf.template
│   └── run_fastagency.sh
├── my_fastagency_app
│   ├── deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ FROM python:3.12

WORKDIR /app

# Install nginx
RUN apt-get update && apt-get install -y --no-install-recommends nginx gettext \
&& rm -rf /var/lib/apt/lists/*

COPY my_fastagency_app /app/my_fastagency_app

COPY pyproject.toml README.md docker/run_fastagency.sh /app/
COPY pyproject.toml README.md docker/run_fastagency.sh docker/nginx.conf.template /app/

RUN pip install --upgrade pip && pip install --no-cache-dir -e "."

RUN adduser --disabled-password --gecos '' appuser && chown -R appuser /app
# Add user appuser with root permissions
RUN adduser --disabled-password --gecos '' appuser \
&& chown -R appuser /app \
&& chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid

USER appuser

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
upstream mesop_backend {
# Enable sticky sessions with IP hash
ip_hash;


}

server {
listen $MESOP_PORT;
server_name localhost;

# Security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";

location / {
proxy_pass http://mesop_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;

# WSGI support
proxy_set_header X-Forwarded-Host $server_name;

# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,35 @@
# Accept env variable for PORT



MESOP_PORT=${MESOP_PORT:-8888}
export MESOP_PORT=${MESOP_PORT:-8888}

# Default number of workers if not set
WORKERS=${WORKERS:-1}
echo "Number of workers: $WORKERS"

# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &

# Run uvicorn server
uvicorn my_fastagency_app.deployment.main_:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &

# Run gunicorn server
gunicorn --workers=$WORKERS my_fastagency_app.deployment.main:app --bind 0.0.0.0:$MESOP_PORT
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done

# Wait for all background processes
wait
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
my_fastagency_app
├── docker
│   ├── Dockerfile
│   ├── nginx.conf.template
│   └── run_fastagency.sh
├── my_fastagency_app
│   ├── deployment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@ FROM python:3.12

WORKDIR /app

# Install nginx
RUN apt-get update && apt-get install -y --no-install-recommends nginx gettext \
&& rm -rf /var/lib/apt/lists/*

COPY my_fastagency_app /app/my_fastagency_app

COPY pyproject.toml README.md docker/run_fastagency.sh /app/
COPY pyproject.toml README.md docker/run_fastagency.sh docker/nginx.conf.template /app/

RUN pip install --upgrade pip && pip install --no-cache-dir -e "."

RUN adduser --disabled-password --gecos '' appuser && chown -R appuser /app
# Add user appuser with root permissions
RUN adduser --disabled-password --gecos '' appuser \
&& chown -R appuser /app \
&& chown -R appuser:appuser /etc/nginx/conf.d /var/log/nginx /var/lib/nginx \
&& touch /run/nginx.pid && chown -R appuser:appuser /run/nginx.pid

USER appuser

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
upstream mesop_backend {
# Enable sticky sessions with IP hash
ip_hash;


}

server {
listen $MESOP_PORT;
server_name localhost;

# Security headers
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
add_header X-XSS-Protection "1; mode=block";

location / {
proxy_pass http://mesop_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;

# WSGI support
proxy_set_header X-Forwarded-Host $server_name;

# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,23 @@ NATS_FASTAPI_PORT=${NATS_FASTAPI_PORT:-8000}

FASTAPI_PORT=${FASTAPI_PORT:-8008}


MESOP_PORT=${MESOP_PORT:-8888}
export MESOP_PORT=${MESOP_PORT:-8888}

# Default number of workers if not set
WORKERS=${WORKERS:-1}
echo "Number of workers: $WORKERS"

# Generate nginx config
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
sed -i "5i\ server 127.0.0.1:$PORT;" nginx.conf.template
done
envsubst '${MESOP_PORT}' < nginx.conf.template >/etc/nginx/conf.d/default.conf
cat /etc/nginx/conf.d/default.conf

# Start nginx
nginx -g "daemon off;" &

# Run nats uvicorn server
uvicorn my_fastagency_app.deployment.main_1_nats:app --host 0.0.0.0 --port $NATS_FASTAPI_PORT > /dev/stdout 2>&1 &
Expand All @@ -20,4 +32,13 @@ uvicorn my_fastagency_app.deployment.main_1_nats:app --host 0.0.0.0 --port $NATS
uvicorn my_fastagency_app.deployment.main_2_fastapi:app --host 0.0.0.0 --port $FASTAPI_PORT > /dev/stdout 2>&1 &

# Run gunicorn server
gunicorn --workers=$WORKERS my_fastagency_app.deployment.main_3_mesop:app --bind 0.0.0.0:$MESOP_PORT
# Start multiple single-worker gunicorn instances on consecutive ports
for ((i=1; i<$WORKERS+1; i++))
do
PORT=$((MESOP_PORT + i))
echo "Starting gunicorn on port $PORT"
gunicorn --workers=1 my_fastagency_app.deployment.main_3_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done

# Wait for all background processes
wait
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
INPUT_MESSAGE = "Send 'Hi!' to 123456789"


@pytest.mark.skip("TODO: Make test not reliant on LLM calls")
@pytest.mark.openai
@skip_internal_server_error
def test_main(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
INPUT_MESSAGE = "Send 'Hi!' to 123456789"


@pytest.mark.skip("TODO: Make test not reliant on LLM calls")
@pytest.mark.openai
@skip_internal_server_error
def test_main(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down
Loading

0 comments on commit cc5e29d

Please sign in to comment.