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.",
  schema=UserProfile,
  instruction="Extract details from the provided text.", # 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.4.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.4-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: l1m_dot_io-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 3d0e277b6676ece7215b021a6f7f3211afcdab6b7992f4df342912373d4391c4
MD5 b4c858f0ee6e432f88b90d8fc0e152f2
BLAKE2b-256 b6d286c3540ca20c3100cc7585c3919c976d0abff8205e0a17ee0d655b946b5b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: l1m_dot_io-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 4.4 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 199e829629b1f385f5d380832c03a223a3c3dbbf5efaaebeb496af463d80884a
MD5 2c64e4687d681a240b0480e28612f190
BLAKE2b-256 65fe3202452b79638ec4683bf04a4da40aa63d66fe5282dccd0972712de1936b

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