-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6b06932
Showing
4 changed files
with
145 additions
and
0 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |