Skip to content

Commit

Permalink
Testing fine tuned chat of AnyScale
Browse files Browse the repository at this point in the history
  • Loading branch information
MrCsabaToth committed Nov 8, 2023
1 parent dedc38d commit c5c7799
Showing 1 changed file with 133 additions and 0 deletions.
133 changes: 133 additions & 0 deletions AnyScaleFineTuneChat.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "ced475a3-a626-412a-8177-a587f2ff00eb",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"import os\n",
"import openai\n",
"\n",
"# AnyScale uses OpenAI's API\n",
"# This code is for Pre 1.0.0 openai PyPi packages (latest is 0.28.1)\n",
"openai.api_base = \"https://api.endpoints.anyscale.com/v1\"\n",
"openai.api_key = os.getenv(\"ANYSCALE_API_KEY\") or \"ANYSCALE_API_KEY\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "3312a2ac-6791-40bc-9170-257454e96875",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"model = \"meta-llama/Llama-2-13b-chat-hf:csaba:nAdbyJW\"\n",
"\n",
"question = [\n",
" dict(\n",
" role='user',\n",
" content='Can the User make adjustments on the Cash Flow Control page?'\n",
" )\n",
"]\n",
"\n",
"chat_response = openai.ChatCompletion.create(\n",
" model = model, \n",
" messages = question,\n",
" temperature = 0)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "bdd79662-e4b4-4b4e-bab1-f9428ca79b0f",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"<OpenAIObject text_completion id=meta-llama/Llama-2-13b-chat-hf:csaba:nAdbyJW-1107e0942a0aad68d3af1a2cf942500e at 0x7f077f7fb270> JSON: {\n",
" \"id\": \"meta-llama/Llama-2-13b-chat-hf:csaba:nAdbyJW-1107e0942a0aad68d3af1a2cf942500e\",\n",
" \"object\": \"text_completion\",\n",
" \"created\": 1699402688,\n",
" \"model\": \"meta-llama/Llama-2-13b-chat-hf:csaba:nAdbyJW\",\n",
" \"choices\": [\n",
" {\n",
" \"message\": {\n",
" \"role\": \"assistant\",\n",
" \"content\": \" Yes, the User can make adjustments on the Cash Flow Control page. The Cash Flow Control page allows the User to adjust the cash flow for the selected transaction. The User can adjust the cash flow by entering a new amount for the cash flow in the \\\"Adjust Cash Flow\\\" field. The User can also adjust the cash flow by selecting the \\\"Adjust Cash Flow\\\" button and entering a new amount for the cash flow in the \\\"Adjust Cash Flow\\\" field.\\n\\nAdditionally, the User can also adjust the cash flow by selecting the \\\"Adjust Cash Flow\\\" button and then selecting the \\\"Apply\\\" button. This will apply the adjustment to the cash flow for the selected transaction.\\n\\nIt is important to note that the User should exercise caution when making adjustments to the cash flow, as these adjustments can have a significant impact on the financial performance of the transaction. It is recommended that the User consult with a financial advisor or other qualified professional before making any adjustments to the cash flow.\"\n",
" },\n",
" \"index\": 0,\n",
" \"finish_reason\": \"stop\"\n",
" }\n",
" ],\n",
" \"usage\": {\n",
" \"prompt_tokens\": 22,\n",
" \"completion_tokens\": 227,\n",
" \"total_tokens\": 249\n",
" }\n",
"}"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"chat_response"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "07a88e66-e3da-48a6-9235-c7d347e1a3fb",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"text/plain": [
"' Yes, the User can make adjustments on the Cash Flow Control page. The Cash Flow Control page allows the User to adjust the cash flow for the selected transaction. The User can adjust the cash flow by entering a new amount for the cash flow in the \"Adjust Cash Flow\" field. The User can also adjust the cash flow by selecting the \"Adjust Cash Flow\" button and entering a new amount for the cash flow in the \"Adjust Cash Flow\" field.\\n\\nAdditionally, the User can also adjust the cash flow by selecting the \"Adjust Cash Flow\" button and then selecting the \"Apply\" button. This will apply the adjustment to the cash flow for the selected transaction.\\n\\nIt is important to note that the User should exercise caution when making adjustments to the cash flow, as these adjustments can have a significant impact on the financial performance of the transaction. It is recommended that the User consult with a financial advisor or other qualified professional before making any adjustments to the cash flow.'"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"chat_response.choices[0].message.content"
]
}
],
"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.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

0 comments on commit c5c7799

Please sign in to comment.