Skip to main content

LLM-driven agent for creating detailed column-to-attribute mappings

Project description

Mapping Agent

LLM-driven intelligent attribute-to-column mapping agent for domain schema validation and refinement.


🌟 Features

  • Intelligent Entity Mapping – Uses LLM reasoning to map entities from a domain schema to columns across multiple tables.
  • Confidence Scoring – Provides confidence scores for each mapping.
  • Transformation Suggestions – Suggests data transformations for better alignment.
  • Context-Aware Analysis – Generates column profiles (types, nulls, uniqueness, distributions) to improve mapping accuracy.

🚀 Quick Start

Installation

Prerequisites

  • uv – package & environment manager
    Please refer to the official installation guide for the most up-to-date instructions.
    For quick setup on macOS/Linux, you can currently use:
    curl -LsSf https://astral.sh/uv/install.sh | sh
    
  • Git

Steps

  1. Clone the repository

    git clone https://github.com/stepfnAI/mapping_agent.git
    cd mapping_agent
    git switch main
    
  2. Install dependencies

    uv sync --extra dev
    source .venv/bin/activate
    
  3. Set environment variables
    The agent requires an API key (e.g., OpenAI).

    export LLM_PROVIDER="your-llm-provider"   #"openai/anthropic"
    export LLM_MODEL="your-llm-model"         #"gpt-4.1-mini"
    export LLM_API_KEY="your-api-key-here"    
    

Basic Usage

Example: Mapping the Borrower Profile entity to columns across two CSV files.

python examples/basic_usage.py

🧪 Testing

Run the test suite with pytest:

# Run all tests
pytest tests/ -s

# Run with coverage
pytest tests/test_models.py
pytest tests/test_utils.py
pytest tests/test_agent_integration.py

📝 Prompt Management

Prompts are centralized in
src/mapping_agent/constants.py.

  • format_mapping_prompt_with_system_prompt constructs structured prompts with a system message.
  • Ensures the LLM consistently acts as a data mapping expert.
  • Easy to extend or fine-tune reasoning strategies in one place.

🤝 Contributing

Contributions are welcome!
Please see the Contributing Guide before submitting a PR.


📄 License

Licensed under the MIT License. See LICENSE 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

mapping_agent-0.1.2.tar.gz (12.2 kB view details)

Uploaded Source

Built Distribution

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

mapping_agent-0.1.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file mapping_agent-0.1.2.tar.gz.

File metadata

  • Download URL: mapping_agent-0.1.2.tar.gz
  • Upload date:
  • Size: 12.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.22

File hashes

Hashes for mapping_agent-0.1.2.tar.gz
Algorithm Hash digest
SHA256 c58c20c82a2ca88df4a537da295bc071097ef9130871214266281bbb108c018d
MD5 a4735d538d6c687cd1f667d4ebdf8c2a
BLAKE2b-256 8ef3b4bd03d6583a35f340bbb7df4b6957c2ebd23b56e057d75872618e4a03e4

See more details on using hashes here.

File details

Details for the file mapping_agent-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for mapping_agent-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 01909ee1e2ded6016706401010d9f821f39c3445a3acc83ad2cb458ba858e8c1
MD5 f6c52d7ea766b84e363c4bbb31cc7ebd
BLAKE2b-256 ba6e364188699469109709eff040aa5b87f66a666b28d732a3629ec4f8079dad

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