Skip to content

fix: update new interface usage example #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading