A sophisticated AI-powered code generation system that uses a unique "thought-first" approach with large language models to generate high-quality code implementations and test cases.
- 🧠 Two-stage thinking process using specialized LLMs
- 🔄 Automated test case generation
- 💻 Intelligent code implementation
- 🔍 Comprehensive codebase analysis
- 📝 Detailed logging and documentation
- Clones target repository
- Analyzes existing codebase
- Generates comprehensive test cases using pytest
- Implements test fixtures and edge cases
- Implements new features based on test cases
- Ensures code quality and best practices
- Validates implementation against tests
- Maintains existing codebase integrity
This project implements a novel two-stage thinking process:
- Thought Generation 🤔
# First, generate deep analysis using DeepSeek-V3
thought = together_client.chat.completions.create(
model="deepseek-ai/DeepSeek-R1",
messages=[...],
stop=['</think>']
)- Code Implementation ⌨️
# Then, use Qwen Coder with the generated thoughts
prompt_with_thought = prompt + f"""
Consider this analysis when implementing:
<think>
{thought_result}
</think>
"""- 🎯 Better problem understanding
- 🔍 More thorough solution analysis
- 💡 Improved code quality
- 🐛 Fewer bugs and edge cases missed
- Python 3.8+
- Together AI API key
- Git
git clone https://github.com/yourusername/code_generation_agent
cd code_generation_agent
pip install -r requirements.txtfrom code_generation_agent import TestCaseGenerator, FeatureImplementer
# Initialize and run test generation
generator = TestCaseGenerator(
repo_url="your_repo_url",
feature_description="your_feature_description",
together_api_key="your_api_key"
)
generator.generate_and_run_tests()
# Implement features
implementer = FeatureImplementer(
repo_url="your_repo_url",
feature_description="your_feature_description",
together_api_key="your_api_key"
)
implementer.implement_features()The system uses specific LLM models for different tasks:
- 🤔 Thought Generation: DeepSeek-V3
- 💻 Code Generation: Qwen2.5-Coder-32B-Instruct
- Never commit API keys to version control
- Use environment variables for sensitive data
- Regularly rotate API keys
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For questions and support, please open an issue in the repository.