Skip to content

Commit d4e6604

Browse files
jameszyaoSimsonW
authored andcommitted
feat: finish assistant example
1 parent c175b12 commit d4e6604

File tree

11 files changed

+84
-39
lines changed

11 files changed

+84
-39
lines changed

examples/assistant.py

Lines changed: 0 additions & 37 deletions
This file was deleted.

examples/assistant/assistant.py

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import taskingai
2+
from taskingai.assistant import Assistant
3+
4+
# Load TaskingAI API Key fron environment variable
5+
6+
# choose an available chat_completion model from your project
7+
model_id = "Gk1145Bl"
8+
9+
10+
# create an assistant
11+
assistant: Assistant = taskingai.assistant.create_assistant(
12+
model_id=model_id,
13+
name="My Assistant",
14+
description="This is my assistant",
15+
system_prompt_template=["You are a professional assistant speaking {{language}}."],
16+
tools=[],
17+
retrievals=[],
18+
metadata={"foo": "bar"},
19+
)
20+
21+
print(f"created assistant: {assistant}\n")
22+
23+
24+
# get assistant
25+
assistant_id: str = assistant.assistant_id
26+
assistant: Assistant = taskingai.assistant.get_assistant(
27+
assistant_id=assistant_id
28+
)
29+
30+
print(f"got assistant: {assistant}\n")
31+
32+
33+
# update assistant
34+
assistant: Assistant = taskingai.assistant.update_assistant(
35+
assistant_id=assistant_id,
36+
name="My New Assistant",
37+
description="This is my new assistant",
38+
)
39+
40+
print(f"updated assistant: {assistant}\n")
41+
42+
43+
# delete assistant
44+
taskingai.assistant.delete_assistant(assistant_id=assistant_id)
45+
print(f"deleted assistant: {assistant_id}\n")
46+
47+
# list assistants
48+
assistants = taskingai.assistant.list_assistants()
49+
assistant_ids = [assistant.assistant_id for assistant in assistants]
50+
print(f"list assistants: {assistants}\n")
51+
print(f"f{assistant_id} in {assistant_ids}: {assistant_id in assistant_ids}\n")
52+
53+
54+
55+
56+
57+
File renamed without changes.
File renamed without changes.
File renamed without changes.

examples/retrieval/collection.py

Whitespace-only changes.

examples/tool/action.py

Whitespace-only changes.

openapi.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

taskingai/client/models/action_authentication_type.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class ActionAuthenticationType(object):
2323
BASIC = "basic"
2424
BEARER = "bearer"
2525
CUSTOM = "custom"
26+
NONE = "none"
2627
"""
2728
Attributes:
2829
swagger_types (dict): The key is attribute name

taskingai/client/models/assistant.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ def name(self, name):
168168
:param name: The name of this Assistant. # noqa: E501
169169
:type: object
170170
"""
171+
if name is None:
172+
raise ValueError("Invalid value for `name`, must not be `None`")
173+
171174
self._name = name
172175

173176
@property
@@ -190,6 +193,9 @@ def description(self, description):
190193
:param description: The description of this Assistant. # noqa: E501
191194
:type: object
192195
"""
196+
if description is None:
197+
raise ValueError("Invalid value for `description`, must not be `None`")
198+
193199
self._description = description
194200

195201
@property
@@ -212,6 +218,9 @@ def system_prompt_template(self, system_prompt_template):
212218
:param system_prompt_template: The system_prompt_template of this Assistant. # noqa: E501
213219
:type: object
214220
"""
221+
if system_prompt_template is None:
222+
raise ValueError("Invalid value for `system_prompt_template`, must not be `None`")
223+
215224
self._system_prompt_template = system_prompt_template
216225

217226
@property
@@ -234,6 +243,9 @@ def tools(self, tools):
234243
:param tools: The tools of this Assistant. # noqa: E501
235244
:type: object
236245
"""
246+
if tools is None:
247+
raise ValueError("Invalid value for `tools`, must not be `None`") # noqa: E501
248+
237249
self._tools = tools
238250

239251
@property
@@ -256,6 +268,9 @@ def retrievals(self, retrievals):
256268
:param retrievals: The retrievals of this Assistant. # noqa: E501
257269
:type: object
258270
"""
271+
if retrievals is None:
272+
raise ValueError("Invalid value for `retrievals`, must not be `None`") # noqa: E501
273+
259274
self._retrievals = retrievals
260275

261276
@property
@@ -278,6 +293,9 @@ def metadata(self, metadata):
278293
:param metadata: The metadata of this Assistant. # noqa: E501
279294
:type: object
280295
"""
296+
if metadata is None:
297+
raise ValueError("Invalid value for `metadata`, must not be `None`")
298+
281299
self._metadata = metadata
282300

283301
@property
@@ -300,6 +318,9 @@ def created_timestamp(self, created_timestamp):
300318
:param created_timestamp: The created_timestamp of this Assistant. # noqa: E501
301319
:type: object
302320
"""
321+
if created_timestamp is None:
322+
raise ValueError("Invalid value for `created_timestamp`, must not be `None`") # noqa: E501
323+
303324
self._created_timestamp = created_timestamp
304325

305326
def to_dict(self):

0 commit comments

Comments
 (0)