Skip to main content

Command-line interface for the SynthLang framework using DSPy

Project description

SynthLang CLI

A powerful command-line interface for mathematical prompt engineering, framework translation, and optimization using symbolic notation.

Installation

pip install synthlang

Core Commands

Command Description Example
translate Convert natural language to SynthLang format synthlang translate --source "your prompt" --framework synthlang
evolve Improve prompts using genetic algorithms synthlang evolve --seed "initial prompt" --generations 5
optimize Optimize prompts for efficiency synthlang optimize --prompt "your prompt"
classify Analyze and categorize prompts synthlang classify predict --text "prompt" --labels "categories"

Mathematical Frameworks

Framework Description Example Pattern
Set Theory Component combination and analysis ↹ components•sets
⊕ combine => union
Σ result + validation
Category Theory Structure-preserving transformations ↹ source•target•mapping
⊕ preserve => properties
Σ transformed + verified
Topology Continuous transformations and boundaries ↹ system•changes•boundaries
⊕ maintain => continuity
Σ robust + stable
Abstract Algebra Operation composition and invariants ↹ operations•elements
⊕ compose => structure
Σ result + properties

Example Scripts

Script Purpose Location
basic_translation.sh Basic prompt translation examples scripts/basic_translation.sh
advanced_translation.sh Advanced translation with metrics scripts/advanced_translation.sh
optimization_examples.sh Prompt optimization scenarios scripts/optimization_examples.sh
evolution_examples.sh Prompt evolution with parameters scripts/evolution_examples.sh
classification_examples.sh Pattern classification examples scripts/classification_examples.sh
pipeline_example.sh Multi-step processing pipeline scripts/pipeline_example.sh
mathematical_pattern_examples.sh Mathematical framework examples scripts/mathematical_pattern_examples.sh
agentic_reasoning_pipeline.sh Agentic reasoning demonstration scripts/agentic_reasoning_pipeline.sh

Tutorials

Tutorial Description Location
Mathematical Patterns Using mathematical concepts in prompts docs/mathematical_patterns.md
Pattern Validation Testing and validating patterns docs/tutorials/pattern_validation_tutorial.md
Mathematical Patterns Practical mathematical examples docs/tutorials/mathematical_patterns_tutorial.md

Performance Metrics

Metric Traditional SynthLang Improvement
Token Usage ~150 tokens/step ~25 tokens/step 83% reduction
Processing Speed Baseline 40% faster 40% improvement
Structure Consistency Variable 90% consistent 90% improvement
Pattern Recognition 70% accuracy 95% accuracy 25% improvement

Example Use Cases

1. System Architecture Design

synthlang translate \
  --source "Design microservices architecture with state management" \
  --framework synthlang

# Output: architecture•microservices•state
⊕ design => components
⊕ manage => state
Σ system + documentation

2. Performance Optimization

synthlang optimize \
  --prompt "Optimize database queries for high throughput"

# Output: database•queries•performance
⊕ analyze => bottlenecks
⊕ optimize => throughput
Σ optimized + metrics

3. Pattern Evolution

synthlang evolve \
  --seed "Error handling pattern" \
  --generations 5 \
  --population 6

# Output shows evolution of pattern through generations

Directory Structure

cli/
├── docs/                    # Documentation
│   ├── mathematical_patterns.md
│   └── tutorials/          # Detailed tutorials
├── scripts/                # Example scripts
│   ├── basic_translation.sh
│   ├── advanced_translation.sh
│   └── ...
├── examples/               # Example outputs
└── tests/                 # Test cases

Pattern Types

Type Use Case Example
Translation Convert between formats Natural language → SynthLang
Evolution Improve existing patterns Pattern optimization
Composition Combine multiple patterns System design patterns
Validation Test pattern effectiveness Property verification

Best Practices

Pattern Design

Aspect Recommendation Example
Input Clear context definition ↹ domain•constraints•requirements
Process Step-by-step transformation ⊕ analyze => result
Output Explicit deliverables Σ solution + validation

Pattern Application

Phase Action Tool
Analysis Understand requirements translate command
Evolution Improve patterns evolve command
Validation Verify properties classify command
Optimization Enhance efficiency optimize command

Next Steps

  1. Explore the tutorials in docs/tutorials/
  2. Try the example scripts in scripts/
  3. Run the test cases in tests/
  4. Create your own patterns using the frameworks

Contributing

See CONTRIBUTING.md for guidelines on:

  • Code style
  • Testing requirements
  • Documentation standards
  • Pull request process

License

MIT License - see LICENSE file for details

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

synthlang-0.1.4.tar.gz (20.8 kB view details)

Uploaded Source

Built Distribution

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

synthlang-0.1.4-py3-none-any.whl (29.1 kB view details)

Uploaded Python 3

File details

Details for the file synthlang-0.1.4.tar.gz.

File metadata

  • Download URL: synthlang-0.1.4.tar.gz
  • Upload date:
  • Size: 20.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for synthlang-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4c97e5e1cbc52b3ce5f6b70b76628b9888e4519f0a91a021aac343f065d19af6
MD5 193d164bf78ba5cf56afaeed4369778c
BLAKE2b-256 5e354531ec8422bbf0e5888a374013f2a0c13cd4e934228a2c2a682c1c84b9f1

See more details on using hashes here.

File details

Details for the file synthlang-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: synthlang-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 29.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.1 Linux/6.5.0-1025-azure

File hashes

Hashes for synthlang-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 e9da9aa39bf79c52c5b2b89f6f7befa98b44e5e2b0321412116f8f1b2b5532f5
MD5 4bd5ec1a8c00ac7897b8dd7a1090789c
BLAKE2b-256 3110cbfe99d74db078fa7770e3ec0cabbf355344f623ef29d20d9e5de973506b

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