Skip to content
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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ NUMBERS_API_SCHEMA = {
# Create a tool action based on the defined schema
actions = bulk_create_actions(
schema=NUMBERS_API_SCHEMA,
authentication=ActionAuthentication(type=ActionAuthenticationType.none)
authentication=ActionAuthentication(type=ActionAuthenticationType.NONE)
)
action = actions[0]
print(f"Action created: {action.id}")
Expand Down
14 changes: 2 additions & 12 deletions examples/assistant/chat_with_assistant.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@
"actions: List[Action] = taskingai.tool.bulk_create_actions(\n",
" schema=NUMBERS_API_SCHEMA,\n",
" authentication=ActionAuthentication(\n",
" type=ActionAuthenticationType.none,\n",
" type=ActionAuthenticationType.NONE,\n",
" )\n",
")\n",
"action = actions[0]\n",
Expand Down Expand Up @@ -128,7 +128,7 @@
" \"No matter what the user's language is, you will use the {{langugae}} to explain.\"\n",
" ],\n",
" tools=[AssistantTool(\n",
" type=AssistantToolType.action,\n",
" type=AssistantToolType.ACTION,\n",
" id=action.action_id,\n",
" )],\n",
" retrievals=[],\n",
Expand Down Expand Up @@ -291,16 +291,6 @@
"collapsed": false
},
"id": "e94e3adb0d15373b"
},
{
"cell_type": "code",
"execution_count": null,
"outputs": [],
"source": [],
"metadata": {
"collapsed": false
},
"id": "6380260c47c9a4c"
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion examples/crud/tool_crud.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"actions: List[Action] = taskingai.tool.bulk_create_actions(\n",
" schema=NUMBERS_API_SCHEMA,\n",
" authentication=ActionAuthentication(\n",
" type=ActionAuthenticationType.none,\n",
" type=ActionAuthenticationType.NONE,\n",
" )\n",
")\n",
"action = actions[0]\n",
Expand Down
3 changes: 2 additions & 1 deletion taskingai/_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
__title__ = "taskingai"
__version__ = "0.0.7"
__version__ = "0.0.9"

20 changes: 10 additions & 10 deletions taskingai/assistant/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def list_assistants(
if after and before:
raise ValueError("Only one of after and before can be specified.")

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
# only add non-None parameters
params = {
"order": order,
Expand Down Expand Up @@ -91,7 +91,7 @@ async def a_list_assistants(
if after and before:
raise ValueError("Only one of after and before can be specified.")

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
# only add non-None parameters
params = {
"order": order,
Expand All @@ -113,7 +113,7 @@ def get_assistant(assistant_id: str) -> Assistant:
:param assistant_id: The ID of the assistant.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
response: AssistantGetResponse = api_instance.get_assistant(assistant_id=assistant_id)
assistant: Assistant = Assistant(**response.data)
return assistant
Expand All @@ -126,7 +126,7 @@ async def a_get_assistant(assistant_id: str) -> Assistant:
:param assistant_id: The ID of the assistant.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
response: AssistantGetResponse = await api_instance.get_assistant(assistant_id=assistant_id)
assistant: Assistant = Assistant(**response.data)
return assistant
Expand Down Expand Up @@ -156,7 +156,7 @@ def create_assistant(
:return: The created assistant object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
memory_dict = memory.model_dump()
body = AssistantCreateRequest(
model_id=model_id,
Expand Down Expand Up @@ -197,7 +197,7 @@ async def a_create_assistant(
:return: The created assistant object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
memory_dict = memory.model_dump()
body = AssistantCreateRequest(
model_id=model_id,
Expand Down Expand Up @@ -240,7 +240,7 @@ def update_assistant(
:return: The updated assistant object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
body = AssistantUpdateRequest(
model_id=model_id,
name=name,
Expand Down Expand Up @@ -282,7 +282,7 @@ async def a_update_assistant(
:return: The updated assistant object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
body = AssistantUpdateRequest(
model_id=model_id,
name=name,
Expand All @@ -305,7 +305,7 @@ def delete_assistant(assistant_id: str) -> None:
:param assistant_id: The ID of the assistant.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
api_instance.delete_assistant(assistant_id=assistant_id)


Expand All @@ -316,6 +316,6 @@ async def a_delete_assistant(assistant_id: str) -> None:
:param assistant_id: The ID of the assistant.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
await api_instance.delete_assistant(assistant_id=assistant_id)

20 changes: 10 additions & 10 deletions taskingai/assistant/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def list_chats(
if after and before:
raise ValueError("Only one of after and before can be specified.")

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
# only add non-None parameters
params = {
"order": order,
Expand Down Expand Up @@ -76,7 +76,7 @@ async def a_list_chats(
if after and before:
raise ValueError("Only one of after and before can be specified.")

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
# only add non-None parameters
params = {
"order": order,
Expand All @@ -101,7 +101,7 @@ def get_chat(assistant_id: str, chat_id: str) -> Chat:
:param chat_id: The ID of the chat.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
response: ChatGetResponse = api_instance.get_chat(
assistant_id=assistant_id,
chat_id=chat_id,
Expand All @@ -118,7 +118,7 @@ async def a_get_chat(assistant_id: str, chat_id: str) -> Chat:
:param chat_id: The ID of the chat.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
response: ChatGetResponse = await api_instance.get_chat(
assistant_id=assistant_id,
chat_id=chat_id,
Expand All @@ -139,7 +139,7 @@ def create_chat(
:return: The created chat object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
body = ChatCreateRequest(
metadata=metadata,
)
Expand All @@ -163,7 +163,7 @@ async def a_create_chat(
:return: The created chat object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
body = ChatCreateRequest(
metadata=metadata,
)
Expand All @@ -189,7 +189,7 @@ def update_chat(
:return: The updated chat object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
body = ChatUpdateRequest(
metadata=metadata,
)
Expand All @@ -216,7 +216,7 @@ async def a_update_chat(
:return: The updated chat object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
body = ChatUpdateRequest(
metadata=metadata,
)
Expand All @@ -240,7 +240,7 @@ def delete_chat(
:param chat_id: The ID of the chat.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
api_instance.delete_chat(assistant_id=assistant_id, chat_id=chat_id)


Expand All @@ -255,7 +255,7 @@ async def a_delete_chat(
:param chat_id: The ID of the chat.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
await api_instance.delete_chat(assistant_id=assistant_id, chat_id=chat_id)


Expand Down
24 changes: 12 additions & 12 deletions taskingai/assistant/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def list_messages(
if after and before:
raise ValueError("Only one of after and before can be specified.")

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
# only add non-None parameters
params = {
"order": order,
Expand Down Expand Up @@ -96,7 +96,7 @@ async def a_list_messages(
if after and before:
raise ValueError("Only one of after and before can be specified.")

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
# only add non-None parameters
params = {
"order": order,
Expand Down Expand Up @@ -127,7 +127,7 @@ def get_message(
:param message_id: The ID of the message.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
response: MessageGetResponse = api_instance.get_message(
assistant_id=assistant_id,
chat_id=chat_id,
Expand All @@ -150,7 +150,7 @@ async def a_get_message(
:param message_id: The ID of the message.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
response: MessageGetResponse = await api_instance.get_message(
assistant_id=assistant_id,
chat_id=chat_id,
Expand All @@ -177,9 +177,9 @@ def create_message(
:return: The created message object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
body = MessageCreateRequest(
role=MessageRole.user,
role=MessageRole.USER,
content=MessageContent(text=text),
metadata=metadata,
)
Expand Down Expand Up @@ -208,9 +208,9 @@ async def a_create_message(
:return: The created message object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
body = MessageCreateRequest(
role=MessageRole.user,
role=MessageRole.USER,
content=MessageContent(text=text),
metadata=metadata,
)
Expand Down Expand Up @@ -238,7 +238,7 @@ def update_message(
:return: The updated message object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
body = MessageUpdateRequest(
metadata=metadata,
)
Expand Down Expand Up @@ -267,7 +267,7 @@ async def a_update_message(
:return: The updated message object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
body = MessageUpdateRequest(
metadata=metadata,
)
Expand Down Expand Up @@ -298,7 +298,7 @@ def generate_message(
:return: The generated message object.
"""

api_instance = get_api_instance(ModuleType.assistant)
api_instance = get_api_instance(ModuleType.ASSISTANT)
body = MessageGenerateRequest(
system_prompt_variables=system_prompt_variables,
stream=stream,
Expand Down Expand Up @@ -339,7 +339,7 @@ async def a_generate_message(
:return: The generated message object.
"""

api_instance = get_api_instance(ModuleType.assistant, async_client=True)
api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True)
body = MessageGenerateRequest(
system_prompt_variables=system_prompt_variables,
stream=stream,
Expand Down
8 changes: 4 additions & 4 deletions taskingai/client/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
DEFAULT_PARENT_LOGGER_LEVEL = 'ERROR'

class ModuleType(str, Enum):
assistant = "assistant"
tool = "tool"
retrieval = "retrieval"
inference = "inference"
ASSISTANT = "assistant"
TOOL = "tool"
RETRIEVAL = "retrieval"
INFERENCE = "inference"



Expand Down
6 changes: 3 additions & 3 deletions taskingai/client/models/entity/assistant/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@


class AssistantToolType(str, Enum):
action = "action"
function = "function"
ACTION = "action"
FUNCTION = "function"


class AssistantRetrievalType(str, Enum):
collection = "collection"
COLLECTION = "collection"


class AssistantRetrieval(TaskingaiBaseModel):
Expand Down
Loading