Skip to content
Open
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
132 changes: 132 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, caste, color, religion, or sexual
identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of
any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address,
without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official email address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[INSERT CONTACT METHOD].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series of
actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or permanent
ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within the
community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.1, available at
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].

Community Impact Guidelines were inspired by
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].

For answers to common questions about this code of conduct, see the FAQ at
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
[https://www.contributor-covenant.org/translations][translations].

[homepage]: https://www.contributor-covenant.org
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
[Mozilla CoC]: https://github.com/mozilla/diversity
[FAQ]: https://www.contributor-covenant.org/faq
[translations]: https://www.contributor-covenant.org/translations
264 changes: 264 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,264 @@
# Contributing to Whistleblower

Thank you for your interest in contributing to Whistleblower! This document provides guidelines and information for contributors.

## Table of Contents

- [Code of Conduct](#code-of-conduct)
- [Getting Started](#getting-started)
- [Development Setup](#development-setup)
- [Contributing Guidelines](#contributing-guidelines)
- [Project Structure](#project-structure)
- [Testing](#testing)
- [Submitting Changes](#submitting-changes)
- [Issue Reporting](#issue-reporting)
- [Documentation](#documentation)

## Code of Conduct

This project follows our [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.

## Getting Started

Whistleblower is a tool designed to infer the system prompt of an AI agent based on its generated text outputs. It leverages pretrained LLMs to analyze responses and generate detailed system prompts using the methodology from [Zhang et al.](https://arxiv.org/abs/2405.15012).

### Prerequisites

- Python 3.8 or higher
- OpenAI API key
- Git

## Development Setup

1. **Fork and clone the repository**
```bash
git clone https://github.com/your-username/whistleblower.git
cd whistleblower
```

2. **Install dependencies**
```bash
pip install -r requirements.txt
```

3. **Set up environment variables**
```bash
export OPENAI_API_KEY="your-openai-api-key"
```

4. **Test the installation**
```bash
python main.py --json_file input_example.json
```

## Contributing Guidelines

### Types of Contributions

We welcome several types of contributions:

- **Bug fixes**: Fix issues in existing functionality
- **Feature enhancements**: Add new capabilities to the tool
- **Documentation improvements**: Update README, code comments, or this file
- **UI/UX improvements**: Enhance the Gradio interface
- **Performance optimizations**: Improve speed or efficiency
- **Testing**: Add unit tests or integration tests

### Development Workflow

1. **Create a feature branch**
```bash
git checkout -b feature/your-feature-name
```

2. **Make your changes**
- Follow the existing code style
- Add appropriate comments
- Update documentation if needed

3. **Test your changes**
```bash
# Test command line interface
python main.py --json_file input_example.json

# Test web interface
cd ui
python app.py
```

4. **Commit your changes**
```bash
git add .
git commit -m "Add: brief description of your changes"
```

5. **Push and create a pull request**
```bash
git push origin feature/your-feature-name
```

## Project Structure

```
whistleblower/
├── core/ # Core functionality
│ ├── __init__.py
│ ├── api.py # External API communication
│ ├── attacker_system_prompt.txt # Attacker model prompt
│ ├── judge_system_prompt.txt # Judge model prompt
│ ├── seeds.py # Seed data (if any)
│ ├── system_prompt.txt # Main system prompt
│ ├── utils.py # Utility functions
│ └── whistleblower.py # Main logic
├── ui/ # User interface
│ ├── __init__.py
│ ├── app.py # Gradio web interface
│ └── styles.css # UI styling
├── main.py # Command line entry point
├── input_example.json # Example configuration
├── requirements.txt # Python dependencies
└── README.md # Project documentation
```

### Key Components

- **`core/whistleblower.py`**: Main logic for system prompt extraction
- **`core/api.py`**: Handles external API calls to target models
- **`ui/app.py`**: Gradio web interface
- **`main.py`**: Command-line interface

## Testing

### Manual Testing

1. **Test with example configuration**
```bash
python main.py --json_file input_example.json
```

2. **Test web interface**
```bash
cd ui
python app.py
```

3. **Test with different models**
- Try different OpenAI models (gpt-4, gpt-3.5-turbo, gpt-4o)
- Test with various API endpoints

### Automated Testing

We encourage adding unit tests for new functionality. Consider testing:

- API communication functions
- JSON parsing and validation
- Prompt generation logic
- Error handling

## Submitting Changes

### Pull Request Process

1. **Ensure your changes work**
- Test both CLI and web interfaces
- Verify with different model configurations
- Check for any linting errors

2. **Write a clear description**
- Explain what your changes do
- Reference any related issues
- Include screenshots for UI changes

3. **Follow the template**
- Use the provided pull request template
- Fill out all relevant sections

### Code Style Guidelines

- Use meaningful variable and function names
- Add docstrings for new functions
- Follow PEP 8 style guidelines
- Keep functions focused and modular
- Add type hints where appropriate

### Commit Message Format

Use clear, descriptive commit messages:

```
Add: feature description
Fix: bug description
Update: improvement description
Docs: documentation changes
```

## Issue Reporting

### Before Reporting

1. Check existing issues to avoid duplicates
2. Test with the latest version
3. Gather relevant information (error messages, logs, etc.)

### Bug Reports

Include the following information:

- **Description**: Clear description of the bug
- **Steps to reproduce**: Detailed steps to reproduce the issue
- **Expected behavior**: What should happen
- **Actual behavior**: What actually happens
- **Environment**: Python version, OS, dependencies
- **Configuration**: Your input JSON or API settings (remove sensitive keys)

### Feature Requests

For new features, please include:

- **Use case**: Why is this feature needed?
- **Proposed solution**: How should it work?
- **Alternatives**: Other approaches you've considered

## Documentation

### Code Documentation

- Add docstrings to new functions and classes
- Include type hints for function parameters and returns
- Comment complex logic or algorithms

### User Documentation

- Update README.md for new features
- Add examples for new functionality
- Update this CONTRIBUTING.md as needed

## Security Considerations

⚠️ **Important Security Notes**

- Never commit API keys or sensitive credentials
- Be cautious when testing with production APIs
- Consider rate limiting and API usage costs
- Report security vulnerabilities privately to maintainers

## Community

- **Discussions**: Use GitHub Discussions for questions and ideas
- **Issues**: Use GitHub Issues for bugs and feature requests
- **Pull Requests**: Use GitHub Pull Requests for code contributions

## License

By contributing to Whistleblower, you agree that your contributions will be licensed under the same license as the project.

## Getting Help

If you need help getting started or have questions:

1. Check the [README.md](README.md) for basic usage
2. Look through existing [issues](https://github.com/Repello-AI/whistleblower/issues)
3. Start a [discussion](https://github.com/Repello-AI/whistleblower/discussions)
4. Contact the maintainers

Thank you for contributing to Whistleblower! 🚀