Simple inference for large language models
Project description
Language Models
A Python package providing simple building blocks for exploring natural language processing.
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'
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
languagemodels-0.0.4.tar.gz
(6.8 kB
view hashes)
Built Distribution
Close
Hashes for languagemodels-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f55d59bffe368e556ab492af6e3816001aa11f2f9169e66b71c1b029fb19e217 |
|
MD5 | 4f39dbf8e506c9b0cfee9d7e8df64d3c |
|
BLAKE2b-256 | 540e0a1a04a6940b3e7f646a4c065cd3301215adf02721de83263274d83b448c |