An integration package connecting LocalAI and LangChain
Project description
langchain-localai
This package contains the LangChain integration with LocalAI
Installation
pip install -U langchain-localai
Embeddings
LocalAIEmbeddings class exposes embeddings from LocalAI.
from langchain_localai import LocalAIEmbeddings
embeddings = LocalAIEmbeddings(
openai_api_base="http://localhost:8080",
model="embedding-model-name")
embeddings.embed_query("What is the meaning of life?")
Reranker
LocalAIRerank class exposes reranker from LocalAI.
from langchain_localai import LocalAIRerank
from langchain_core.documents import Document
reranker = LocalAIRerank(
openai_api_key="foo",
model="bge-reranker-v2-m3",
openai_api_base="http://localhost:8080",
)
reranked_docs = reranker.compress_documents(documents=[
Document(page_content="bar"),Document(page_content="baz")], query="foo")
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file langchain_localai-1.0.0.tar.gz.
File metadata
- Download URL: langchain_localai-1.0.0.tar.gz
- Upload date:
- Size: 6.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c4be1263d3d2d87c0e68b7c4beae112657d253a3a05009f6b1b815eb45e0765
|
|
| MD5 |
8c9da5b67245b1b0d20c27409697c751
|
|
| BLAKE2b-256 |
c2a73c9b122629debf2458e3c9920e2ddfbf82782e6605c272ef5abb3bc1d4a0
|
File details
Details for the file langchain_localai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: langchain_localai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 7.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f2370783620614700639487613f84033d396d9160aded6af00bf6b0bea82c8a
|
|
| MD5 |
68cb9df3da6ca6cf6c1db00edacbc071
|
|
| BLAKE2b-256 |
9703b81ccaed613573c0e56e62384994be4924b105323d5c0a8bfe077213d86c
|