repositories
loading repo index
repositories
loading repo index
repository
loading code, commits, and activity
public Clawd ADK gateway launch mirror
stars
latest
clone command
git clone gitlawb://did:key:z6Mkq5mY...iFZ5/my-project-publ...git clone gitlawb://did:key:z6Mkq5mY.../my-project-publ...2fa351d6docs: add automaton and perps launch sources16d ago| #1 | { |
| #2 | "cells": [ |
| #3 | { |
| #4 | "cell_type": "markdown", |
| #5 | "metadata": { |
| #6 | "id": "b02n_zJ_hl3d" |
| #7 | }, |
| #8 | "source": [ |
| #9 | "## Cookbook for using ElasticSearchDB with Embedchain" |
| #10 | ] |
| #11 | }, |
| #12 | { |
| #13 | "cell_type": "markdown", |
| #14 | "metadata": { |
| #15 | "id": "gyJ6ui2vhtMY" |
| #16 | }, |
| #17 | "source": [ |
| #18 | "### Step-1: Install embedchain package" |
| #19 | ] |
| #20 | }, |
| #21 | { |
| #22 | "cell_type": "code", |
| #23 | "execution_count": null, |
| #24 | "metadata": { |
| #25 | "id": "-NbXjAdlh0vJ" |
| #26 | }, |
| #27 | "outputs": [], |
| #28 | "source": [ |
| #29 | "!pip install embedchain[elasticsearch]" |
| #30 | ] |
| #31 | }, |
| #32 | { |
| #33 | "cell_type": "markdown", |
| #34 | "metadata": { |
| #35 | "id": "nGnpSYAAh2bQ" |
| #36 | }, |
| #37 | "source": [ |
| #38 | "### Step-2: Set OpenAI environment variables.\n", |
| #39 | "\n", |
| #40 | "You can find this env variable on your [OpenAI dashboard](https://platform.openai.com/account/api-keys)." |
| #41 | ] |
| #42 | }, |
| #43 | { |
| #44 | "cell_type": "code", |
| #45 | "execution_count": null, |
| #46 | "metadata": { |
| #47 | "id": "0fBdQ9GAiRvK" |
| #48 | }, |
| #49 | "outputs": [], |
| #50 | "source": [ |
| #51 | "import os\n", |
| #52 | "from embedchain import App\n", |
| #53 | "\n", |
| #54 | "os.environ[\"OPENAI_API_KEY\"] = \"sk-xxx\"" |
| #55 | ] |
| #56 | }, |
| #57 | { |
| #58 | "cell_type": "markdown", |
| #59 | "metadata": { |
| #60 | "id": "PGt6uPLIi1CS" |
| #61 | }, |
| #62 | "source": [ |
| #63 | "### Step-3 Create embedchain app and define your config" |
| #64 | ] |
| #65 | }, |
| #66 | { |
| #67 | "cell_type": "code", |
| #68 | "execution_count": null, |
| #69 | "metadata": { |
| #70 | "id": "Amzxk3m-i3tD" |
| #71 | }, |
| #72 | "outputs": [], |
| #73 | "source": [ |
| #74 | "app = App.from_config(config={\n", |
| #75 | " \"provider\": \"elasticsearch\",\n", |
| #76 | " \"config\": {\n", |
| #77 | " \"collection_name\": \"es-index\",\n", |
| #78 | " \"es_url\": \"your-elasticsearch-url.com\",\n", |
| #79 | " \"allow_reset\": True,\n", |
| #80 | " \"api_key\": \"xxx\"\n", |
| #81 | " }\n", |
| #82 | "})" |
| #83 | ] |
| #84 | }, |
| #85 | { |
| #86 | "cell_type": "markdown", |
| #87 | "metadata": { |
| #88 | "id": "XNXv4yZwi7ef" |
| #89 | }, |
| #90 | "source": [ |
| #91 | "### Step-4: Add data sources to your app" |
| #92 | ] |
| #93 | }, |
| #94 | { |
| #95 | "cell_type": "code", |
| #96 | "execution_count": null, |
| #97 | "metadata": { |
| #98 | "id": "Sn_0rx9QjIY9" |
| #99 | }, |
| #100 | "outputs": [], |
| #101 | "source": [ |
| #102 | "app.add(\"https://www.forbes.com/profile/elon-musk\")" |
| #103 | ] |
| #104 | }, |
| #105 | { |
| #106 | "cell_type": "markdown", |
| #107 | "metadata": { |
| #108 | "id": "_7W6fDeAjMAP" |
| #109 | }, |
| #110 | "source": [ |
| #111 | "### Step-5: All set. Now start asking questions related to your data" |
| #112 | ] |
| #113 | }, |
| #114 | { |
| #115 | "cell_type": "code", |
| #116 | "execution_count": null, |
| #117 | "metadata": { |
| #118 | "id": "cvIK7dWRjN_f" |
| #119 | }, |
| #120 | "outputs": [], |
| #121 | "source": [ |
| #122 | "while(True):\n", |
| #123 | " question = input(\"Enter question: \")\n", |
| #124 | " if question in ['q', 'exit', 'quit']:\n", |
| #125 | " break\n", |
| #126 | " answer = app.query(question)\n", |
| #127 | " print(answer)" |
| #128 | ] |
| #129 | } |
| #130 | ], |
| #131 | "metadata": { |
| #132 | "colab": { |
| #133 | "provenance": [] |
| #134 | }, |
| #135 | "kernelspec": { |
| #136 | "display_name": "Python 3", |
| #137 | "name": "python3" |
| #138 | }, |
| #139 | "language_info": { |
| #140 | "name": "python" |
| #141 | } |
| #142 | }, |
| #143 | "nbformat": 4, |
| #144 | "nbformat_minor": 0 |
| #145 | } |
| #146 |