Skip to main content

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

langchain_localai-1.0.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

langchain_localai-1.0.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

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

Hashes for langchain_localai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0c4be1263d3d2d87c0e68b7c4beae112657d253a3a05009f6b1b815eb45e0765
MD5 8c9da5b67245b1b0d20c27409697c751
BLAKE2b-256 c2a73c9b122629debf2458e3c9920e2ddfbf82782e6605c272ef5abb3bc1d4a0

See more details on using hashes here.

File details

Details for the file langchain_localai-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for langchain_localai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f2370783620614700639487613f84033d396d9160aded6af00bf6b0bea82c8a
MD5 68cb9df3da6ca6cf6c1db00edacbc071
BLAKE2b-256 9703b81ccaed613573c0e56e62384994be4924b105323d5c0a8bfe077213d86c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page