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 Cohere 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 | "colab": { |
| #26 | "base_uri": "https://localhost:8080/" |
| #27 | }, |
| #28 | "id": "-NbXjAdlh0vJ", |
| #29 | "outputId": "fae77912-4e6a-4c78-fcb7-fbbe46f7a9c7" |
| #30 | }, |
| #31 | "outputs": [], |
| #32 | "source": [ |
| #33 | "!pip install embedchain[together]" |
| #34 | ] |
| #35 | }, |
| #36 | { |
| #37 | "cell_type": "markdown", |
| #38 | "metadata": { |
| #39 | "id": "nGnpSYAAh2bQ" |
| #40 | }, |
| #41 | "source": [ |
| #42 | "### Step-2: Set Cohere related environment variables\n", |
| #43 | "\n", |
| #44 | "You can find `OPENAI_API_KEY` on your [OpenAI dashboard](https://platform.openai.com/account/api-keys) and `TOGETHER_API_KEY` key on your [Together dashboard](https://api.together.xyz/settings/api-keys)." |
| #45 | ] |
| #46 | }, |
| #47 | { |
| #48 | "cell_type": "code", |
| #49 | "execution_count": 1, |
| #50 | "metadata": { |
| #51 | "id": "0fBdQ9GAiRvK" |
| #52 | }, |
| #53 | "outputs": [], |
| #54 | "source": [ |
| #55 | "import os\n", |
| #56 | "from embedchain import App\n", |
| #57 | "\n", |
| #58 | "os.environ[\"OPENAI_API_KEY\"] = \"\"\n", |
| #59 | "os.environ[\"TOGETHER_API_KEY\"] = \"\"" |
| #60 | ] |
| #61 | }, |
| #62 | { |
| #63 | "cell_type": "markdown", |
| #64 | "metadata": { |
| #65 | "id": "PGt6uPLIi1CS" |
| #66 | }, |
| #67 | "source": [ |
| #68 | "### Step-3 Create embedchain app and define your config" |
| #69 | ] |
| #70 | }, |
| #71 | { |
| #72 | "cell_type": "code", |
| #73 | "execution_count": 3, |
| #74 | "metadata": { |
| #75 | "colab": { |
| #76 | "base_uri": "https://localhost:8080/", |
| #77 | "height": 321 |
| #78 | }, |
| #79 | "id": "Amzxk3m-i3tD", |
| #80 | "outputId": "afe8afde-5cb8-46bc-c541-3ad26cc3fa6e" |
| #81 | }, |
| #82 | "outputs": [], |
| #83 | "source": [ |
| #84 | "app = App.from_config(config={\n", |
| #85 | " \"provider\": \"together\",\n", |
| #86 | " \"config\": {\n", |
| #87 | " \"model\": \"mistralai/Mixtral-8x7B-Instruct-v0.1\",\n", |
| #88 | " \"temperature\": 0.5,\n", |
| #89 | " \"max_tokens\": 1000\n", |
| #90 | " }\n", |
| #91 | "})" |
| #92 | ] |
| #93 | }, |
| #94 | { |
| #95 | "cell_type": "markdown", |
| #96 | "metadata": { |
| #97 | "id": "XNXv4yZwi7ef" |
| #98 | }, |
| #99 | "source": [ |
| #100 | "### Step-4: Add data sources to your app" |
| #101 | ] |
| #102 | }, |
| #103 | { |
| #104 | "cell_type": "code", |
| #105 | "execution_count": 4, |
| #106 | "metadata": { |
| #107 | "colab": { |
| #108 | "base_uri": "https://localhost:8080/", |
| #109 | "height": 176 |
| #110 | }, |
| #111 | "id": "Sn_0rx9QjIY9", |
| #112 | "outputId": "2f2718a4-3b7e-4844-fd46-3e0857653ca0" |
| #113 | }, |
| #114 | "outputs": [ |
| #115 | { |
| #116 | "name": "stderr", |
| #117 | "output_type": "stream", |
| #118 | "text": [ |
| #119 | "Inserting batches in chromadb: 100%|██████████| 1/1 [00:01<00:00, 1.16s/it]" |
| #120 | ] |
| #121 | }, |
| #122 | { |
| #123 | "name": "stdout", |
| #124 | "output_type": "stream", |
| #125 | "text": [ |
| #126 | "Successfully saved https://www.forbes.com/profile/elon-musk (DataType.WEB_PAGE). New chunks count: 4\n" |
| #127 | ] |
| #128 | }, |
| #129 | { |
| #130 | "name": "stderr", |
| #131 | "output_type": "stream", |
| #132 | "text": [ |
| #133 | "\n" |
| #134 | ] |
| #135 | }, |
| #136 | { |
| #137 | "data": { |
| #138 | "text/plain": [ |
| #139 | "'8cf46026cabf9b05394a2658bd1fe890'" |
| #140 | ] |
| #141 | }, |
| #142 | "execution_count": 4, |
| #143 | "metadata": {}, |
| #144 | "output_type": "execute_result" |
| #145 | } |
| #146 | ], |
| #147 | "source": [ |
| #148 | "app.add(\"https://www.forbes.com/profile/elon-musk\")" |
| #149 | ] |
| #150 | }, |
| #151 | { |
| #152 | "cell_type": "markdown", |
| #153 | "metadata": { |
| #154 | "id": "_7W6fDeAjMAP" |
| #155 | }, |
| #156 | "source": [ |
| #157 | "### Step-5: All set. Now start asking questions related to your data" |
| #158 | ] |
| #159 | }, |
| #160 | { |
| #161 | "cell_type": "code", |
| #162 | "execution_count": null, |
| #163 | "metadata": { |
| #164 | "colab": { |
| #165 | "base_uri": "https://localhost:8080/" |
| #166 | }, |
| #167 | "id": "cvIK7dWRjN_f", |
| #168 | "outputId": "79e873c8-9594-45da-f5a3-0a893511267f" |
| #169 | }, |
| #170 | "outputs": [], |
| #171 | "source": [ |
| #172 | "while(True):\n", |
| #173 | " question = input(\"Enter question: \")\n", |
| #174 | " if question in ['q', 'exit', 'quit']:\n", |
| #175 | " break\n", |
| #176 | " answer = app.query(question)\n", |
| #177 | " print(answer)" |
| #178 | ] |
| #179 | }, |
| #180 | { |
| #181 | "cell_type": "code", |
| #182 | "execution_count": null, |
| #183 | "metadata": {}, |
| #184 | "outputs": [], |
| #185 | "source": [] |
| #186 | } |
| #187 | ], |
| #188 | "metadata": { |
| #189 | "colab": { |
| #190 | "provenance": [] |
| #191 | }, |
| #192 | "kernelspec": { |
| #193 | "display_name": "Python 3", |
| #194 | "name": "python3" |
| #195 | }, |
| #196 | "language_info": { |
| #197 | "codemirror_mode": { |
| #198 | "name": "ipython", |
| #199 | "version": 3 |
| #200 | }, |
| #201 | "file_extension": ".py", |
| #202 | "mimetype": "text/x-python", |
| #203 | "name": "python", |
| #204 | "nbconvert_exporter": "python", |
| #205 | "pygments_lexer": "ipython3", |
| #206 | "version": "3.11.4" |
| #207 | } |
| #208 | }, |
| #209 | "nbformat": 4, |
| #210 | "nbformat_minor": 0 |
| #211 | } |
| #212 |