Skip to main content

Code

vllm_embedder.py

Usage

1

Create a virtual environment

Open the Terminal and create a python virtual environment.
2

Install libraries

3

Run PgVector

4

Run the example

Notes

  • This example uses local mode where vLLM loads the model directly (no server needed)
  • For remote mode, the code includes knowledge_remote example with base_url parameter
  • GPU with ~14GB VRAM required for e5-mistral-7b-instruct model
  • For CPU-only or lower memory, use smaller models like BAAI/bge-small-en-v1.5
  • Models are automatically downloaded from HuggingFace on first use