Skip to main content

Python SDK for L1M

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

l1m_dot_io-0.1.6.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

l1m_dot_io-0.1.6-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file l1m_dot_io-0.1.6.tar.gz.

File metadata

  • Download URL: l1m_dot_io-0.1.6.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for l1m_dot_io-0.1.6.tar.gz
Algorithm Hash digest
SHA256 1233f1169e2ccab201b548ab332e249a0d57e15866ec7d2270ab8270bdca6d2b
MD5 b2a20a55c705debadda24f0faa0d54c5
BLAKE2b-256 d1922a7dd38fd5d394f4fd011fbe85ea3a8a7c5e4b94bccfac6ded1d655a2a6e

See more details on using hashes here.

File details

Details for the file l1m_dot_io-0.1.6-py3-none-any.whl.

File metadata

  • Download URL: l1m_dot_io-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.2

File hashes

Hashes for l1m_dot_io-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 92889ea8373cb2fe277219c8de5bfeac05e78bee5a44f9e174df0aab08c764ef
MD5 08eee4db6d3481f4cd5d3483263623e3
BLAKE2b-256 a75cd4f95ad4d78a6165b447b02943eb919e86583b2c68a15abfbf4fe1d1c97c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page