openai python SDK:
1
Install the dependencies
2
Update OpenAI URL
Replace
base_url with your embeddding endpoint.openai_compatibility.py
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
How to integrate TVI with existing OpenAI compatible endpoints
openai python SDK:
Install the dependencies
pip install openai requests python-dotenv
Update OpenAI URL
base_url with your embeddding endpoint.import openai
import time
import requests
import os
from dotenv import load_dotenv
load_dotenv()
endpoint = "http://<your-ingress-endpoint-here>"
openai.base_url = endpoint
client = openai.OpenAI(
# This is the default and can be omitted
api_key=os.environ.get("OPENAI_API_KEY"),
base_url=endpoint
)
embedding = client.embeddings.create(
input="This is some example input",
model="BAAI/bge-m3"
)
Was this page helpful?