Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert Course Code into Financial Workshop #156

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion rag-advanced/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.env

data/wandb_docs/*
data/wandb_docs/*

.venv
Binary file added rag-advanced/data/finance_docs/2022 Q3 AAPL.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2022 Q3 AMZN.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2022 Q3 INTC.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2022 Q3 MSFT.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2022 Q3 NVDA.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q1 AAPL.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q1 AMZN.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q1 INTC.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q1 MSFT.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q1 NVDA.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q2 AAPL.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q2 AMZN.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q2 INTC.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q2 MSFT.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q2 NVDA.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q3 AAPL.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q3 AMZN.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q3 INTC.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q3 MSFT.pdf
Binary file not shown.
Binary file added rag-advanced/data/finance_docs/2023 Q3 NVDA.pdf
Binary file not shown.
50 changes: 33 additions & 17 deletions rag-advanced/notebooks/Chapter00.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"source": [
"## Chapter 0: Setup\n",
"\n",
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/wandb/edu/blob/main/rag-advanced/notebooks/Chapter00.ipynb\">\n",
"<a target=\"_blank\" href=\"https://colab.research.google.com/github/wandb/edu/blob/rag-finance-workshop/rag-advanced/notebooks/Chapter00.ipynb\">\n",
" <img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/>\n",
"</a>\n",
"\n",
Expand All @@ -16,7 +16,7 @@
"\n",
"### 🎉 Free Cohere API key\n",
"\n",
"Before you run this colab notebook, head over to this [link to redeem a free Cohere API key](https://docs.google.com/forms/d/e/1FAIpQLSc9x4nV8_nSQvJnaINO1j9NIa2IUbAJqrKeSllNNCCbMFmCxw/viewform?usp=sf_link).\n",
"Before you run this colab notebook, head over to this [link to redeem a free Cohere API key](http://wandb.me/credits-event)\n",
"\n",
"Alternatively if you have a Cohere API key feel free to proceed. :)"
]
Expand All @@ -27,7 +27,7 @@
"metadata": {},
"outputs": [],
"source": [
"!pip install -qq weave cohere"
"!pip install -qq weave litellm set-env-colab-kaggle-dotenv"
]
},
{
Expand All @@ -40,6 +40,18 @@
"The code cell below will prompt you to put in a W&B API key. You can get your API key by heading over to https://wandb.ai/authorize."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from set_env import set_env\n",
"set_env(\"WANDB_API_KEY\")\n",
"set_env(\"OPENAI_API_KEY\")\n",
"print(\"API keys set\")"
]
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -50,16 +62,14 @@
"import weave\n",
"\n",
"# initialize weave client\n",
"weave_client = weave.init(\"rag-course\")"
"weave_client = weave.init(\"rag-course-finance\")"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Setup Cohere\n",
"\n",
"The code cell below will prompt you to put in a Cohere API key."
"## 2. Setup LiteLLM"
]
},
{
Expand All @@ -68,20 +78,14 @@
"metadata": {},
"outputs": [],
"source": [
"import getpass\n",
"\n",
"import cohere\n",
"\n",
"cohere_client = cohere.ClientV2(\n",
" api_key=getpass.getpass(\"Please enter your COHERE_API_KEY\")\n",
")"
"from litellm import completion"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## A simple-turn chat with Cohere's command-r-plus"
"## A simple-turn chat with OpenAI's gpt-4o-mini"
]
},
{
Expand All @@ -90,11 +94,11 @@
"metadata": {},
"outputs": [],
"source": [
"response = cohere_client.chat(\n",
"response = completion(\n",
" messages=[\n",
" {\"role\": \"user\", \"content\": \"What is retrieval augmented generation (RAG)?\"}\n",
" ],\n",
" model=\"command-r-plus\",\n",
" model=\"gpt-4o-mini\",\n",
" temperature=0.1,\n",
" max_tokens=2000,\n",
")"
Expand All @@ -115,6 +119,18 @@
"kernelspec": {
"display_name": "Python 3",
"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.12.4"
}
},
"nbformat": 4,
Expand Down
Loading