Skip to content

Commit

Permalink
Merge pull request #25 from ApeWorX/feat/claude
Browse files Browse the repository at this point in the history
feat: add claude
  • Loading branch information
Ninjagod1251 authored Nov 14, 2024
2 parents d8d44c3 + e435a73 commit e823dfd
Show file tree
Hide file tree
Showing 42 changed files with 7,200 additions and 269 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/backend-deploy.yml

This file was deleted.

40 changes: 40 additions & 0 deletions .github/workflows/cicd-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Deploy Bot to Railway

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'

- name: Install Railway CLI
run: |
curl -fsSL https://railway.app/install.sh | sh
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run tests
run: |
pytest tests/test_manual.py
env:
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
CLAUDE_KEY: ${{ secrets.CLAUDE_KEY }}

permissions:
contents: read
32 changes: 0 additions & 32 deletions .github/workflows/landing-deploy.yml

This file was deleted.

24 changes: 24 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Environment variables
.env
.env.*
!.env.example

# Python
__pycache__/
*.py[cod]
*$py.class
venv/
ENV/

# Project specific
sources/
responses/
*_config.yml
knowledge-base.txt

# IDE
.idea/
.vscode/

# System
.DS_Store
29 changes: 19 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,26 @@
# Use the specific version of Python
FROM python:3.10.6
FROM python:3.10-slim

# Set the working directory in the container
WORKDIR /app

# Copy the Python requirements file into the container at /app
COPY requirements.txt /app/
# Install system dependencies
RUN apt-get update && \
apt-get install -y git && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Install any needed packages specified in requirements.txt
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application's code into the container at /app
COPY . /app/
# Copy the application
COPY . .

# Run bot.py when the container launches
CMD ["python", "bot.py"]
# Create necessary directories
RUN mkdir -p sources responses

# Set environment variables
ENV ENVIRONMENT=production
ENV DEBUG=False

# Run the bot
CMD ["python", "telegram_bot.py"]
134 changes: 115 additions & 19 deletions ape-gpt-cli/README.md
Original file line number Diff line number Diff line change
@@ -1,45 +1,141 @@
# ape-gpt
# ApeGenius

The `ape-gpt` CLI tool facilitates interactions between GPT (Generative Pre-trained Transformer) models and GitHub repositories. It streamlines the process of cloning repositories, managing your OpenAI API key, and sending prompts to GPT using the contents of the cloned repositories.
A CLI tool that facilitates interactions between AI language models (GPT and Claude) and GitHub repositories, designed specifically for analyzing and understanding Ape Framework codebases. It streamlines the process of cloning repositories, managing API keys, and sending prompts using the contents of cloned repositories.

## Features

- Support for both GPT-4 and Claude
- Secure API key management
- GitHub repository cloning
- Source code analysis optimized for Ape Framework
- Response logging and tracking
- Command-line interface

## Installation

To get started with `ape-gpt`, follow these steps:
1. Clone the repository:
```bash
git clone https://github.com/ApeWorX/apegenius.git
cd apegenius
```

1. Clone the `ape-gpt` repository to your local machine.
2. Install the required Python dependencies by executing `pip install -r requirements.txt` in your terminal.
2. Install dependencies:
```bash
pip install -r requirements.txt
```

## Usage

### Configuring the OpenAI API Key
### GPT Commands

Set up your OpenAI API key with `ape-gpt` by running:
Configure OpenAI API key:
```bash
python gpt.py config
```

Clone a repository:
```bash
python gpt.py clone
```
python gpt.py config

Send a prompt:
```bash
python gpt.py prompt --src "source_directory" "Your prompt text"
```

You will be prompted to enter your OpenAI API key, which will be stored securely for future use.
### Claude Commands

### Cloning a GitHub Repository
Configure Claude API key:
```bash
python claude.py config
```

Clone a GitHub repository into the local `sources` directory with the following command:
Clone a repository:
```bash
python claude.py clone
```

Send a prompt:
```bash
python claude.py prompt --src "source_directory" "Your prompt text"
```
python gpt.py clone <repository-url>

### Multiple Source Directories

Both tools support analyzing multiple source directories in a single prompt:
```bash
python gpt.py prompt --src "dir1" --src "dir2" "Your prompt"
python claude.py prompt --src "dir1" --src "dir2" "Your prompt"
```

### Sending a Prompt to GPT
## Project Structure

```
apegenius/
├── gpt.py # GPT interface
├── claude.py # Claude interface
├── requirements.txt # Project dependencies
├── sources/ # Cloned repositories
└── responses/ # AI responses
```

Send a custom prompt to GPT using the content from one or more specified source directories:
## Response Storage

All responses are automatically saved in the `responses` directory with the following information:
- Source directories used
- Original prompt
- AI response
- Timestamp

## Configuration

- API keys are stored securely using base64 encoding
- GPT config: `gpt_config.yml`
- Claude config: `claude_config.yml`

## Example Usage

1. Set up API keys:
```bash
python gpt.py config # For GPT
python claude.py config # For Claude
```
python gpt.py prompt --src "source_directory1" --src "source_directory2" "Your prompt text"

2. Clone the Ape repository:
```bash
python gpt.py clone https://github.com/ApeWorX/ape.git
```

3. Analyze the code:
```bash
python claude.py prompt --src "ape" "Explain the main functionality of this Ape codebase"
```

The GPT response will be displayed in the terminal and also saved within the `responses` directory for your reference.
## Requirements

- Python 3.8+
- Git
- OpenAI API key (for GPT)
- Anthropic API key (for Claude)
- Required Python packages (see requirements.txt)

## Error Handling

Both tools include robust error handling for:
- Invalid API keys
- Repository cloning issues
- File reading errors
- API rate limits
- Network connectivity issues

## Contributing

Contributions are welcome! Please feel free to submit a Pull Request to the [ApeGenius repository](https://github.com/ApeWorX/apegenius).

## License

[Apache License 2.0](LICENSE)

## Organization
## Support

- Cloned repositories are stored in the `sources` directory.
- GPT responses are saved in the `responses` directory.
For issues and feature requests, please open an issue on the [ApeGenius GitHub repository](https://github.com/ApeWorX/apegenius/issues).
Loading

0 comments on commit e823dfd

Please sign in to comment.