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 LLAMA2 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": "86a4a9b2-4ed6-431c-da6f-c3eacb390f42" |
| #30 | }, |
| #31 | "outputs": [], |
| #32 | "source": [ |
| #33 | "!pip install embedchain[llama2]" |
| #34 | ] |
| #35 | }, |
| #36 | { |
| #37 | "cell_type": "markdown", |
| #38 | "metadata": { |
| #39 | "id": "nGnpSYAAh2bQ" |
| #40 | }, |
| #41 | "source": [ |
| #42 | "### Step-2: Set LLAMA2 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 `REPLICATE_API_TOKEN` key on your [Replicate dashboard](https://replicate.com/account/api-tokens)." |
| #45 | ] |
| #46 | }, |
| #47 | { |
| #48 | "cell_type": "code", |
| #49 | "execution_count": null, |
| #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\"] = \"sk-xxx\"\n", |
| #59 | "os.environ[\"REPLICATE_API_TOKEN\"] = \"xxx\"" |
| #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": null, |
| #74 | "metadata": { |
| #75 | "id": "Amzxk3m-i3tD" |
| #76 | }, |
| #77 | "outputs": [], |
| #78 | "source": [ |
| #79 | "app = App.from_config(config={\n", |
| #80 | " \"provider\": \"llama2\",\n", |
| #81 | " \"config\": {\n", |
| #82 | " \"model\": \"a16z-infra/llama13b-v2-chat:df7690f1994d94e96ad9d568eac121aecf50684a0b0963b25a41cc40061269e5\",\n", |
| #83 | " \"temperature\": 0.5,\n", |
| #84 | " \"max_tokens\": 1000,\n", |
| #85 | " \"top_p\": 0.5,\n", |
| #86 | " \"stream\": False\n", |
| #87 | " }\n", |
| #88 | "})" |
| #89 | ] |
| #90 | }, |
| #91 | { |
| #92 | "cell_type": "markdown", |
| #93 | "metadata": { |
| #94 | "id": "XNXv4yZwi7ef" |
| #95 | }, |
| #96 | "source": [ |
| #97 | "### Step-4: Add data sources to your app" |
| #98 | ] |
| #99 | }, |
| #100 | { |
| #101 | "cell_type": "code", |
| #102 | "execution_count": null, |
| #103 | "metadata": { |
| #104 | "colab": { |
| #105 | "base_uri": "https://localhost:8080/", |
| #106 | "height": 52 |
| #107 | }, |
| #108 | "id": "Sn_0rx9QjIY9", |
| #109 | "outputId": "ba158e9c-0f16-4c6b-a876-7543120985a2" |
| #110 | }, |
| #111 | "outputs": [], |
| #112 | "source": [ |
| #113 | "app.add(\"https://www.forbes.com/profile/elon-musk\")" |
| #114 | ] |
| #115 | }, |
| #116 | { |
| #117 | "cell_type": "markdown", |
| #118 | "metadata": { |
| #119 | "id": "_7W6fDeAjMAP" |
| #120 | }, |
| #121 | "source": [ |
| #122 | "### Step-5: All set. Now start asking questions related to your data" |
| #123 | ] |
| #124 | }, |
| #125 | { |
| #126 | "cell_type": "code", |
| #127 | "execution_count": null, |
| #128 | "metadata": { |
| #129 | "colab": { |
| #130 | "base_uri": "https://localhost:8080/", |
| #131 | "height": 599 |
| #132 | }, |
| #133 | "id": "cvIK7dWRjN_f", |
| #134 | "outputId": "e2d11a25-a2ed-4034-ec6a-e8a5986c89ae" |
| #135 | }, |
| #136 | "outputs": [], |
| #137 | "source": [ |
| #138 | "while(True):\n", |
| #139 | " question = input(\"Enter question: \")\n", |
| #140 | " if question in ['q', 'exit', 'quit']:\n", |
| #141 | " break\n", |
| #142 | " answer = app.query(question)\n", |
| #143 | " print(answer)" |
| #144 | ] |
| #145 | } |
| #146 | ], |
| #147 | "metadata": { |
| #148 | "colab": { |
| #149 | "provenance": [] |
| #150 | }, |
| #151 | "kernelspec": { |
| #152 | "display_name": "Python 3", |
| #153 | "name": "python3" |
| #154 | }, |
| #155 | "language_info": { |
| #156 | "name": "python" |
| #157 | } |
| #158 | }, |
| #159 | "nbformat": 4, |
| #160 | "nbformat_minor": 0 |
| #161 | } |
| #162 |