Skip to main content

Language Models

PyPI version docs Build Netlify Status

A Python package providing simple building blocks for exploring natural language processing.

Translation hello world example

Installation

This package can be installed using the following command:

pip install languagemodels

Example Usage

Here are some usage examples as Python REPL sessions. This should work in the REPL, notebooks, or in traditional scripts and applications.

Text Completions

>>> import languagemodels as lm

>>> lm.complete("She hid in her room until")
'she was sure she was safe'

Instruction Following

>>> import languagemodels as lm

>>> lm.do("Translate to English: Hola, mundo!")
'Hello, world!'

>>> lm.do("What is the capital of France?")
'paris'

Classification

>>> import languagemodels as lm

>>> lm.classify("Language models are useful", "positive", "negative")
'positive'

Semantic Search

>>> import languagemodels as lm

>>> lm.store_doc("Mars is a planet")
>>> lm.store_doc("The sun is hot")
>>> lm.load_doc("What is Mars?")
'Mars is a planet'

Extractive Question Answering

>>> import languagemodels as lm

>>> lm.extract_answer("What color is the ball?", "There is a green ball and a red box")
'green'

External Retrieval

>>> import languagemodels as lm

>>> lm.fetch_wiki('Chemistry')
'Chemistry is the scientific study...

>>> lm.fetch_weather(41.8, -87.6)
'Partly cloudy with a chance of rain...

Misc Text Tools

>>> import languagemodels as lm

>>> get_date()
'Friday, May 12, 2023 at 09:27AM'

Full documentation

Projects

This package can be used to do the heavy lifting for a number of learning projects:

  • Basic chatbot
  • Chatbot with information retrieval
  • Chatbot with access to real-time information
  • Text classification
  • Extractive question answering
  • Semantic search
  • Document question answering

Release files for languagemodels 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for languagemodels 0.0.4
File Size Uploaded
languagemodels-0.0.4.tar.gz 6.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for languagemodels 0.0.4
File Interpreter ABI Platform
languagemodels-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size:14.5 kB

Release files / languagemodels-0.0.4.tar.gz

Download URL languagemodels-0.0.4.tar.gz
Size 6.8 kB
Tags Source
SHA-256 checksum
How to use checksums
6af2358c477205fc591710002d9f6aec899dd02497681daf1006cf4cda2192be
BLAKE2b-256 checksum
How to use checksums
3c10e1a849c0e9a1970bd86d9bf3fd0ece7d8b1038930168a77625acb01b05eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10

Release files / languagemodels-0.0.4-py3-none-any.whl

Download URL languagemodels-0.0.4-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f55d59bffe368e556ab492af6e3816001aa11f2f9169e66b71c1b029fb19e217
BLAKE2b-256 checksum
How to use checksums
540e0a1a04a6940b3e7f646a4c065cd3301215adf02721de83263274d83b448c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.4.0 pkginfo/1.7.0 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.10
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page