Skip to content

Commit

Permalink
Rename project to prompt_leakage_probing
Browse files Browse the repository at this point in the history
  • Loading branch information
sternakt committed Nov 27, 2024
1 parent 4ac98d5 commit f0e3b6d
Show file tree
Hide file tree
Showing 46 changed files with 34 additions and 35 deletions.
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
"dockerComposeFile": [
"./docker-compose.yml"
],
"service": "python-3.10-context_leakage_team",

"service": "python-3.10-prompt_leakage_probing",
"secrets": {
"OPENAI_API_KEY": {
"description": "This key is optional and only needed if you are working on OpenAI-related code. Leave it blank if not required. You can always set it later as an environment variable in the codespace terminal."
Expand All @@ -17,7 +16,7 @@
}
},
"shutdownAction": "stopCompose",
"workspaceFolder": "/workspaces/context_leakage_team",
"workspaceFolder": "/workspaces/prompt_leakage_probing",
// "runArgs": [],
"remoteEnv": {},
"features": {
Expand Down
12 changes: 6 additions & 6 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ version: '3'

services:
# nosemgrep: yaml.docker-compose.security.writable-filesystem-service.writable-filesystem-service
python-3.10-context_leakage_team:
python-3.10-prompt_leakage_probing:
image: mcr.microsoft.com/devcontainers/python:3.10
container_name: context_leakage_team-${USER}-python-3.10
container_name: prompt_leakage_probing-${USER}-python-3.10
volumes:
- ../:/workspaces/context_leakage_team:cached
- ../:/workspaces/prompt_leakage_probing:cached
command: sleep infinity

env_file:
- ./devcontainer.env
security_opt:
- no-new-privileges:true
networks:
- context_leakage_team-network
- prompt_leakage_probing-network

networks:
context_leakage_team-network:
name: context_leakage_team-${USER}-network
prompt_leakage_probing-network:
name: prompt_leakage_probing-${USER}-network
3 changes: 0 additions & 3 deletions context_leakage_team/workflow/__init__.py

This file was deleted.

2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends nginx gettext \
&& rm -rf /var/lib/apt/lists/*

COPY context_leakage_team /app/context_leakage_team
COPY prompt_leakage_probing /app/prompt_leakage_probing

COPY pyproject.toml README.md /app/
COPY docker/content/* /app/
Expand Down
4 changes: 2 additions & 2 deletions docker/content/run_fastagency.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ cat /etc/nginx/conf.d/default.conf
nginx -g "daemon off;" &

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

# Run gunicorn server
# 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 context_leakage_team.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
gunicorn --workers=1 prompt_leakage_probing.deployment.main_2_mesop:app --bind 0.0.0.0:$PORT > /dev/stdout 2>&1 &
done

# Wait for all background processes
Expand Down
4 changes: 2 additions & 2 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# fly.toml app configuration file generated for context_leakage_team
# fly.toml app configuration file generated for prompt_leakage_probing
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'context-leakage-team'
app = 'prompt-leakage-probing'
primary_region = 'ams'

[build]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ def list_workflows() -> dict[str, Any]:


# start the adapter with the following command
# uvicorn context_leakage_team.deployment.main_1_fastapi:app --reload
# uvicorn prompt_leakage_probing.deployment.main_1_fastapi:app --reload
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
app = FastAgency(
provider=provider,
ui=MesopUI(),
title="Context Leakage Team",
title="Prompt Leakage Probing",
)

# start the provider with the following command
# gunicorn context_leakage_team.deployment.main_2_mesop:app -b 0.0.0.0:8888 --reload
# gunicorn prompt_leakage_probing.deployment.main_2_mesop:app -b 0.0.0.0:8888 --reload
3 changes: 3 additions & 0 deletions prompt_leakage_probing/workflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from prompt_leakage_probing.workflow.workflow import wf

__all__ = ["wf"]
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from .context_leakage_black_box.prompt_leakage_black_box import (
from .prompt_leakage_black_box.prompt_leakage_black_box import (
PromptGeneratorAgent,
)
from .context_leakage_classifier.prompt_leakage_classifier import (
from .prompt_leakage_classifier.prompt_leakage_classifier import (
PromptLeakageClassifierAgent,
)

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from autogen.agentchat import Agent, ConversableAgent, UserProxyAgent
from fastagency import UI

from context_leakage_team.workflow.agents import (
from prompt_leakage_probing.workflow.agents import (
PromptGeneratorAgent,
PromptLeakageClassifierAgent,
)
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "context-leakage-team"
description = "Context leakage team: FastAgency based team for testing context leakage."
name = "prompt-leakage-probing"
description = "Prompt leakage team: FastAgency based team for testing prompt leakage."
readme = "README.md"
authors = [
{ name = "airt", email = "[email protected]" },
Expand Down Expand Up @@ -46,18 +46,18 @@ testing = [
]

dev = [
"context-leakage-team[lint,testing]",
"prompt-leakage-probing[lint,testing]",
"pre-commit==4.0.1",
"detect-secrets==1.5.0",
]

[project.urls]

[tool.hatch.version]
path = "context_leakage_team/__about__.py"
path = "prompt_leakage_probing/__about__.py"

[tool.hatch.build.targets.wheel]
only-include = ["context_leakage_team"]
only-include = ["prompt_leakage_probing"]

[tool.pytest.ini_options]
filterwarnings =["ignore::DeprecationWarning"]
Expand All @@ -68,7 +68,7 @@ testpaths = [

[tool.mypy]

files = ["context_leakage_team", "tests"]
files = ["prompt_leakage_probing", "tests"]

strict = true
python_version = "3.10"
Expand All @@ -94,7 +94,7 @@ disallow_any_unimported = false
[tool.ruff]
fix = true
line-length = 88
include = ["context_leakage_team/**/*.py", "context_leakage_team/**/*.pyi", "pyproject.toml"]
include = ["prompt_leakage_probing/**/*.py", "prompt_leakage_probing/**/*.pyi", "pyproject.toml"]
exclude = []

[tool.ruff.lint]
Expand Down
2 changes: 1 addition & 1 deletion scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

echo "Running pyup_dirs..."
pyup_dirs --py38-plus --recursive context_leakage_team tests
pyup_dirs --py38-plus --recursive prompt_leakage_probing tests

echo "Running ruff linter (isort, flake, pyupgrade, etc. replacement)..."
ruff check
Expand Down
4 changes: 2 additions & 2 deletions scripts/run_fastapi_locally.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ cleanup() {
trap 'cleanup; trap - SIGINT; kill -SIGINT $$' SIGINT

# Start uvicorn in the background and save its PID
uvicorn context_leakage_team.deployment.main_1_fastapi:app --port 8008 --reload &
uvicorn prompt_leakage_probing.deployment.main_1_fastapi:app --port 8008 --reload &
uvicorn_pid=$!

# Start gunicorn in the background and save its PID
gunicorn context_leakage_team.deployment.main_2_mesop:app -b 0.0.0.0:8888 --reload &
gunicorn prompt_leakage_probing.deployment.main_2_mesop:app -b 0.0.0.0:8888 --reload &
gunicorn_pid=$!

# Wait for both processes to finish
Expand Down
2 changes: 1 addition & 1 deletion scripts/static-analysis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ echo "Running mypy..."
mypy

echo "Running bandit..."
bandit -c pyproject.toml -r context_leakage_team
bandit -c pyproject.toml -r prompt_leakage_probing

echo "Running semgrep..."
semgrep scan --config auto --error
2 changes: 1 addition & 1 deletion tests/test_model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest
import requests

from context_leakage_team.workflow.tools.model_adapter import create_send_msg_to_model
from prompt_leakage_probing.workflow.tools.model_adapter import create_send_msg_to_model


# Test case for a successful API call
Expand Down

0 comments on commit f0e3b6d

Please sign in to comment.