From 2f3ab8f1e37f093105a02df42930f7b1c2e687a9 Mon Sep 17 00:00:00 2001 From: Eugene Yurtsev Date: Mon, 12 Aug 2024 10:34:22 -0400 Subject: [PATCH] x --- .../langchain_openai/embeddings/base.py | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libs/partners/openai/langchain_openai/embeddings/base.py b/libs/partners/openai/langchain_openai/embeddings/base.py index 28a1e4137bc15..9e9ccb49c9e33 100644 --- a/libs/partners/openai/langchain_openai/embeddings/base.py +++ b/libs/partners/openai/langchain_openai/embeddings/base.py @@ -142,30 +142,30 @@ class OpenAIEmbeddings(BaseModel, Embeddings): # dimensions=1024 ) - Embed multiple texts: + Embed single text: .. code-block:: python - vectors = embeddings.embed_documents(['hello', 'goodbye']) - # Showing only the first 3 coordinates - print(len(vectors)) - print(vectors[0][:3]) + input_text = "The meaning of life is 42" + vector = embeddings.embed_query('hello') + print(vector[:3]) .. code-block:: python - 2 [-0.024603435769677162, -0.007543657906353474, 0.0039630369283258915] - Embed single text: + Embed multiple texts: .. code-block:: python - input_text = "The meaning of life is 42" - vector = embeddings.embed_query('hello') - print(vector[:3]) + vectors = embeddings.embed_documents(['hello', 'goodbye']) + # Showing only the first 3 coordinates + print(len(vectors)) + print(vectors[0][:3]) .. code-block:: python + 2 [-0.024603435769677162, -0.007543657906353474, 0.0039630369283258915] Async: