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.5.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.5-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: l1m_dot_io-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 10145b6b7d1dffbb59b22c63766169b856d33b755c2c188efd7a358849611f22
MD5 850d17d01fbd77cd79de012734bc7fb9
BLAKE2b-256 ba7740a55cf29849f950c4ccb9a6f1b2f83799558a045f526cc3d68f229e13ea

See more details on using hashes here.

File details

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

File metadata

  • Download URL: l1m_dot_io-0.1.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4e7553aab3ff3c4e1fd136c3d70df7f0373b8d44dbe1a44efeb11b7d1ccc4575
MD5 fee9b7505d772adceae0477851d9cbf6
BLAKE2b-256 e1a10620bc6de40112a02d9f47f985655e16c4c1f8d4afea5ba1d24e0a0a5982

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