Skip to main content

Neuronic - AI-powered data transformation library

Project description

Neuronic 🧪

Neuronic Logo

Neuronic is a Python library that leverages AI to transform, analyze, and generate data in various formats. Think of it as your Swiss Army knife for data manipulation, powered by OpenAI's GPT models.

🚀 Features

  • Data Transformation: Convert between formats (CSV ↔ JSON ↔ XML)
  • Smart Analysis: Get insights and answers about your data
  • Data Generation: Create realistic test data on demand
  • Multiple Output Types: Support for strings, numbers, JSON, lists, booleans, and Python structures
  • Context-Aware: Use additional context for more accurate transformations
  • Flexible Input: Accept virtually any data type as input

📦 Installation

Install using pip:

pip install neuronic

🔑 Configuration

Create a .env file in your project root:

OPENAI_API_KEY=your-openai-api-key-here

Or pass your API key directly:

neuronic = Neuronic(api_key="your-api-key-here")

💡 Usage Examples

1. Data Transformation

Convert CSV data to JSON format:

from neuronic import Neuronic

neuronic = Neuronic()

customer_data = "John Doe, john@example.com, New York"
contact_card = neuronic.transform(
    data=customer_data,
    instruction="Convert this CSV data into a contact card format",
    output_type="json",
    example='{"name": "Jane Doe", "email": "jane@example.com", "location": "Los Angeles"}'
)

2. Data Analysis

Analyze sales data and get insights:

sales_data = [
    {"month": "Jan", "revenue": 1000},
    {"month": "Feb", "revenue": 1200},
    {"month": "Mar", "revenue": 900}
]
analysis = neuronic.analyze(
    data=sales_data,
    question="What's the trend in revenue and which month performed best?"
)

3. Data Generation

Generate test data with specific requirements:

test_data = neuronic.generate(
    spec="Create realistic user profiles with name, age, occupation, and favorite color",
    n=3
)

4. Context-Aware Transformation

Generate documentation with specific context:

code_snippet = "print('hello world')"
documentation = neuronic.transform(
    data=code_snippet,
    instruction="Generate detailed documentation for this code",
    output_type="json",
    context={
        "language": "Python",
        "audience": "beginners",
        "include_examples": True
    }
)

5. Boolean Decision Making

Make simple yes/no decisions:

sentiment = neuronic.transform(
    data="This product exceeded my expectations! Highly recommended!",
    instruction="Is this review positive?",
    output_type="bool"
)

6. Python Data Structures

Generate complex Python data structures:

data_structure = neuronic.transform(
    data="Create a nested data structure representing a family tree",
    instruction="Generate a Python dictionary with at least 3 generations",
    output_type="python"
)

🎯 Use Cases

Data Processing

  • Format conversion (CSV ↔ JSON ↔ XML)
  • Data cleaning and normalization
  • Schema transformation

Content Generation

  • Test data creation
  • Sample content generation
  • Documentation automation

Analysis

  • Data summarization
  • Trend analysis
  • Pattern recognition
  • Sentiment analysis

Development Support

  • Code documentation
  • API response transformation
  • Test data generation
  • Data validation

🔧 API Reference

Neuronic Class

Initialize the Neuronic class:

neuronic = Neuronic(api_key: str = None, model: str = "gpt-3.5-turbo")

Methods

transform()

Transform data according to instructions:

result = neuronic.transform(
    data: Any,                    # Input data
    instruction: str,             # What to do with the data
    output_type: str = "string",  # Desired output format
    example: str = None,          # Optional example
    context: dict = None          # Optional context
)

analyze()

Analyze data and get insights:

result = neuronic.analyze(
    data: Any,        # Data to analyze
    question: str     # Question about the data
)

generate()

Generate new data based on specifications:

result = neuronic.generate(
    spec: str,    # What to generate
    n: int = 1    # Number of items
)

🔒 Best Practices

  1. API Key Security

    • Use environment variables for API keys
    • Never commit .env files to version control
  2. Performance

    • Cache frequently used transformations
    • Batch similar operations when possible
  3. Error Handling

    • Always handle potential exceptions
    • Validate output types match expected formats

📝 License

MIT License - feel free to use in your own projects!

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

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

neuronic-0.1.1.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

neuronic-0.1.1-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: neuronic-0.1.1.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.0

File hashes

Hashes for neuronic-0.1.1.tar.gz
Algorithm Hash digest
SHA256 56c56b1dc5c7b44673c42c6fb2f9723334d765d7ff1ec95748d2d2b343b587df
MD5 ea0c61dac7052b239f65d6fa348e7952
BLAKE2b-256 5e1ede076b373af35ca86c0e4f45d5e3128d06fde3af6ae2e1302415343082aa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: neuronic-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.0

File hashes

Hashes for neuronic-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 00590a28ee0ec02da1e06e50c59691d99c036a4895387afa74c2cc16fae22762
MD5 9c29b9e4817cf1d39e91c7b3fb2e32db
BLAKE2b-256 fb09270e1e88b532e25b2b89dd36b71db15b1d9deac7d5c4398613501512ef2e

See more details on using hashes here.

Supported by

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