Skip to main content

litestruct

This file will become your README and also the index of your documentation.

Developer Guide

If you are new to using nbdev here are some useful pointers to get you started.

Install litestruct in Development mode

# make sure litestruct package is installed in development mode
$ pip install -e .

# make changes under nbs/ directory
# ...

# compile to have changes apply to litestruct
$ nbdev_prepare

Usage

Installation

Install latest from the GitHub repository:

$ pip install git+https://github.com/gautam-e/litestruct.git

or from pypi

$ pip install litestruct

Documentation

Documentation can be found hosted on this GitHub repository’s pages. Additionally you can find package manager specific guidelines on conda and pypi respectively.

How to use

from litestruct import *
from pydantic import BaseModel
model="azure/gpt-4o-2024-08-06" # e.g. openai/gpt-4o-2024-08-06 would use the standard OpenAI
system_prompt = "Extract the event information."

class CalendarEvent(BaseModel):
    name: str
    date: str
    participants: list[str]
user_prompt = "Alice and Bob are going to Carmen's birthday party on 22nd March 2025"
r = structured_output(model=model,
                      system_prompt=system_prompt,
                      response_format=CalendarEvent, #Note this is the class name (without the `()`)
                      user_prompt=user_prompt,
                 )

r.model_dump()
{'name': "Carmen's Birthday Party",
 'date': '2025-03-22',
 'participants': ['Alice', 'Bob']}

Metadata

Release files for litestruct 0.0.3

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

Source distribution (sdist)

Source distribution for litestruct 0.0.3
File Size Uploaded Provenance
litestruct-0.0.3.tar.gz 8.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for litestruct 0.0.3
File Interpreter ABI Platform
litestruct-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / litestruct-0.0.3.tar.gz

Download URL litestruct-0.0.3.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
382e8411aa4ce87397c6eff79d4a33505b07026acc35db0b20cafe570366d6d9
BLAKE2b-256 checksum
How to use checksums
0e15d23e2424a23d8ddd7f307eda4994e853d4e87abd52b2f5228a2ae93afc7f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Release files / litestruct-0.0.3-py3-none-any.whl

Download URL litestruct-0.0.3-py3-none-any.whl
Size 8.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b5c3f42d88d311ce8beb74a21f7dc4b49ce74f0a96057bd3507817130199d2e
BLAKE2b-256 checksum
How to use checksums
c2368e73b1dd885b75c695c62a56bdc976c7a3ba412b5032e0575b5070c1b98e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.12

Security for litestruct 0.0.3

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.

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files No provenance

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