Skip to main content

Automated API package generator with LLM integration

Project description

APIpack - Architektura Systemu

APIpack ๐Ÿš€

Automated API Package Generator with LLM Integration

APIpack is a powerful framework that generates complete API packages from function specifications using local LLM models (Mistral 7B) and customizable templates. Focus on writing business logic while APIpack handles all the interface boilerplate.

โœจ Features

  • ๐Ÿค– LLM-Powered: Uses Mistral 7B for intelligent function generation
  • ๐ŸŽฏ Multi-Interface: Generates REST, gRPC, GraphQL, WebSocket, and CLI interfaces
  • ๐ŸŒ Multi-Language: Supports Python, JavaScript, Go, Rust, and more
  • ๐Ÿ“ฆ Template System: Extensible template engine with built-in and custom templates
  • ๐Ÿ”Œ Plugin Architecture: Easy to extend with custom interfaces and generators
  • ๐Ÿณ Deployment Ready: Includes Docker, Kubernetes, and CI/CD configurations
  • ๐Ÿงช Test Generation: Automatically generates comprehensive test suites
  • ๐Ÿ“š Documentation: Auto-generates API docs, README files, and examples

๐Ÿš€ Quick Start

Installation

pip install apipack

Prerequisites

  1. Install Ollama (for local LLM):
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull mistral:7b
  1. Start Ollama server:
ollama serve

Generate Your First API Package

  1. Create a function specification:
apipack init --name pdf_to_text --description "Extract text from PDF files"
  1. Edit the generated function_spec.yml:
name: pdf_to_text
description: Extract text from PDF files
input_type: bytes
output_type: string
interfaces:
  - rest
  - grpc
  - cli
dependencies:
  - PyPDF2>=3.0.0
  1. Generate the package:
apipack generate function_spec.yml --language python --output ./my-pdf-service
  1. Build and run:
cd my-pdf-service
docker build -t pdf-service .
docker run -p 8080:8080 pdf-service
  1. Test your API:
curl -X POST -F "file=@document.pdf" http://localhost:8080/extract

๐Ÿ“‹ Example Specifications

Simple Function

name: image_resize
description: Resize images to specified dimensions
input_type: bytes
output_type: bytes
parameters:
  - name: image_data
    type: bytes
    required: true
  - name: width
    type: int
    default: 800
  - name: height
    type: int
    default: 600
interfaces:
  - rest
  - cli

Complex Service

project:
  name: document-processor
  description: Multi-format document processing service

functions:
  - name: pdf_to_text
    description: Extract text from PDF
    input_type: bytes
    output_type: string
    
  - name: html_to_pdf
    description: Convert HTML to PDF
    input_type: string
    output_type: bytes
    
  - name: image_to_text
    description: OCR for images
    input_type: bytes
    output_type: string

interfaces: [rest, grpc, websocket]
language: python

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   Function      โ”‚    โ”‚   Mistral 7B    โ”‚    โ”‚   Templates     โ”‚
โ”‚ Specifications  โ”‚โ”€โ”€โ”€โ–ถโ”‚   (Logic Gen)   โ”‚    โ”‚  (Interfaces)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                       โ”‚
                                โ–ผ                       โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚         APIpack Engine             โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
                       โ”‚  โ”‚   Parser    โ”‚ โ”‚  Generator  โ”‚   โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
                       โ”‚  โ”‚ Validator   โ”‚ โ”‚  Deployer   โ”‚   โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚        Generated Package           โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
                       โ”‚  โ”‚   REST  โ”‚ โ”‚  gRPC   โ”‚ โ”‚ CLI  โ”‚  โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ› ๏ธ CLI Commands

Core Commands

# Generate package from specification
apipack generate spec.yml --language python --interfaces rest,grpc

# Validate specification file
apipack validate spec.yml

# Initialize new specification
apipack init --name my_function

# List available templates
apipack templates

# Show current configuration
apipack config

# Health check
apipack health

Advanced Usage

# Generate with custom output directory
apipack generate spec.yml -o ./custom-output --language go

# Dry run (preview without generating)
apipack generate spec.yml --dry-run

# Build generated package
apipack build ./generated-package --type docker --push

# Generate with specific interfaces
apipack generate spec.yml -i rest -i grpc -i websocket

๐ŸŽฏ Supported Interfaces

Interface Description Status
REST HTTP/JSON API with OpenAPI docs โœ…
gRPC High-performance RPC โœ…
GraphQL Query language API โœ…
WebSocket Real-time bidirectional communication โœ…
CLI Command-line interface โœ…
Async Async/await patterns ๐Ÿšง

๐ŸŒ Supported Languages

Language Status Features
Python โœ… FastAPI, asyncio, type hints
JavaScript โœ… Express, async/await, ESM
TypeScript โœ… Type safety, decorators
Go โœ… Goroutines, channels, modules
Rust ๐Ÿšง Memory safety, performance
Java ๐Ÿšง Spring Boot, annotations

๐Ÿ“ฆ Template System

APIpack uses a flexible template system that can be extended:

Built-in Templates

templates/
โ”œโ”€โ”€ interfaces/
โ”‚   โ”œโ”€โ”€ rest/           # REST API templates
โ”‚   โ”œโ”€โ”€ grpc/           # gRPC service templates
โ”‚   โ”œโ”€โ”€ graphql/        # GraphQL schema templates
โ”‚   โ””โ”€โ”€ cli/            # CLI application templates
โ”œโ”€โ”€ languages/
โ”‚   โ”œโ”€โ”€ python/         # Python-specific templates
โ”‚   โ”œโ”€โ”€ javascript/     # JavaScript-specific templates
โ”‚   โ””โ”€โ”€ go/             # Go-specific templates
โ””โ”€โ”€ deployment/
    โ”œโ”€โ”€ docker/         # Docker configurations
    โ”œโ”€โ”€ kubernetes/     # K8s manifests
    โ””โ”€โ”€ ci/             # CI/CD pipelines

Custom Templates

Create custom templates in ~/.apipack/templates/:

# ~/.apipack/templates/my-interface/template.yml
name: my-interface
category: interface
language: python
description: Custom interface template

files:
  - src: server.py.j2
    dest: "{{ interface_type }}/server.py"
  - src: client.py.j2
    dest: "{{ interface_type }}/client.py"

โš™๏ธ Configuration

Global Configuration

Create ~/.apipack/config.yml:

llm:
  provider: mistral
  model: mistral:7b
  temperature: 0.1
  max_tokens: 2048

templates:
  auto_discover: true
  cache_enabled: true
  validation_level: strict

output:
  format: package
  include_tests: true
  include_docs: true

Project Configuration

Create project.apipack.yml in your project:

name: my-api-service
language: python
interfaces:
  - rest
  - grpc

functions:
  - spec: functions/pdf_processor.yml
  - spec: functions/image_resizer.yml

deployment:
  docker:
    base_image: python:3.11-slim
  kubernetes:
    replicas: 3

๐Ÿ”Œ Plugin Development

Create custom plugins to extend APIpack:

# plugins/my_plugin.py
from apipack.plugins import BasePlugin

class MyInterfacePlugin(BasePlugin):
    name = "my-interface"
    
    def generate(self, function_specs, language, output_dir):
        # Custom generation logic
        return generated_files
    
    def validate(self, generated_files):
        # Custom validation logic
        return validation_result

Register plugin:

from apipack.plugins import register_plugin
register_plugin(MyInterfacePlugin())

๐Ÿ“Š Examples

PDF Processing Service

git clone https://github.com/apipack/examples
cd examples/pdf-processor
apipack generate config.yml
docker-compose up

Image Resize API

apipack init --name image_resize
# Edit function_spec.yml
apipack generate function_spec.yml --language go --interfaces rest,grpc

Multi-Function Service

# multi-service.yml
project:
  name: document-tools
  
functions:
  - name: pdf_to_text
    input_type: bytes
    output_type: string
    
  - name: html_to_pdf  
    input_type: string
    output_type: bytes
    
  - name: compress_image
    input_type: bytes
    output_type: bytes

interfaces: [rest, grpc]
language: python

๐Ÿงช Testing

Generated packages include comprehensive tests:

# Run tests in generated package
cd generated-package
pytest tests/ --cov=src --cov-report=html

# Integration tests
python -m pytest tests/integration/

# Load tests
locust -f tests/load/locustfile.py

๐Ÿš€ Deployment

Docker

# Generated Dockerfile is production-ready
docker build -t my-service .
docker run -p 8080:8080 my-service

Kubernetes

# Apply generated manifests
kubectl apply -f kubernetes/

Cloud Platforms

# Deploy to various platforms
apipack deploy --platform heroku
apipack deploy --platform aws-lambda
apipack deploy --platform gcp-cloud-run

๐Ÿ” Monitoring & Observability

Generated services include:

  • Health Checks: /health endpoint
  • Metrics: Prometheus metrics
  • Logging: Structured logging with correlation IDs
  • Tracing: OpenTelemetry integration
  • Documentation: Auto-generated OpenAPI/gRPC docs

๐Ÿค Contributing

We welcome contributions! See CONTRIBUTING.md for guidelines.

Development Setup

git clone https://github.com/apipack/apipack
cd apipack
pip install -e ".[dev]"
pre-commit install

Running Tests

pytest tests/ --cov=apipack

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ”— Links

๐Ÿ†˜ Support

  • ๐Ÿ“š Documentation: Comprehensive guides and API reference
  • ๐Ÿ’ฌ Discord: Community support and discussions
  • ๐Ÿ› Issues: Bug reports and feature requests on GitHub
  • ๐Ÿ“ง Email: team@apipack.dev for enterprise support

๐ŸŽฏ Roadmap

  • v0.2: Rust and Java language support
  • v0.3: GraphQL and WebSocket interfaces
  • v0.4: Cloud-native deployment templates
  • v0.5: Visual interface builder
  • v1.0: Production-ready release

Made with โค๏ธ by the APIpack team

๐ŸŽฏ Cel projektu

APIpack to framework do automatycznego generowania pakietรณw API z funkcji biznesowych przy uลผyciu lokalnych modeli LLM (Mistral 7B) i systemu szablonรณw.

๐Ÿ—๏ธ Architektura wysokiego poziomu

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚   User Input    โ”‚    โ”‚   Mistral 7B    โ”‚    โ”‚   Templates     โ”‚
โ”‚  (Functions)    โ”‚โ”€โ”€โ”€โ–ถโ”‚  (Logic Gen)    โ”‚    โ”‚   (Interface)   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                โ”‚                       โ”‚
                                โ–ผ                       โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚         APIpack Core Engine        โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
                       โ”‚  โ”‚   Parser    โ”‚ โ”‚  Generator  โ”‚   โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
                       โ”‚  โ”‚ Validator   โ”‚ โ”‚  Deployer   โ”‚   โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                        โ”‚
                                        โ–ผ
                       โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                       โ”‚         Generated Package          โ”‚
                       โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
                       โ”‚  โ”‚   REST  โ”‚ โ”‚  gRPC   โ”‚ โ”‚ CLI  โ”‚  โ”‚
                       โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
                       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ“ Struktura projektu

apipack/
โ”œโ”€โ”€ apipack/                    # Main package
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ core/                   # Core engine
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ engine.py          # Main orchestrator
โ”‚   โ”‚   โ”œโ”€โ”€ parser.py          # Function spec parser
โ”‚   โ”‚   โ”œโ”€โ”€ generator.py       # Code generator
โ”‚   โ”‚   โ”œโ”€โ”€ validator.py       # Generated code validator
โ”‚   โ”‚   โ””โ”€โ”€ deployer.py        # Deployment manager
โ”‚   โ”œโ”€โ”€ llm/                   # LLM integration
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ mistral_client.py  # Mistral 7B client
โ”‚   โ”‚   โ”œโ”€โ”€ prompt_manager.py  # Prompt templates
โ”‚   โ”‚   โ””โ”€โ”€ response_parser.py # LLM response parser
โ”‚   โ”œโ”€โ”€ templates/             # Template system
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ base/              # Base templates
โ”‚   โ”‚   โ”œโ”€โ”€ interfaces/        # Interface templates
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ rest/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ grpc/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ graphql/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ websocket/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ cli/
โ”‚   โ”‚   โ”œโ”€โ”€ languages/         # Language-specific templates
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ python/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ javascript/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ golang/
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ rust/
โ”‚   โ”‚   โ””โ”€โ”€ registry.py        # Template registry
โ”‚   โ”œโ”€โ”€ plugins/               # Plugin system
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ base_plugin.py
โ”‚   โ”‚   โ””โ”€โ”€ builtin/           # Built-in plugins
โ”‚   โ”œโ”€โ”€ config/                # Configuration
โ”‚   โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”‚   โ”œโ”€โ”€ settings.py
โ”‚   โ”‚   โ””โ”€โ”€ schemas.py
โ”‚   โ””โ”€โ”€ utils/                 # Utilities
โ”‚       โ”œโ”€โ”€ __init__.py
โ”‚       โ”œโ”€โ”€ file_utils.py
โ”‚       โ”œโ”€โ”€ docker_utils.py
โ”‚       โ””โ”€โ”€ test_utils.py
โ”œโ”€โ”€ examples/                  # Example projects
โ”œโ”€โ”€ tests/                     # Test suite
โ”œโ”€โ”€ docs/                      # Documentation
โ”œโ”€โ”€ scripts/                   # Setup scripts
โ”œโ”€โ”€ pyproject.toml            # Project configuration
โ”œโ”€โ”€ requirements.txt          # Dependencies
โ”œโ”€โ”€ README.md                 # Main documentation
โ””โ”€โ”€ setup.py                  # Package setup

๐Ÿ”„ Przepล‚yw pracy

1. Input Processing

function_spec = {
    "name": "pdf_to_text",
    "description": "Extract text from PDF files",
    "input_type": "bytes",
    "output_type": "string",
    "interfaces": ["rest", "grpc", "cli"]
}

2. LLM Function Generation

  • Mistral 7B generuje implementacjฤ™ funkcji
  • Optimized prompts dla rรณลผnych jฤ™zykรณw
  • Walidacja i sanityzacja kodu

3. Template Processing

  • Wybรณr odpowiednich szablonรณw
  • Generowanie interfejsรณw API
  • Integracja z funkcjami biznesowymi

4. Package Assembly

  • Kompilacja wszystkich komponentรณw
  • Generowanie testรณw
  • Przygotowanie deployment files

๐Ÿงฉ Komponenty systemu

Core Engine

  • Parser: Analizuje specyfikacjฤ™ funkcji
  • Generator: Orkiestruje generowanie kodu
  • Validator: Sprawdza poprawnoล›ฤ‡ kodu
  • Deployer: Zarzฤ…dza wdroลผeniem

LLM Integration

  • Mistral Client: Interface do Mistral 7B
  • Prompt Manager: Zarzฤ…dza promptami
  • Response Parser: Przetwarza odpowiedzi LLM

Template System

  • Registry: Rejestr dostฤ™pnych szablonรณw
  • Base Templates: Podstawowe struktury
  • Interface Templates: Szablony interfejsรณw
  • Language Templates: Szablony jฤ™zykowe

Plugin System

  • Base Plugin: Abstrakcyjna klasa bazowa
  • Built-in Plugins: Wbudowane rozszerzenia
  • Custom Plugins: Moลผliwoล›ฤ‡ dodawania wล‚asnych

๐Ÿ”Œ Extensibility Points

1. Nowe Interfejsy

# plugins/custom_interface.py
class CustomInterfacePlugin(BasePlugin):
    def generate(self, function_spec):
        # Custom interface generation logic
        pass

2. Nowe Jฤ™zyki

# templates/languages/kotlin/config.yml
language: kotlin
extension: .kt
runtime: jvm
dependencies:
  - kotlinx-coroutines-core

3. Nowe LLM Providers

# llm/custom_provider.py
class CustomLLMProvider(BaseLLMProvider):
    def generate_function(self, spec):
        # Custom LLM integration
        pass

๐Ÿ“Š Konfiguracja

Global Settings

# config/default.yml
llm:
  provider: mistral
  model: mistral:7b
  temperature: 0.1
  max_tokens: 2048

templates:
  auto_discover: true
  cache_enabled: true
  validation_level: strict

output:
  format: package
  include_tests: true
  include_docs: true

Project Settings

# project.apipack.yml
name: my-api-service
language: python
interfaces:
  - rest
  - grpc
functions:
  - spec: functions/pdf_to_text.yml
  - spec: functions/image_resize.yml

๐ŸŽฏ Rozszerzalnoล›ฤ‡

Template Discovery

System automatycznie odkrywa nowe szablony w:

  • ~/.apipack/templates/
  • ./templates/
  • Package templates

Plugin Loading

Plugins sฤ… ล‚adowane z:

  • Built-in plugins
  • ~/.apipack/plugins/
  • Project plugins directory

Custom Generators

Moลผliwoล›ฤ‡ dodania wล‚asnych generatorรณw:

@register_generator("custom-api")
class CustomAPIGenerator(BaseGenerator):
    def generate(self, spec):
        # Custom generation logic
        pass

๐Ÿš€ API Usage

Programmatic API

from apipack import APIPackEngine

engine = APIPackEngine()
package = engine.generate_package(
    function_specs=[pdf_to_text_spec],
    interfaces=["rest", "grpc"],
    language="python"
)
package.deploy()

CLI Interface

apipack generate \
  --spec functions.yml \
  --interfaces rest,grpc \
  --language python \
  --output ./generated

Configuration-based

apipack build --config project.apipack.yml

๐Ÿ” Monitoring & Observability

Metrics Collection

  • Generation time
  • Template usage
  • LLM token consumption
  • Success/failure rates

Logging

  • Structured logging
  • Debug modes
  • Performance profiling

Health Checks

  • Template validation
  • LLM connectivity
  • Generated code syntax check

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apipack-0.1.1.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apipack-0.1.1-py3-none-any.whl (37.8 kB view details)

Uploaded Python 3

File details

Details for the file apipack-0.1.1.tar.gz.

File metadata

  • Download URL: apipack-0.1.1.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.14.9-300.fc42.x86_64

File hashes

Hashes for apipack-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d23ffe66b4489703090625ee91f9adde6ddb4c3f36bf86fd69f47bca0bb03abe
MD5 f1802aa57375dc1c79ef9d416ac6f8e6
BLAKE2b-256 9c62e24bc9b076ffa1c0223d9d884cfdf2deccf364e22d036387c88dc75b37af

See more details on using hashes here.

File details

Details for the file apipack-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: apipack-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 37.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.11.12 Linux/6.14.9-300.fc42.x86_64

File hashes

Hashes for apipack-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 97dd2ba8ce53289dfc007f5e7fc3100c17fb465e559404a1b4c320862234a19f
MD5 51413f1cab5ee351841150018de0d375
BLAKE2b-256 2b76bd47186558b95a9932fc8cd5332aaee9c607e8fcfe7c27a0c33644ecdc4f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page