Skip to content

Commit

Permalink
tutorial1
Browse files Browse the repository at this point in the history
  • Loading branch information
ronidas39 committed Oct 15, 2023
0 parents commit 6b06932
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 0 deletions.
Binary file added .DS_Store
Binary file not shown.
6 changes: 6 additions & 0 deletions tutorial1/.ipynb_checkpoints/intro-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
Binary file added tutorial1/Presentation1.pptx
Binary file not shown.
139 changes: 139 additions & 0 deletions tutorial1/intro.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"id": "740099ef",
"metadata": {},
"outputs": [],
"source": [
"from langchain.llms import OpenAI\n",
"from langchain.prompts import PromptTemplate\n",
"from langchain.chains import LLMChain"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "54663f46",
"metadata": {},
"outputs": [],
"source": [
"llm=OpenAI(openai_api_key=\"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\",temperature=0.34,model=\"gpt-3.5-turbo-instruct-0914\")"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "de1128f9",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'\\n\\nThe RGB color code for red is 255, 0, 0.'"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"llm.predict(\"what is rgb color code for color red\")"
]
},
{
"cell_type": "code",
"execution_count": 10,
"id": "1b9ce217",
"metadata": {},
"outputs": [],
"source": [
"colors=[\"red\",\"blue\",\"green\",\"pink\",\"white\",\"black\",\"skyblue\",\"brown\"]"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c800bbc5",
"metadata": {},
"outputs": [],
"source": [
"prompt=PromptTemplate.from_template(\"what is rgb color code for color {color}\")\n",
"chain=LLMChain(llm=llm,prompt=prompt)\n"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "66c07d54",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"\n",
"The RGB color code for red is 255, 0, 0.\n",
"\n",
"\n",
"The RGB color code for blue is 0, 0, 255.\n",
"\n",
"\n",
"The RGB color code for green is 0, 255, 0.\n",
"\n",
"\n",
"The RGB color code for pink is 255, 192, 203.\n",
"\n",
"\n",
"The RGB color code for white is 255, 255, 255.\n",
"\n",
"\n",
"The RGB color code for black is 0, 0, 0.\n",
"\n",
"\n",
"The RGB color code for sky blue is 135, 206, 235.\n",
"\n",
"\n",
"The RGB color code for brown is 165, 42, 42.\n"
]
}
],
"source": [
"for color in colors:\n",
" print(chain.run(color))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "caa7ecc8",
"metadata": {},
"outputs": [],
"source": []
}
],
"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.11.1"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit 6b06932

Please sign in to comment.