FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: update new interface usage example by SimsonW · Pull Request #38 · TaskingAI/TaskingAI-Python-Client · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .ipynb  (1) .py  (1) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
52 changes: 26 additions & 26 deletions examples/assistant/chat_with_assistant.ipynb
This file contains hidden or 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
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
This file contains hidden or 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
Expand Up @@ -7,6 +7,10 @@
"AssistantTool",
"AssistantRetrieval",
"AssistantToolType",
"ToolRef",
"ToolType",
"RetrievalRef",
"RetrievalType",
"AssistantRetrievalType",
"get_assistant",
"list_assistants",
Expand Down

Back | FazBrowse Home | New Git URL