partner-upstage[patch]: embeddings empty list bug (#22057)

Fixed an error in `embed_documents` when the input was given as an empty
list. And I have revised the document.
This commit is contained in:
JuHyung Son
2024-05-24 00:44:30 +09:00
committed by GitHub
parent 2df8ac402a
commit d9eff44400
6 changed files with 30 additions and 10 deletions

View File

@@ -115,13 +115,13 @@
"source": [
"from langchain_upstage import UpstageEmbeddings\n",
"\n",
"embeddings = UpstageEmbeddings()\n",
"embeddings = UpstageEmbeddings(model=\"solar-embedding-1-large\")\n",
"doc_result = embeddings.embed_documents(\n",
" [\"Sam is a teacher.\", \"This is another document\"]\n",
" [\"Sung is a professor.\", \"This is another document\"]\n",
")\n",
"print(doc_result)\n",
"\n",
"query_result = embeddings.embed_query(\"What does Sam do?\")\n",
"query_result = embeddings.embed_query(\"What does Sung do?\")\n",
"print(query_result)"
]
},

View File

@@ -80,7 +80,7 @@
"source": [
"from langchain_upstage import UpstageEmbeddings\n",
"\n",
"embeddings = UpstageEmbeddings()"
"embeddings = UpstageEmbeddings(model=\"solar-embedding-1-large\")"
]
},
{
@@ -101,7 +101,7 @@
"outputs": [],
"source": [
"doc_result = embeddings.embed_documents(\n",
" [\"Sam is a teacher.\", \"This is another document\"]\n",
" [\"Sung is a professor.\", \"This is another document\"]\n",
")\n",
"print(doc_result)"
]
@@ -123,7 +123,7 @@
},
"outputs": [],
"source": [
"query_result = embeddings.embed_query(\"What does Sam do?\")\n",
"query_result = embeddings.embed_query(\"What does Sung do?\")\n",
"print(query_result)"
]
},
@@ -184,7 +184,7 @@
"\n",
"vectorstore = DocArrayInMemorySearch.from_texts(\n",
" [\"harrison worked at kensho\", \"bears like to eat honey\"],\n",
" embedding=UpstageEmbeddings(),\n",
" embedding=UpstageEmbeddings(model=\"solar-embedding-1-large\"),\n",
")\n",
"retriever = vectorstore.as_retriever()\n",
"docs = retriever.invoke(\"Where did Harrison work?\")\n",