Function LLM for Python
Use local LLMs in your Python apps, with GPU acceleration and zero dependencies. This package is designed to patch OpenAI and Anthropic clients for running inference locally, using predictors hosted on Function.
[!TIP] We offer a similar package for use in the browser and Node.js. Check out fxn-llm-js.
[!IMPORTANT] This package is still a work-in-progress, so the API could change drastically between all releases.
Installing Function LLM
Function is distributed on PyPi. To install, open a terminal and run the following command:
# Install Function LLM
$ pip install --upgrade fxn-llm
[!NOTE] Function LLM requires Python 3.10+
[!IMPORTANT] Make sure to create an access key by signing onto Function. You'll need it to fetch the predictor at runtime.
Using the OpenAI Client Locally
To run text generation and embedding models locally using the OpenAI client, patch your OpenAI instance with the locally function:
from openai import OpenAI
from fxn_llm import locally
# 💥 Create your OpenAI client
openai = OpenAI()
# 🔥 Make it local
openai = locally(openai)
# 🚀 Generate embeddings
embeddings = openai.embeddings.create(
model="@nomic/nomic-embed-text-v1.5-quant",
input="search_query: Hello world!"
)
[!WARNING] Currently, only
openai.embeddings.createis supported. Text generation is coming soon!
Useful Links
- Discover predictors to use in your apps.
- Join our Discord community.
- Check out our docs.
- Learn more about us on our blog.
- Reach out to us at hi@fxn.ai.
Function is a product of NatML Inc.
Release files for fxn-llm 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| fxn_llm-0.0.2.tar.gz | 12.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fxn_llm-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.9 kB
Release files / fxn_llm-0.0.2.tar.gz
| Download URL | fxn_llm-0.0.2.tar.gz |
|---|---|
| Size | 12.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1aff66fe419bc695531948f57928672775bb9c803983e0c77aee77bd2fa1e34c
|
|
BLAKE2b-256 checksum How to use checksums |
fef0e69fa36f1391fdf98804403352a8e48b17cbc52fe8e443d5058cf0e4b1fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.8
|
Release files / fxn_llm-0.0.2-py3-none-any.whl
| Download URL | fxn_llm-0.0.2-py3-none-any.whl |
|---|---|
| Size | 12.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0987ab56908e0746d1c563ac6e8f68334600de7dca693fd140b833283249247e
|
|
BLAKE2b-256 checksum How to use checksums |
efb24c803129cdeb6f22f79a73abc5f047fa0b1676e75100bfce6adceeb59194
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.11.8
|