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 for more details.
Installation
pip install convertanything
Usage Examples
ezLocalai
To use with ezLocalai in Python, make sure your ezLocalai server is running then run the following code:
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 in Python, make sure your AGiXT server is running then run the following code:
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:
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)
Metadata
Release files for convertanything 0.0.16
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| convertanything-0.0.16.tar.gz | 5.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| convertanything-0.0.16-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.1 kB
Release files / convertanything-0.0.16.tar.gz
| Download URL | convertanything-0.0.16.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aa6c756c48df6ae0709fd597de4bcedf306e288572223a7d6cb7c1660eeb40c0
|
|
BLAKE2b-256 checksum How to use checksums |
39e6ef5adcbd6591c5dd3514893152a07789d364905d3fae487cbc6c588cfed7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|
Release files / convertanything-0.0.16-py3-none-any.whl
| Download URL | convertanything-0.0.16-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b82bcedabc201840a196375c8e7a4ec4e2e0aa65b095ef9d51e9d8b5b31a23ec
|
|
BLAKE2b-256 checksum How to use checksums |
f3c54ad38e2d39c0b022b45797cf096cfe1b38cb8457da550c1852d39db78677
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.12.3
|