Skip to content

Commit

Permalink
fix: update new interface usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
SimsonW authored and jameszyao committed Apr 23, 2024
1 parent 871fd50 commit 19a73f9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
52 changes: 26 additions & 26 deletions examples/assistant/chat_with_assistant.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "initial_id",
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import time\n",
"import taskingai\n",
"# Load TaskingAI API Key from environment variable"
]
],
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -39,10 +39,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"from taskingai.models import Action, ActionAuthentication, ActionAuthenticationType\n",
"from taskingai.tool import Action, ActionAuthentication, ActionAuthenticationType\n",
"from typing import List\n",
"\n",
"# create an assistant action\n",
Expand Down Expand Up @@ -102,14 +100,14 @@
"metadata": {
"collapsed": false
},
"id": "3b2fda39ba58c5e9"
"id": "3b2fda39ba58c5e9",
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"from taskingai.models import Assistant, Chat, ToolRef, ToolType\n",
"from taskingai.assistant import Assistant, Chat, ToolRef, ToolType\n",
"from taskingai.assistant.memory import AssistantMessageWindowMemory\n",
"\n",
"# choose an available chat_completion model from your project\n",
Expand Down Expand Up @@ -145,7 +143,9 @@
"metadata": {
"collapsed": false
},
"id": "3b3df0f232021283"
"id": "3b3df0f232021283",
"outputs": [],
"execution_count": null
},
{
"cell_type": "markdown",
Expand All @@ -159,8 +159,6 @@
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"chat: Chat = taskingai.assistant.create_chat(\n",
" assistant_id=assistant.assistant_id,\n",
Expand All @@ -170,12 +168,12 @@
"metadata": {
"collapsed": false
},
"id": "f1e2f0b2af8b1d8d"
"id": "f1e2f0b2af8b1d8d",
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"from taskingai.assistant import Message, MessageChunk\n",
"user_input = input(\"User Input: \")\n",
Expand Down Expand Up @@ -204,12 +202,12 @@
"metadata": {
"collapsed": false
},
"id": "b26e30b79b71697a"
"id": "b26e30b79b71697a",
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"user_input = input(\"User Input: \")\n",
"while user_input.strip() and user_input != \"q\":\n",
Expand Down Expand Up @@ -245,12 +243,12 @@
"metadata": {
"collapsed": false
},
"id": "c7d73e0b138e3eba"
"id": "c7d73e0b138e3eba",
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"# list messages\n",
"messages = taskingai.assistant.list_messages(\n",
Expand All @@ -264,12 +262,12 @@
"metadata": {
"collapsed": false
},
"id": "e94e3adb0d15373b"
"id": "e94e3adb0d15373b",
"outputs": [],
"execution_count": null
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [
"# delete assistant\n",
"taskingai.assistant.delete_assistant(\n",
Expand All @@ -279,7 +277,9 @@
"metadata": {
"collapsed": false
},
"id": "ed39836bbfdc7a4e"
"id": "ed39836bbfdc7a4e",
"outputs": [],
"execution_count": null
}
],
"metadata": {
Expand Down
4 changes: 4 additions & 0 deletions taskingai/assistant/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
"AssistantTool",
"AssistantRetrieval",
"AssistantToolType",
"ToolRef",
"ToolType",
"RetrievalRef",
"RetrievalType",
"AssistantRetrievalType",
"get_assistant",
"list_assistants",
Expand Down

0 comments on commit 19a73f9

Please sign in to comment.