From 87e12aef467612be7fd173025ded52f8f212612a Mon Sep 17 00:00:00 2001 From: Zahra Dehghani Tafti <70191769+ZahraDehghani99@users.noreply.github.com> Date: Sat, 13 Sep 2025 08:19:46 +0330 Subject: [PATCH 1/4] Updated openAI request. --- docs/source/en/quick_tour.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/source/en/quick_tour.md b/docs/source/en/quick_tour.md index 13aaec62..f33861d3 100644 --- a/docs/source/en/quick_tour.md +++ b/docs/source/en/quick_tour.md @@ -77,6 +77,7 @@ print(len(embedding[0])) ``` #### OpenAI +The server is availabe at : localhost:8080/v1/embeddings You can install it via pip as `pip install --upgrade openai`, and then run: @@ -84,14 +85,14 @@ You can install it via pip as `pip install --upgrade openai`, and then run: import os from openai import OpenAI -client = OpenAI(base_url="http://localhost:8080/v1/embeddings") +client = OpenAI(base_url="http://localhost:8080/v1", api_key= "fake") response = client.embeddings.create( model="tei", input="What is deep learning?" ) -print(response) +print(response.data[0].embedding) ``` ## Re-rankers and sequence classification From bde464fe3b8392505bda7a8adf5c5ed4313517a5 Mon Sep 17 00:00:00 2001 From: ZahraDehghani99 Date: Mon, 15 Sep 2025 21:34:39 +0330 Subject: [PATCH 2/4] =?UTF-8?q?docs(tei):=20apply=20reviewer=20suggestions?= =?UTF-8?q?=20=E2=80=94=20update=20OpenAI=20example,=20add=20curl,=20fix?= =?UTF-8?q?=20closing=20backticks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/source/en/quick_tour.md | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/docs/source/en/quick_tour.md b/docs/source/en/quick_tour.md index f33861d3..bfbc5d0f 100644 --- a/docs/source/en/quick_tour.md +++ b/docs/source/en/quick_tour.md @@ -77,24 +77,33 @@ print(len(embedding[0])) ``` #### OpenAI -The server is availabe at : localhost:8080/v1/embeddings - -You can install it via pip as `pip install --upgrade openai`, and then run: +To send requests to the [OpenAI Embeddings API](https://platform.openai.com/docs/api-reference/embeddings/create) exposed on Text Embeddings Inference (TEI) with the OpenAI Python SDK, you can install it as `pip install --upgrade openai`, and then run the following snippet: ```python import os from openai import OpenAI -client = OpenAI(base_url="http://localhost:8080/v1", api_key= "fake") +client = OpenAI(base_url="http://localhost:8080/v1", api_key= "-") response = client.embeddings.create( - model="tei", - input="What is deep learning?" + model="text-embeddings-inference", + input="What is Deep Learning?", ) print(response.data[0].embedding) ``` +Alternatively, you can also send the request with cURL as follows: +```bash +curl http://localhost:8080/v1/embeddings \ + -H "Content-Type: application/json" \ + -d '{ + "input": "What is Deep Learning?", + "model": "text-embeddings-inference", + "encoding_format": "float" + }' +``` + ## Re-rankers and sequence classification TEI also supports re-ranker and classic sequence classification models. From b43ab3503b5a2a20fec60a1447df4b83cf888a95 Mon Sep 17 00:00:00 2001 From: Zahra Dehghani Tafti <70191769+ZahraDehghani99@users.noreply.github.com> Date: Mon, 15 Sep 2025 21:35:48 +0330 Subject: [PATCH 3/4] Update docs/source/en/quick_tour.md Co-authored-by: Alvaro Bartolome <36760800+alvarobartt@users.noreply.github.com> --- docs/source/en/quick_tour.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/docs/source/en/quick_tour.md b/docs/source/en/quick_tour.md index bfbc5d0f..6f0b7456 100644 --- a/docs/source/en/quick_tour.md +++ b/docs/source/en/quick_tour.md @@ -93,6 +93,18 @@ response = client.embeddings.create( print(response.data[0].embedding) ``` +Alternatively, you can also send the request with cURL as follows: + +```bash +curl http://localhost/v1/embeddings \ + -H "Content-Type: application/json" \ + -d '{ + "input": "What is Deep Learning?", + "model": "text-embeddings-inference", + "encoding_format": "float" + }' +`` + Alternatively, you can also send the request with cURL as follows: ```bash curl http://localhost:8080/v1/embeddings \ From 77f8f21b786587b8de3456404ffe48519ef1be99 Mon Sep 17 00:00:00 2001 From: ZahraDehghani99 Date: Mon, 15 Sep 2025 21:38:58 +0330 Subject: [PATCH 4/4] docs(tei): remove duplicate example --- docs/source/en/quick_tour.md | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/docs/source/en/quick_tour.md b/docs/source/en/quick_tour.md index 6f0b7456..bfbc5d0f 100644 --- a/docs/source/en/quick_tour.md +++ b/docs/source/en/quick_tour.md @@ -93,18 +93,6 @@ response = client.embeddings.create( print(response.data[0].embedding) ``` -Alternatively, you can also send the request with cURL as follows: - -```bash -curl http://localhost/v1/embeddings \ - -H "Content-Type: application/json" \ - -d '{ - "input": "What is Deep Learning?", - "model": "text-embeddings-inference", - "encoding_format": "float" - }' -`` - Alternatively, you can also send the request with cURL as follows: ```bash curl http://localhost:8080/v1/embeddings \