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

Uploaded Python 3

File details

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

File metadata

  • Download URL: l1m_dot_io-0.1.3.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.3.tar.gz
Algorithm Hash digest
SHA256 9a167af15b1767af01a7124b6d94af076ae9d7c86f5993de6d8395160bd0ac69
MD5 6b9c36f65770aba615282029b9545339
BLAKE2b-256 b1a3a730c2a7d9c3ce33dc8a9e722886d9c9b86a276e91b635ff682850643a22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: l1m_dot_io-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 55ae444c1f81f464a80645ba0547f97c183f771b6797f7824a801b87e6d8b858
MD5 98077a11518eeb0567c9d20ab1d43af2
BLAKE2b-256 d570e59e79b1b8ab51493a41e33734d7a01fac5e5f7bbe6457a2595ad354833b

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