mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-19 13:23:35 +00:00
cli[patch]: Update integration template for embedding models (#25248)
Update integration template for embedding models
This commit is contained in:
parent
b6f0174bb9
commit
dadb6f1445
@ -24,13 +24,9 @@
|
|||||||
"## Overview\n",
|
"## Overview\n",
|
||||||
"### Integration details\n",
|
"### Integration details\n",
|
||||||
"\n",
|
"\n",
|
||||||
"- TODO: Fill in table features.\n",
|
"import { ItemTable } from \"@theme/FeatureTables\";\n",
|
||||||
"- TODO: Remove JS support link if not relevant, otherwise ensure link is correct.\n",
|
|
||||||
"- TODO: Make sure API reference links are correct.\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"| Class | Package | Local | Serializable | [JS support](https://js.langchain.com/v0.2/docs/integrations/text_embedding/__package_name_short_snake__) | Package downloads | Package latest |\n",
|
"<ItemTable category=\"text_embedding\" item=\"__ModuleName__\" />\n",
|
||||||
"| :--- | :--- | :---: | :---: | :---: | :---: | :---: |\n",
|
|
||||||
"| [__ModuleName__Embeddings](https://api.python.langchain.com/en/latest/embeddings/__module_name__.embeddings.__ModuleName__Embeddings.html) | [__package_name__](https://api.python.langchain.com/en/latest/__package_name_short_snake___api_reference.html) | ✅/❌ | beta/❌ | ✅/❌ |  |  |\n",
|
|
||||||
"\n",
|
"\n",
|
||||||
"## Setup\n",
|
"## Setup\n",
|
||||||
"\n",
|
"\n",
|
||||||
@ -157,10 +153,10 @@
|
|||||||
"retriever = vectorstore.as_retriever()\n",
|
"retriever = vectorstore.as_retriever()\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# Retrieve the most similar text\n",
|
"# Retrieve the most similar text\n",
|
||||||
"retrieved_document = retriever.invoke(\"What is LangChain?\")\n",
|
"retrieved_documents = retriever.invoke(\"What is LangChain?\")\n",
|
||||||
"\n",
|
"\n",
|
||||||
"# show the retrieved document's content\n",
|
"# show the retrieved document's content\n",
|
||||||
"retrieved_document.page_content"
|
"retrieved_documents[0].page_content"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -210,7 +206,7 @@
|
|||||||
"text2 = (\n",
|
"text2 = (\n",
|
||||||
" \"LangGraph is a library for building stateful, multi-actor applications with LLMs\"\n",
|
" \"LangGraph is a library for building stateful, multi-actor applications with LLMs\"\n",
|
||||||
")\n",
|
")\n",
|
||||||
"two_vectors = embeddings.embed_queries([text, text2])\n",
|
"two_vectors = embeddings.embed_documents([text, text2])\n",
|
||||||
"for vector in two_vectors:\n",
|
"for vector in two_vectors:\n",
|
||||||
" print(str(vector)[:100]) # Show the first 100 characters of the vector"
|
" print(str(vector)[:100]) # Show the first 100 characters of the vector"
|
||||||
]
|
]
|
||||||
@ -220,34 +216,10 @@
|
|||||||
"id": "98785c12",
|
"id": "98785c12",
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
"source": [
|
"source": [
|
||||||
"### Async Usage\n",
|
"## API Reference\n",
|
||||||
"\n",
|
"\n",
|
||||||
"You can also use `aembed_query` and `aembed_documents` for producing embeddings asynchronously:\n"
|
"For detailed documentation on `__ModuleName__Embeddings` features and configuration options, please refer to the [API reference](https://api.python.langchain.com/en/latest/embeddings/__module_name__.embeddings.__ModuleName__Embeddings.html).\n"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "4c3bef91",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": [
|
|
||||||
"import asyncio\n",
|
|
||||||
"\n",
|
|
||||||
"async def async_example():\n",
|
|
||||||
" single_vector = await embeddings.embed_query(text)\n",
|
|
||||||
" print(str(single_vector)[:100]) # Show the first 100 characters of the vector\n",
|
|
||||||
"\n",
|
|
||||||
"asyncio.run(async_example())"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"cell_type": "code",
|
|
||||||
"execution_count": null,
|
|
||||||
"id": "f1bd4396",
|
|
||||||
"metadata": {},
|
|
||||||
"outputs": [],
|
|
||||||
"source": []
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"metadata": {
|
"metadata": {
|
||||||
|
Loading…
Reference in New Issue
Block a user