Skip to main content

A PyPI-ready FastAPI embedding service and LangChain-compatible remote client.

Project description

remote-embedding

remote-embedding packages two things together:

  • A FastAPI server that exposes a /embed API backed by local Hugging Face models.
  • A LangChain-compatible RemoteEmbeddings client that calls that server remotely.

Install

pip install remote-embedding

Package Layout

The import package is remote_embedding.

from remote_embedding import RemoteEmbeddings

Run The Server

Set the environment variables your model needs.

PowerShell:

$env:EMBEDDING_MODEL_NAME="BAAI/bge-base-en-v1.5"
$env:EMBEDDING_DIR="C:\\path\\to\\model-cache"
$env:DEVICE="cpu"

Bash:

export EMBEDDING_MODEL_NAME=BAAI/bge-base-en-v1.5
export EMBEDDING_DIR=/path/to/model-cache
export DEVICE=cpu

Start the API:

remote-embedding-server

Or:

python -m remote_embedding

Defaults:

  • HOST=0.0.0.0
  • PORT=5055

Use The Client

from remote_embedding import RemoteEmbeddings

embeddings = RemoteEmbeddings(
    base_url="http://127.0.0.1:5055",
    model_name="BAAI/bge-base-en-v1.5",
)

docs = embeddings.embed_documents(["hello world", "remote embeddings"])
query = embeddings.embed_query("search text")

Build For PyPI

Build distributions locally:

python -m pip install --upgrade build
python -m build

This creates:

  • dist/*.tar.gz
  • dist/*.whl

Upload with Twine:

python -m pip install --upgrade twine
python -m twine upload dist/*

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

remote_embedding-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

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

remote_embedding-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file remote_embedding-0.1.0.tar.gz.

File metadata

  • Download URL: remote_embedding-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for remote_embedding-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bfbd0039a14e3fa434479d041c6f53647c7ceb4d0e4e3b769a53eb0ab986ce75
MD5 0b4cd7df90372731ffadbf8587163b7f
BLAKE2b-256 5a2b5340e452a789ecf45cf020059d46b9f524d2d0dc4464ff5625411d8e7a54

See more details on using hashes here.

File details

Details for the file remote_embedding-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for remote_embedding-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8094955c47834e17e8fd7a43cc391991a61909c8896004eeba44ab3d24aaef1b
MD5 66ad911e90e0f6d1897350432e2c853a
BLAKE2b-256 74a3e4b30f7db51df91638e480e496e1f7867060fa8616116a12a256aa11ce4d

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