semantix


Namesemantix JSON
Version 0.1.7 PyPI version JSON
download
home_pagehttps://github.com/chandralegend/semantix
SummaryGive Superpowers to your python function. GenAI Application development made easy.
upload_time2024-10-16 11:24:16
maintainerChandra Irugalbandara
docs_urlNone
authorChandra Irugalbandara
requires_python<4.0,>=3.8
licenseMIT
keywords no-prompt llm meaning-typed autoprompt
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  <picture>
    <source media="(prefers-color-scheme: dark)" srcset="docs/images/dark.png">
    <source media="(prefers-color-scheme: light)" srcset="docs/images/light.png">
    <img alt="Semantix: Infusing Meaning into Code with Large Language Models" width="500px" src="https://i.ibb.co/SR2hqgh/1.png">
  </picture>

  [![PyPI version](https://img.shields.io/pypi/v/semantix.svg)](https://pypi.org/project/semantix/) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/chandralegend/semantix/blob/main/try.ipynb) ![License](https://img.shields.io/badge/License-MIT-blue.svg)

Semantix provides a simple but powerful way to infuse meaning into functions, variables and classes to leverage the power of Large Language models to generate structured typed outputs `without the need of JSON Schema or any other abstractions.`

</div>

## Key Features:

- **Semantic Type**: Add meaning to your variables. No need of additional abstractions like `InputField`, `OutputField` etc.
- **AutoPrompting**: Semantix Generate prompts using the `Meaning Typed Prompting` Technique.
- **Supercharged Functions**: Automatically augment functions enhance-powered capabilities. No Function body is needed.
- **Minimal Overhead**: Seamlessly integrate into existing Python codebases with minimal overhead.

## Minimal Example

```python
from enum import Enum
from dataclasses import dataclass

from semantix import Semantic, enhance
from semantix.llms import OpenAI
from semantix.types import Image

llm = OpenAI()

class Personality(Enum):
    """Personality of the Person"""

    INTROVERT = "Introvert"
    EXTROVERT = "Extrovert"

@dataclass
class Person:
    full_name: str
    yod: Semantic[int, "Year of Death"]
    personality: Semantic[Personality, "Personality of the Person"]

@enhance("Get Person Informations use common knowledge", llm)
def get_person(name: Semantic[str, "Name of the Person"]) -> Person:
    ...

person_obj = get_person(name="Albert Einstein")
print(f"{person_obj.full_name} is an {person_obj.personality.value} who died in {person_obj.yod}")
# Albert Einstein is an Introvert who died in 1955
```

## Supports Vision

```python
from semantix.types import Image

@enhance("Get Person Informations use common knowledge", llm)
def get_person(img: Semantic[Image, "Image of the Person"]) -> Person:
    ...

person_obj = get_person(img=Image("mandela.jpg"))
print(f"{person_obj.full_name} is an {person_obj.personality.value} who died in {person_obj.yod}")
# Nelson Mandela is an Extrovert who died in 2013
```

## Installation
All you need is:

```bash
pip install semantix
```

To install the very latest from `main`:

```bash
pip install git+https://github.com/chandralegend/semantix.git
````

Or open our intro notebook in Google Colab: [<img align="center" src="https://colab.research.google.com/assets/colab-badge.svg" />](https://colab.research.google.com/github/chandralegend/semantix/blob/main/try.ipynb)

By default, Semantix doesn't install any llm packages. You can install them separately:

```bash
pip install semantix[openai]
pip install semantix[anthropic]
pip install semantix[openai, anthropic] # Install both
```

If you want to use MultiModal capabilities, you can install the following:

```bash
pip install semantix[image]
pip install semantix[video]
```

## Citation

If you find Semantix helpful, give it a ⭐️ on [GitHub](https://github/chandralegend/semantix)!
and If you have used Semantix in your project, add the badge to your README.md file.

![https://github/chandralegend/semantix](https://img.shields.io/badge/Powered%20by-Semantix-8A2BE2)

```markdown
[![https://github/chandralegend/semantix](https://img.shields.io/badge/Powered%20by-Semantix-8A2BE2)](https://github/chandralegend/semantix)
```

If you used Semantix in your research, please cite it as follows:

```bibtex
@misc{semantix,
  author = {Chandra Irugalbandara},
  title = {Semantix: Infusing Meaning into Code with Large Language Models},
  year = {2024},
  publisher = {GitHub},
  journal = {GitHub Repository},
  howpublished = {\url{https://github/chandralegend/semantix}}
}
```

## Contributing
Please read [CONTRIBUTING.md](docs/contributing.md) for a quick guide on how to contribute to Semantix.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/chandralegend/semantix",
    "name": "semantix",
    "maintainer": "Chandra Irugalbandara",
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": "irugalbandara@ascii.ai",
    "keywords": "no-prompt, llm, meaning-typed, autoprompt",
    "author": "Chandra Irugalbandara",
    "author_email": "irugalbandara@ascii.ai",
    "download_url": "https://files.pythonhosted.org/packages/f8/a7/06cea91c571627417c8a70e090fe249554e5d873f13133177fca5d395d41/semantix-0.1.7.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  <picture>\n    <source media=\"(prefers-color-scheme: dark)\" srcset=\"docs/images/dark.png\">\n    <source media=\"(prefers-color-scheme: light)\" srcset=\"docs/images/light.png\">\n    <img alt=\"Semantix: Infusing Meaning into Code with Large Language Models\" width=\"500px\" src=\"https://i.ibb.co/SR2hqgh/1.png\">\n  </picture>\n\n  [![PyPI version](https://img.shields.io/pypi/v/semantix.svg)](https://pypi.org/project/semantix/) [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/chandralegend/semantix/blob/main/try.ipynb) ![License](https://img.shields.io/badge/License-MIT-blue.svg)\n\nSemantix provides a simple but powerful way to infuse meaning into functions, variables and classes to leverage the power of Large Language models to generate structured typed outputs `without the need of JSON Schema or any other abstractions.`\n\n</div>\n\n## Key Features:\n\n- **Semantic Type**: Add meaning to your variables. No need of additional abstractions like `InputField`, `OutputField` etc.\n- **AutoPrompting**: Semantix Generate prompts using the `Meaning Typed Prompting` Technique.\n- **Supercharged Functions**: Automatically augment functions enhance-powered capabilities. No Function body is needed.\n- **Minimal Overhead**: Seamlessly integrate into existing Python codebases with minimal overhead.\n\n## Minimal Example\n\n```python\nfrom enum import Enum\nfrom dataclasses import dataclass\n\nfrom semantix import Semantic, enhance\nfrom semantix.llms import OpenAI\nfrom semantix.types import Image\n\nllm = OpenAI()\n\nclass Personality(Enum):\n    \"\"\"Personality of the Person\"\"\"\n\n    INTROVERT = \"Introvert\"\n    EXTROVERT = \"Extrovert\"\n\n@dataclass\nclass Person:\n    full_name: str\n    yod: Semantic[int, \"Year of Death\"]\n    personality: Semantic[Personality, \"Personality of the Person\"]\n\n@enhance(\"Get Person Informations use common knowledge\", llm)\ndef get_person(name: Semantic[str, \"Name of the Person\"]) -> Person:\n    ...\n\nperson_obj = get_person(name=\"Albert Einstein\")\nprint(f\"{person_obj.full_name} is an {person_obj.personality.value} who died in {person_obj.yod}\")\n# Albert Einstein is an Introvert who died in 1955\n```\n\n## Supports Vision\n\n```python\nfrom semantix.types import Image\n\n@enhance(\"Get Person Informations use common knowledge\", llm)\ndef get_person(img: Semantic[Image, \"Image of the Person\"]) -> Person:\n    ...\n\nperson_obj = get_person(img=Image(\"mandela.jpg\"))\nprint(f\"{person_obj.full_name} is an {person_obj.personality.value} who died in {person_obj.yod}\")\n# Nelson Mandela is an Extrovert who died in 2013\n```\n\n## Installation\nAll you need is:\n\n```bash\npip install semantix\n```\n\nTo install the very latest from `main`:\n\n```bash\npip install git+https://github.com/chandralegend/semantix.git\n````\n\nOr open our intro notebook in Google Colab: [<img align=\"center\" src=\"https://colab.research.google.com/assets/colab-badge.svg\" />](https://colab.research.google.com/github/chandralegend/semantix/blob/main/try.ipynb)\n\nBy default, Semantix doesn't install any llm packages. You can install them separately:\n\n```bash\npip install semantix[openai]\npip install semantix[anthropic]\npip install semantix[openai, anthropic] # Install both\n```\n\nIf you want to use MultiModal capabilities, you can install the following:\n\n```bash\npip install semantix[image]\npip install semantix[video]\n```\n\n## Citation\n\nIf you find Semantix helpful, give it a \u2b50\ufe0f on [GitHub](https://github/chandralegend/semantix)!\nand If you have used Semantix in your project, add the badge to your README.md file.\n\n![https://github/chandralegend/semantix](https://img.shields.io/badge/Powered%20by-Semantix-8A2BE2)\n\n```markdown\n[![https://github/chandralegend/semantix](https://img.shields.io/badge/Powered%20by-Semantix-8A2BE2)](https://github/chandralegend/semantix)\n```\n\nIf you used Semantix in your research, please cite it as follows:\n\n```bibtex\n@misc{semantix,\n  author = {Chandra Irugalbandara},\n  title = {Semantix: Infusing Meaning into Code with Large Language Models},\n  year = {2024},\n  publisher = {GitHub},\n  journal = {GitHub Repository},\n  howpublished = {\\url{https://github/chandralegend/semantix}}\n}\n```\n\n## Contributing\nPlease read [CONTRIBUTING.md](docs/contributing.md) for a quick guide on how to contribute to Semantix.\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Give Superpowers to your python function. GenAI Application development made easy.",
    "version": "0.1.7",
    "project_urls": {
        "Documentation": "https://chandralegend.github.io/semantix/",
        "Homepage": "https://github.com/chandralegend/semantix",
        "Repository": "https://github.com/chandralegend/semantix"
    },
    "split_keywords": [
        "no-prompt",
        " llm",
        " meaning-typed",
        " autoprompt"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "49b453777d5ab744c0a87fadb1cff77334b3e177d29aa43f942d9eb053321a26",
                "md5": "0a749f982ccc52a2ad1d9fbf657bd0a4",
                "sha256": "3d33e5e91d68e7d21f3a0b99be236c06c1db86a358bf36f743f11c554ff93b73"
            },
            "downloads": -1,
            "filename": "semantix-0.1.7-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0a749f982ccc52a2ad1d9fbf657bd0a4",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 28970,
            "upload_time": "2024-10-16T11:24:14",
            "upload_time_iso_8601": "2024-10-16T11:24:14.551825Z",
            "url": "https://files.pythonhosted.org/packages/49/b4/53777d5ab744c0a87fadb1cff77334b3e177d29aa43f942d9eb053321a26/semantix-0.1.7-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f8a706cea91c571627417c8a70e090fe249554e5d873f13133177fca5d395d41",
                "md5": "f98e0c91eda50fabc56c161d1317d8ba",
                "sha256": "493cf299518578d36a57c95a3f80dbab3b127f34b43ee0fe1dd9e3c7dde403cc"
            },
            "downloads": -1,
            "filename": "semantix-0.1.7.tar.gz",
            "has_sig": false,
            "md5_digest": "f98e0c91eda50fabc56c161d1317d8ba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 21284,
            "upload_time": "2024-10-16T11:24:16",
            "upload_time_iso_8601": "2024-10-16T11:24:16.279471Z",
            "url": "https://files.pythonhosted.org/packages/f8/a7/06cea91c571627417c8a70e090fe249554e5d873f13133177fca5d395d41/semantix-0.1.7.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-16 11:24:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "chandralegend",
    "github_project": "semantix",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "semantix"
}
        
Elapsed time: 0.35507s