Skip to main content

A package for generating, validating, and utilizing Draft-7 JSON schemas with LangChain

Project description

Lang2Logic Python Package

Introduction

Lang2Logic: Transforming Natural Language into Python Code with Ease.

Overview

Lang2Logic is an innovative Python package designed for developers who need to translate natural language prompts into structured Python outputs. Utilizing advanced language processing algorithms, Lang2Logic simplifies generating Python code from verbal or written descriptions.

Key Features

  • Natural Language to Python Conversion: Converts natural language instructions into Python code, facilitating easier programming and automation.
  • Dynamic Schema Generation: Automatically generates schema from natural language inputs, providing structured outputs like lists, dictionaries, etc.
  • Flexible API Integration: User-friendly API for seamless integration with existing Python projects.

Installation and Usage

import os
from Lang2Logic.generator import Generator

# Initialize with API key
self.test_gen = Generator(os.environ.get("YOUR_API_KEY"))

# Generate schema from natural language
schema = self.test_gen.generate_schema("return a list of strings")

# Use schema for generating structured outputs
self.test_gen.generate("5 colors", schema)
# Output: ["red", "yellow", "green", "blue", "red"]

Automatic Schema Generation

self.test_gen.generate("return a list of strings with 5 colors")
# Output: ["color1", "color2", "color3", "color4", "color5"]

Example Usage

Classifying Decisions and Preferences

schema = self.test_gen.generate_schema("return a dictionary with keys 'rational' and 'decision' (boolean)")

potential_buyers = []
for user in users_data_json["bios"]:
    decision = self.test_gen.generate(f"return true if this user might be interested in products related to rock climbing.\nUser Bio:\n{user['bio']}", schema)
    if decision["decision"]:
        potential_buyers.append(user)

Roadmap

  • Function Generation
  • Optimized Logic for Increased Accuracy
  • Code Parsing and LLM integration tools
  • Python Agents

Bug Reporting and Contributions

Found a bug or have a suggestion? Please contact dylanpwilson2005@gmail.com.

License

Lang2Logic is available under a Creative Commons license and may not be used for commercial purposes without explicit consent from the author.

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

Lang2Logic-0.1.0.tar.gz (14.0 kB view details)

Uploaded Source

Built Distribution

Lang2Logic-0.1.0-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file Lang2Logic-0.1.0.tar.gz.

File metadata

  • Download URL: Lang2Logic-0.1.0.tar.gz
  • Upload date:
  • Size: 14.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for Lang2Logic-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0253a905cbb42e1de2cefe53055e7259e905e382dbae83587ea039302b996aa5
MD5 6bdc0d7e8839aedd52b4f3424f4f7441
BLAKE2b-256 70ba80e4553f695b8ef3274bc7c9738ac347f9f6546df1a7eb1df07642823e4f

See more details on using hashes here.

File details

Details for the file Lang2Logic-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: Lang2Logic-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for Lang2Logic-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 029c76c7451f09bb62a784782ec9c8129ae6c73e4f17ec221be049bbfccc5042
MD5 35fdb8533a1f781cda8913e545020b8b
BLAKE2b-256 d6696ed1c0778dcdaa7eef15c846a7da86b3eba06d9efdb9215349af9e53484e

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