L1M Python SDK
Python SDK for the l1m API, enabling you to extract structured, typed data from text and images using LLMs.
By default, the managed l1m service is used, self-hosting details are available here.
Installation
pip install l1m-dot-io
Usage
from pydantic import BaseModel
from l1m import L1M, ClientOptions, ProviderOptions
class ContactDetails(BaseModel):
email: str
phone: str
class UserProfile(BaseModel):
name: str
company: str
contactInfo: ContactDetails
client = L1M(
options=ClientOptions(
#base_url: "http://localhost:10337", Optional if self-hosting l1m server
provider=ProviderOptions(
model="gpt-4",
url="https://api.openai.com/v1/chat/completions",
key="your-openai-key"
)
)
)
# Generate a structured response
user_profile = client.structured(
input="John Smith was born on January 15, 1980. He works at Acme Inc. as a Senior Engineer and can be reached at john.smith@example.com or by phone at (555) 123-4567.",
# OR input="<BASE64_ENCODED_IMAGE>",
schema=UserProfile,
instruction="Extract details from the provided text.", # Optional
options=RequestOptions(cache_ttl=100) # Optional
)
Development
# Run tests
pytest
Release files for l1m-dot-io 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| l1m_dot_io-0.1.6.tar.gz | 5.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| l1m_dot_io-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.8 kB
Release files / l1m_dot_io-0.1.6.tar.gz
| Download URL | l1m_dot_io-0.1.6.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1233f1169e2ccab201b548ab332e249a0d57e15866ec7d2270ab8270bdca6d2b
|
|
BLAKE2b-256 checksum How to use checksums |
d1922a7dd38fd5d394f4fd011fbe85ea3a8a7c5e4b94bccfac6ded1d655a2a6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / l1m_dot_io-0.1.6-py3-none-any.whl
| Download URL | l1m_dot_io-0.1.6-py3-none-any.whl |
|---|---|
| Size | 4.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
92889ea8373cb2fe277219c8de5bfeac05e78bee5a44f9e174df0aab08c764ef
|
|
BLAKE2b-256 checksum How to use checksums |
a75cd4f95ad4d78a6165b447b02943eb919e86583b2c68a15abfbf4fe1d1c97c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|