Harrison/bookend ai (#14258)

Co-authored-by: stvhu-bookend <142813359+stvhu-bookend@users.noreply.github.com>
This commit is contained in:
Harrison Chase
2023-12-04 19:42:15 -08:00
committed by GitHub
parent 0d47d15a9f
commit 2213fc9711
5 changed files with 210 additions and 0 deletions

View File

@@ -0,0 +1,89 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "2c591a6a42ac7f0",
"metadata": {},
"source": [
"# Bookend AI\n",
"\n",
"Let's load the Bookend AI Embeddings class."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d94c62b4",
"metadata": {},
"outputs": [],
"source": [
"from langchain.embeddings import BookendEmbeddings"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "523a09e3",
"metadata": {},
"outputs": [],
"source": [
"embeddings = BookendEmbeddings(\n",
" domain=\"your_domain\",\n",
" api_token=\"your_api_token\",\n",
" model_id=\"your_embeddings_model_id\",\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b212bd5a",
"metadata": {},
"outputs": [],
"source": [
"text = \"This is a test document.\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "57db66bd",
"metadata": {},
"outputs": [],
"source": [
"query_result = embeddings.embed_query(text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b790fd09",
"metadata": {},
"outputs": [],
"source": [
"doc_result = embeddings.embed_documents([text])"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}