Skip to content

Commit

Permalink
fix slowness
Browse files Browse the repository at this point in the history
  • Loading branch information
lostmygithubaccount committed Feb 13, 2024
1 parent f90c961 commit 861d36b
Show file tree
Hide file tree
Showing 2 changed files with 160 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/ibis_birdbrain/attachments/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def decode(self, t: Table) -> str:
def __str__(self):
return (
super().__str__()
# TODO: ugh
# TODO: FIX this -- using Ibis reprs directly gets cut off for some reason
+ f"""
**table**:\n{self.content.to_pandas()}"""
**table**:\n{self.content.limit(20).to_pandas()}"""
)
165 changes: 158 additions & 7 deletions untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
{
"data": {
"text/plain": [
"'gpt-4-0125-preview'"
"'gpt-4-turbo'"
]
},
"execution_count": 4,
Expand Down Expand Up @@ -110,14 +110,56 @@
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"17155"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"len(str(bot.messages))"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:root:Bot birdbrain called with text: who are you and what can do you?\n",
"INFO:root:Bot birdbrain selecting flow...\n"
"INFO:root:Bot birdbrain selecting flow...\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:root:Bot birdbrain selected flow: Flows.RESPOND\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n"
]
},
{
"data": {
"text/plain": [
"To: user\n",
"From: birdbrain\n",
"Subject: response\n",
"Sent at: 2024-02-13 11:53:17.899252\n",
"Message: e83439fc-008b-4c66-8fe2-f46d40a93abb\n",
"\n",
"I am a machine learning-powered data bot designed to assist with data querying and analysis tasks. I can interpret and execute SQL code to answer queries about datasets provided to me.\n",
"\n",
"Attachments:\n",
"\n"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
Expand All @@ -126,7 +168,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 9,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -135,18 +177,127 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 10,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:root:Bot birdbrain called with text: what's the average interest rate (original and current)?\n",
"INFO:root:Bot birdbrain selecting flow...\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:root:Bot birdbrain selected flow: Flows.SQL_CODE\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:root:Extracted GUIDs: ['2eb4bb66-d31b-48c6-b0d7-f0e7bc53d988']\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n"
]
},
{
"data": {
"text/plain": [
"To: user\n",
"From: birdbrain\n",
"Subject: response\n",
"Sent at: 2024-02-13 11:53:50.578644\n",
"Message: 2ea52580-f9d6-42c9-a712-2315f3210904\n",
"\n",
"The average original interest rate is 7.96% and the average current interest rate is 7.93%.\n",
"\n",
"Attachments:\n",
"\n",
"TableAttachment\n",
" **guid**: 1f02c759-2559-415d-9ec2-7b4a98ae72b0\n",
" **time**: 2024-02-13 11:53:42.377714\n",
" **name**: None\n",
" **desc**: \n",
"ibis.Schema {\n",
" average_original_interest_rate float64\n",
" average_current_interest_rate float64\n",
"}\n",
" **table**:\n",
" average_original_interest_rate average_current_interest_rate\n",
"0 7.960559 7.928592"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bot(\"what's the average interest rate (original and current)?\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 11,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO:root:Bot birdbrain called with text: now do the same but with min, max, mean, and median\n",
"INFO:root:Bot birdbrain selecting flow...\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:root:Bot birdbrain selected flow: Flows.SQL_CODE\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:root:Extracted GUIDs: ['72de100c-6213-41e2-802c-a96f3d34b293', '2eb4bb66-d31b-48c6-b0d7-f0e7bc53d988', '1f02c759-2559-415d-9ec2-7b4a98ae72b0']\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n",
"INFO:httpx:HTTP Request: POST https://birdbrain-eh.openai.azure.com//openai/deployments/gpt-4-turbo/chat/completions?api-version=2023-12-01-preview \"HTTP/1.1 200 OK\"\n"
]
},
{
"data": {
"text/plain": [
"To: user\n",
"From: birdbrain\n",
"Subject: response\n",
"Sent at: 2024-02-13 11:54:48.831519\n",
"Message: 65c5e888-bba3-4232-927e-9c4bd8d3d28d\n",
"\n",
"The minimum original interest rate is 3.00%, the maximum is 12.325%, the mean is 7.96%, and the median is 7.985%. The minimum current interest rate is 2.00%, the maximum is 12.325%, the mean is 7.93%, and the median is 7.875%.\n",
"\n",
"Attachments:\n",
"\n",
"TableAttachment\n",
" **guid**: 9e7a7738-8be9-4890-bd07-50fff5e93037\n",
" **time**: 2024-02-13 11:54:36.032554\n",
" **name**: None\n",
" **desc**: \n",
"ibis.Schema {\n",
" min_original_interest_rate float64\n",
" max_original_interest_rate float64\n",
" mean_original_interest_rate float64\n",
" median_original_interest_rate float64\n",
" min_current_interest_rate float64\n",
" max_current_interest_rate float64\n",
" mean_current_interest_rate float64\n",
" median_current_interest_rate float64\n",
"}\n",
" **table**:\n",
" min_original_interest_rate max_original_interest_rate \\\n",
"0 3.0 12.325 \n",
"\n",
" mean_original_interest_rate median_original_interest_rate \\\n",
"0 7.960559 7.985 \n",
"\n",
" min_current_interest_rate max_current_interest_rate \\\n",
"0 2.0 12.325 \n",
"\n",
" mean_current_interest_rate median_current_interest_rate \n",
"0 7.928592 7.875 "
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"bot(\"now do the same but with min, max, mean, and median\")"
]
Expand Down

0 comments on commit 861d36b

Please sign in to comment.