Skip to content
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
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Set line endings to LF, even on Windows. Otherwise, execution within Docker fails.
# See https://help.github.com/articles/dealing-with-line-endings/
*.sh text eol=lf
*.sh text eol=lf
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.1
- uses: pre-commit-ci/lite-action@v1.1.0
if: always()
if: always()
1 change: 0 additions & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,3 @@ python:
path: .
extra_requirements:
- docs

2 changes: 1 addition & 1 deletion avise/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "0.2.0"
__app__ = "AVISE"
__description__ = "AI Vulnerability Identification & Security Evaluation framework"
__description__ = "AI Vulnerability Identification & Security Evaluation framework"
2 changes: 1 addition & 1 deletion avise/configs/SET/languagemodel/multi_turn/red_queen.json
Original file line number Diff line number Diff line change
Expand Up @@ -1104,4 +1104,4 @@
]
}
]
}
}
2 changes: 1 addition & 1 deletion avise/configs/connector/genericrest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"method": "POST",
"max_tokens": 256
}
}
}
2 changes: 1 addition & 1 deletion avise/configs/connector/ollama.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"api_key": null,
"max_tokens": 768
}
}
}
2 changes: 1 addition & 1 deletion avise/configs/connector/openai.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
"headers": null,
"api_key": "YOUR_OPENAI_API_KEY_HERE"
}
}
}
2 changes: 1 addition & 1 deletion avise/connectors/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from . import languagemodel
from . import languagemodel
8 changes: 7 additions & 1 deletion avise/evaluators/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
from . import languagemodel
from .base import BaseLMEvaluator
from .refusal import RefusalEvaluator
from .vulnerability import VulnerabilityEvaluator
from .partial_compliance import PartialComplianceEvaluator
from .suspicious_output import SuspiciousOutputEvaluator

#__all__ = ["BaseLMEvaluator", "RefusalEvaluator", "VulnerabilityEvaluator", "PartialComplianceEvaluator", "SuspiciousOutputEvaluator"]
9 changes: 2 additions & 7 deletions avise/evaluators/languagemodel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
from .base import BaseLMEvaluator
from .refusal import RefusalEvaluator
from .vulnerability import VulnerabilityEvaluator
from .partial_compliance import PartialComplianceEvaluator
from .suspicious_output import SuspiciousOutputEvaluator

#__all__ = ["BaseLMEvaluator", "RefusalEvaluator", "VulnerabilityEvaluator", "PartialComplianceEvaluator", "SuspiciousOutputEvaluator"]
from .adversarial_lm import AdversarialLanguageModel
from .evaluation_lm import EvaluationLanguageModel
6 changes: 4 additions & 2 deletions avise/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
from .adversarial_lm import AdversarialLanguageModel
from .evaluation_lm import EvaluationLanguageModel
from .pipeline import BaseSETPipeline
from .schema import LanguageModelSETCase, ExecutionOutput, OutputData, EvaluationResult, ReportData

#__all__ = ["BaseSETPipeline", "LanguageModelSETCase", "ExecutionOutput", "OutputData", "AnalysisResult", "ReportData"]
5 changes: 2 additions & 3 deletions avise/pipelines/languagemodel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from .pipeline import BaseSETPipeline
from .schema import LanguageModelSETCase, ExecutionOutput, OutputData, EvaluationResult, ReportData
from .registry import evaluator_registry, connector_registry, set_registry

#__all__ = ["BaseSETPipeline", "LanguageModelSETCase", "ExecutionOutput", "OutputData", "AnalysisResult", "ReportData"]
__all__ = ["evaluator_registry", "connector_registry", "set_registry"]
4 changes: 1 addition & 3 deletions avise/registry/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from .registry import evaluator_registry, connector_registry, set_registry

__all__ = ["evaluator_registry", "connector_registry", "set_registry"]
from . import reporters
4 changes: 3 additions & 1 deletion avise/reportgen/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from . import reporters
from . import multi_turn
from . import single_turn
#__all__ = ["PromptInjectionTest", "ContextTest"]
4 changes: 1 addition & 3 deletions avise/sets/languagemodel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
from . import multi_turn
from . import single_turn
#__all__ = ["PromptInjectionTest", "ContextTest"]
from .prompt_injection import PromptInjectionTest
21 changes: 20 additions & 1 deletion avise/sets/languagemodel/single_turn/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
from .prompt_injection import PromptInjectionTest
FROM ollama/ollama:latest

# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*

# Create directory for models
RUN mkdir -p /root/.ollama

# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Expose Ollama API port
EXPOSE 11434

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:11434/api/tags || exit 1

ENTRYPOINT ["/entrypoint.sh"]
35 changes: 17 additions & 18 deletions docker/ollama/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
FROM ollama/ollama:latest
version: '3.9'

# Install curl for health checks
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
services:
ollama:
build:
context: .
dockerfile: Dockerfile
container_name: avise-ollama
ports:
- "11434:11434"
environment:
- OLLAMA_HOST=0.0.0.0:11434
- MODELS=llama3.2:3b, phi4-mini
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped

# Create directory for models
RUN mkdir -p /root/.ollama

# Copy entrypoint script
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh

# Expose Ollama API port
EXPOSE 11434

# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
CMD curl -f http://localhost:11434/api/tags || exit 1

ENTRYPOINT ["/entrypoint.sh"]
volumes:
ollama_data:
9 changes: 8 additions & 1 deletion docker/ollama/docker-compose-cpu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ services:
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]

volumes:
ollama_data:
ollama_data:
87 changes: 61 additions & 26 deletions docker/ollama/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,61 @@
version: '3.9'

services:
ollama:
build:
context: .
dockerfile: Dockerfile
container_name: avise-ollama
ports:
- "11434:11434"
environment:
- OLLAMA_HOST=0.0.0.0:11434
- MODELS=llama3.2:3b, phi4-mini
volumes:
- ollama_data:/root/.ollama
restart: unless-stopped
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]

volumes:
ollama_data:
#!/bin/bash
set -e

# Configuration
OLLAMA_HOST="${OLLAMA_HOST:-0.0.0.0:11434}"
MODELS="${MODELS:-llama3.2:3b}"

echo "=========================================="
echo "AIVuT Ollama Container"
echo "=========================================="
echo "Host: $OLLAMA_HOST"
echo "Models to load: $MODELS"
echo "=========================================="

# Start Ollama server in background
echo "[*] Starting Ollama server..."
ollama serve &
OLLAMA_PID=$!

# Wait for server to be ready
echo "[*] Waiting for Ollama server to be ready..."
MAX_RETRIES=30
RETRY_COUNT=0

while ! curl -s http://localhost:11434/api/tags > /dev/null 2>&1; do
RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then
echo "[!] ERROR: Ollama server failed to start after $MAX_RETRIES attempts"
exit 1
fi
echo "[*] Waiting for server... (attempt $RETRY_COUNT/$MAX_RETRIES)"
sleep 2
done

echo "[+] Ollama server is ready"

# Pull required models
echo "[*] Pulling models..."
IFS=',' read -ra MODEL_ARRAY <<< "$MODELS"
for MODEL in "${MODEL_ARRAY[@]}"; do
MODEL=$(echo "$MODEL" | xargs) # Trim whitespace
echo "[*] Pulling model: $MODEL"

if ollama pull "$MODEL"; then
echo "[+] Successfully pulled: $MODEL"
else
echo "[!] WARNING: Failed to pull model: $MODEL"
fi
done

echo "=========================================="
echo "[+] Ollama container ready"
echo "[+] API available at http://localhost:11434"
echo "=========================================="

# List available models
echo "[*] Available models:"
ollama list

# Keep container running by waiting on Ollama process
wait $OLLAMA_PID
67 changes: 12 additions & 55 deletions docker/ollama/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,61 +1,18 @@
#!/bin/bash
set -e
# Documentation README

# Configuration
OLLAMA_HOST="${OLLAMA_HOST:-0.0.0.0:11434}"
MODELS="${MODELS:-llama3.2:3b}"
## Building the Documentation

echo "=========================================="
echo "AIVuT Ollama Container"
echo "=========================================="
echo "Host: $OLLAMA_HOST"
echo "Models to load: $MODELS"
echo "=========================================="
1. Install dependencies:

# Start Ollama server in background
echo "[*] Starting Ollama server..."
ollama serve &
OLLAMA_PID=$!
```console
python -m pip install -r requirements.txt
python -m pip install -r docs/requirements-docs.txt
```

# Wait for server to be ready
echo "[*] Waiting for Ollama server to be ready..."
MAX_RETRIES=30
RETRY_COUNT=0
2. Build the documentation:

while ! curl -s http://localhost:11434/api/tags > /dev/null 2>&1; do
RETRY_COUNT=$((RETRY_COUNT + 1))
if [ $RETRY_COUNT -ge $MAX_RETRIES ]; then
echo "[!] ERROR: Ollama server failed to start after $MAX_RETRIES attempts"
exit 1
fi
echo "[*] Waiting for server... (attempt $RETRY_COUNT/$MAX_RETRIES)"
sleep 2
done
```console
make -C docs/source html
```

echo "[+] Ollama server is ready"

# Pull required models
echo "[*] Pulling models..."
IFS=',' read -ra MODEL_ARRAY <<< "$MODELS"
for MODEL in "${MODEL_ARRAY[@]}"; do
MODEL=$(echo "$MODEL" | xargs) # Trim whitespace
echo "[*] Pulling model: $MODEL"

if ollama pull "$MODEL"; then
echo "[+] Successfully pulled: $MODEL"
else
echo "[!] WARNING: Failed to pull model: $MODEL"
fi
done

echo "=========================================="
echo "[+] Ollama container ready"
echo "[+] API available at http://localhost:11434"
echo "=========================================="

# List available models
echo "[*] Available models:"
ollama list

# Keep container running by waiting on Ollama process
wait $OLLAMA_PID
The HTML is created in the `docs/source/_build/html` directory.
21 changes: 3 additions & 18 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
# Documentation README

## Building the Documentation

1. Install dependencies:

```console
python -m pip install -r requirements.txt
python -m pip install -r docs/requirements-docs.txt
```

2. Build the documentation:

```console
make -C docs/source html
```

The HTML is created in the `docs/source/_build/html` directory.
sphinx
sphinx-rtd-theme
sphinx-github-style
Loading
Loading