Skip to main content

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")

Metadata

Release files for langchain-localai 1.0.0

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

Source distribution (sdist)

Source distribution for langchain-localai 1.0.0
File Size Uploaded
langchain_localai-1.0.0.tar.gz 6.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for langchain-localai 1.0.0
File Interpreter ABI Platform
langchain_localai-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / langchain_localai-1.0.0.tar.gz

Download URL langchain_localai-1.0.0.tar.gz
Size 6.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0c4be1263d3d2d87c0e68b7c4beae112657d253a3a05009f6b1b815eb45e0765
BLAKE2b-256 checksum
How to use checksums
c2a73c9b122629debf2458e3c9920e2ddfbf82782e6605c272ef5abb3bc1d4a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / langchain_localai-1.0.0-py3-none-any.whl

Download URL langchain_localai-1.0.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4f2370783620614700639487613f84033d396d9160aded6af00bf6b0bea82c8a
BLAKE2b-256 checksum
How to use checksums
9703b81ccaed613573c0e56e62384994be4924b105323d5c0a8bfe077213d86c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

0.2.0

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

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