mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-05 21:12:48 +00:00
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:
@@ -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)"
|
||||
]
|
||||
},
|
||||
|
@@ -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",
|
||||
|
Reference in New Issue
Block a user