Skip to main content

jsonllm


image

Installation


From PyPI

pip install python-jsonllm

From source

git clone https://github.com/ivanbelenky/jsonllm.git
cd jsonllm
python3 -m pip install -e .

Documentation


Schema type

class SchemaKey(TypedDict):
    name: Optional[str]
    type: Optional[type]
    default: JSONCompatible
    required: Optional[bool]
    instructions: Optional[str]
    valid: Optional[Caster] 
    caster: Optional[Validator]

class Schema(TypedDict):
    __key__: Union[SchemaKey, 'Schema'] # nested schemas

Example

import os

import jsonllm

#assert os.environ.get('ANTHROPIC_API_KEY') != None
#assert os.environ.get('OPENAI_API_KEY') != None

person = {
    'first_name': {
        'type': str,
        'required': True,
        'instructions': 'Find the first name, if not found input John'        
    },
    'last_name': {
        'type': str,
        'required': True,
        'instructions': 'Find the last name, if not found input Doe'
    },
    'date_of_birth': {
        'name': 'dob',
        'type': str,
        'instructions': 'Find the date of birth and cast it to isoformat'
    }
}

message = 'My name is John Connor, I think I was born 0 of Unix time.'
response = jsonllm.loads(message, person, model='claude-3-opus-20240229')
print(response.response)

{
    'first_name': 'John',
    'last_name': 'Connor',
    'dob': '1970-01-01'
}

Metadata

Release files for python-jsonllm 0.0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-jsonllm 0.0.3.1
File Size Uploaded Provenance Actions
python-jsonllm-0.0.3.1.tar.gz 7.6 kB Without provenance Details for python-jsonllm-0.0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for python-jsonllm 0.0.3.1
File Interpreter ABI Platform Actions
python_jsonllm-0.0.3.1-py3-none-any.whl Python 3 none any Details for python_jsonllm-0.0.3.1-py3-none-any.whl

Total release size: 16.2 kB

Release files / python-jsonllm-0.0.3.1.tar.gz

Download URL python-jsonllm-0.0.3.1.tar.gz
Size 7.6 kB
Tags Source
SHA-256 checksum
How to use checksums
8fa2c43eb034cd3e217c32432dfdcbfb1f6c88a456645e19039ac976578cf25f
BLAKE2b-256 checksum
How to use checksums
7e3370c58521afe4715cc8ea446e70f2a39f15b29e493170e14ccb8704a08398
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.13

Release files / python_jsonllm-0.0.3.1-py3-none-any.whl

Download URL python_jsonllm-0.0.3.1-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
93eea7e1ba18905d3e889dd1f85cd23a6ce146ab1ca6a387e2dc98ba31bde098
BLAKE2b-256 checksum
How to use checksums
3417a388fecc8c77aabfc3c67b78a18677d712218d650c3631cd65602b265d7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.8.13

Security for python-jsonllm 0.0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page