convertanything


Nameconvertanything JSON
Version 0.0.15 PyPI version JSON
download
home_pageNone
Summaryconvertanything is a Python package that allows you to convert any text into a structured format according to the schema provided.
upload_time2024-05-07 19:16:26
maintainerNone
docs_urlNone
authorJosh XT
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # convertanything

`convertanything` is a simple way to convert any unstructured texts into pydantic models in Python with the use of language models. See the [examples notebook](https://github.com/DevXT-LLC/convertanything/blob/main/example.ipynb) for more details.

## Installation

```bash
pip install convertanything
```

## Usage Examples

### ezLocalai

To use with [ezLocalai](https://github.com/DevXT-LLC/ezlocalai) in Python, make sure your ezLocalai server is running then run the following code:

```python
from convertanything import convertanything
from pydantic import BaseModel
from typing import List


class Person(BaseModel):
    name: str
    age: int
    email: str
    interests: List[str]


response = convertanything(
    input_string="Hi my name is John Doe, I am 30 years old, my email is johndoe@example.com . I like to go fishing and watching football.",
    model=Person,
    api_key="Your ezlocalai API Key",
    server="http://localhost:8091",
)
print(response)
```

### AGiXT

To use with [AGiXT](https://github.com/Josh-XT/AGiXT) in Python, make sure your AGiXT server is running then run the following code:

```python
from convertanything import convertanything
from pydantic import BaseModel
from typing import List


class Person(BaseModel):
    name: str
    age: int
    email: str
    interests: List[str]


response = convertanything(
    input_string="Hi my name is John Doe, I am 30 years old, my email is johndoe@example.com . I like to go fishing and watching football.",
    model=Person,
    api_key="Your AGiXT API Key",
    server="http://localhost:7437",
    llm="Your AGiXT Agent Name",
    prompt_name="User Input",
)
print(response)
```

### OpenAI

If you have an OpenAI API key, you can use it as follows with OpenAI language models:

```python
from convertanything import convertanything
from pydantic import BaseModel
from typing import List

class Person(BaseModel):
    name: str
    age: int
    email: str
    interests: List[str]

response = convertanything(
    input_string="Hi my name is John Doe, I am 30 years old, my email is johndoe@example.com . I like to go fishing.",
    model=Person,
    api_key="Your OpenAI API Key",
    llm="gpt-3.5-turbo",
)
print(response)
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "convertanything",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "Josh XT",
    "author_email": "josh@devxt.com",
    "download_url": "https://files.pythonhosted.org/packages/59/84/06e92353c75c22f4cd24c712bb8cb70a7ac563f2d53bf40046069e3add5d/convertanything-0.0.15.tar.gz",
    "platform": null,
    "description": "# convertanything\n\n`convertanything` is a simple way to convert any unstructured texts into pydantic models in Python with the use of language models. See the [examples notebook](https://github.com/DevXT-LLC/convertanything/blob/main/example.ipynb) for more details.\n\n## Installation\n\n```bash\npip install convertanything\n```\n\n## Usage Examples\n\n### ezLocalai\n\nTo use with [ezLocalai](https://github.com/DevXT-LLC/ezlocalai) in Python, make sure your ezLocalai server is running then run the following code:\n\n```python\nfrom convertanything import convertanything\nfrom pydantic import BaseModel\nfrom typing import List\n\n\nclass Person(BaseModel):\n    name: str\n    age: int\n    email: str\n    interests: List[str]\n\n\nresponse = convertanything(\n    input_string=\"Hi my name is John Doe, I am 30 years old, my email is johndoe@example.com . I like to go fishing and watching football.\",\n    model=Person,\n    api_key=\"Your ezlocalai API Key\",\n    server=\"http://localhost:8091\",\n)\nprint(response)\n```\n\n### AGiXT\n\nTo use with [AGiXT](https://github.com/Josh-XT/AGiXT) in Python, make sure your AGiXT server is running then run the following code:\n\n```python\nfrom convertanything import convertanything\nfrom pydantic import BaseModel\nfrom typing import List\n\n\nclass Person(BaseModel):\n    name: str\n    age: int\n    email: str\n    interests: List[str]\n\n\nresponse = convertanything(\n    input_string=\"Hi my name is John Doe, I am 30 years old, my email is johndoe@example.com . I like to go fishing and watching football.\",\n    model=Person,\n    api_key=\"Your AGiXT API Key\",\n    server=\"http://localhost:7437\",\n    llm=\"Your AGiXT Agent Name\",\n    prompt_name=\"User Input\",\n)\nprint(response)\n```\n\n### OpenAI\n\nIf you have an OpenAI API key, you can use it as follows with OpenAI language models:\n\n```python\nfrom convertanything import convertanything\nfrom pydantic import BaseModel\nfrom typing import List\n\nclass Person(BaseModel):\n    name: str\n    age: int\n    email: str\n    interests: List[str]\n\nresponse = convertanything(\n    input_string=\"Hi my name is John Doe, I am 30 years old, my email is johndoe@example.com . I like to go fishing.\",\n    model=Person,\n    api_key=\"Your OpenAI API Key\",\n    llm=\"gpt-3.5-turbo\",\n)\nprint(response)\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "convertanything is a Python package that allows you to convert any text into a structured format according to the schema provided.",
    "version": "0.0.15",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c0523acc8f424fddc386a880f8a1b134f16e431bff0097ad2b784a8a073256de",
                "md5": "39e75e137cb9a836df6a960075ce39aa",
                "sha256": "e9aa053427cc58439b28313de2bdb4fff13eaac10cce86c9824e0fc3cb3ab665"
            },
            "downloads": -1,
            "filename": "convertanything-0.0.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "39e75e137cb9a836df6a960075ce39aa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 4539,
            "upload_time": "2024-05-07T19:16:24",
            "upload_time_iso_8601": "2024-05-07T19:16:24.459893Z",
            "url": "https://files.pythonhosted.org/packages/c0/52/3acc8f424fddc386a880f8a1b134f16e431bff0097ad2b784a8a073256de/convertanything-0.0.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "598406e92353c75c22f4cd24c712bb8cb70a7ac563f2d53bf40046069e3add5d",
                "md5": "7b8adc28dce8dbb5355709af398dea21",
                "sha256": "877761009c0ff54ec710f85cb2043902b1b17c086aa876b4501850dd010ea3ed"
            },
            "downloads": -1,
            "filename": "convertanything-0.0.15.tar.gz",
            "has_sig": false,
            "md5_digest": "7b8adc28dce8dbb5355709af398dea21",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 5614,
            "upload_time": "2024-05-07T19:16:26",
            "upload_time_iso_8601": "2024-05-07T19:16:26.314886Z",
            "url": "https://files.pythonhosted.org/packages/59/84/06e92353c75c22f4cd24c712bb8cb70a7ac563f2d53bf40046069e3add5d/convertanything-0.0.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-07 19:16:26",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "convertanything"
}
        
Elapsed time: 0.24888s