Skip to content

Commit 58cbf4f

Browse files
committed
feat: update retrieval and assistant
1 parent d0d957d commit 58cbf4f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1082
-3714
lines changed

Diff for: README.md

-32
Original file line numberDiff line numberDiff line change
@@ -138,38 +138,6 @@ taskingai.retrieval.delete_collection(collection_id=coll.collection_id)
138138
print("Collection deleted.")
139139
```
140140

141-
### Tools
142-
143-
The Tools module in TaskingAI is an essential suite designed to augment the capabilities of TaskingAI agents. Here is an example of how to create, run, and delete a tool action:
144-
145-
```python
146-
import taskingai
147-
148-
# Define a schema for the tool action
149-
OPENAPI_SCHEMA = {
150-
# Schema definition goes here
151-
}
152-
153-
# Create a tool action based on the defined schema
154-
actions = taskingai.tool.bulk_create_actions(
155-
openapi_schema=OPENAPI_SCHEMA,
156-
authentication={"type": "none"},
157-
)
158-
action = actions[0]
159-
print(f"Action created: {action.action_id}")
160-
161-
# Run the action for a test purpose
162-
result = taskingai.tool.run_action(
163-
action_id=action.action_id,
164-
parameters={"number": 42}
165-
)
166-
print(f"Action result: {result}")
167-
168-
# Delete the action when done
169-
taskingai.tool.delete_action(action_id=action.action_id)
170-
print("Action deleted.")
171-
```
172-
173141
## Contributing
174142

175143
We welcome contributions of all kinds. Please read our [Contributing Guidelines](./CONTRIBUTING.md) for more information on how to get started.

Diff for: examples/assistant/chat_with_assistant.ipynb

+105-128
Large diffs are not rendered by default.

Diff for: examples/crud/assistant_crud.ipynb

+64-11
Large diffs are not rendered by default.

Diff for: examples/crud/retrieval_crud.ipynb

+95-126
Large diffs are not rendered by default.

Diff for: examples/crud/tool_crud.ipynb

-233
This file was deleted.

Diff for: taskingai/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from .config import *
22
from . import assistant
3-
from . import tool
43
from . import retrieval
54
from . import inference
65
from . import file

Diff for: taskingai/assistant/chat.py

+26
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
"a_create_chat",
1616
"a_update_chat",
1717
"a_delete_chat",
18+
"clean_chat_context",
19+
"a_clean_chat_context",
1820
]
1921

2022

@@ -238,3 +240,27 @@ async def a_delete_chat(
238240
"""
239241

240242
await async_api_delete_chat(assistant_id=assistant_id, chat_id=chat_id)
243+
244+
245+
def clean_chat_context(assistant_id: str, chat_id: str) -> Message:
246+
"""
247+
Clean chat context.
248+
249+
:param assistant_id: The ID of the assistant.
250+
:param chat_id: The ID of the chat.
251+
"""
252+
253+
response = api_clean_chat_context(assistant_id=assistant_id, chat_id=chat_id)
254+
return response.data
255+
256+
257+
async def a_clean_chat_context(assistant_id: str, chat_id: str) -> Message:
258+
"""
259+
Clean chat context in async mode.
260+
261+
:param assistant_id: The ID of the assistant.
262+
:param chat_id: The ID of the chat.
263+
"""
264+
265+
response = await async_api_clean_chat_context(assistant_id=assistant_id, chat_id=chat_id)
266+
return response.data

Diff for: taskingai/assistant/memory.py

+2-14
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,10 @@
66
__all__ = [
77
"AssistantMemory",
88
"AssistantMemoryType",
9-
"AssistantNaiveMemory",
10-
"AssistantZeroMemory",
119
"AssistantMessageWindowMemory",
1210
]
1311

1412

15-
class AssistantNaiveMemory(AssistantMemory):
16-
def __init__(self):
17-
super().__init__(type=AssistantMemoryType.NAIVE)
18-
19-
20-
class AssistantZeroMemory(AssistantMemory):
21-
def __init__(self):
22-
super().__init__(type=AssistantMemoryType.ZERO)
23-
24-
2513
class AssistantMessageWindowMemory(AssistantMemory):
26-
def __init__(self, max_messages: int, max_tokens: int):
27-
super().__init__(type=AssistantMemoryType.MESSAGE_WINDOW, max_messages=max_messages, max_tokens=max_tokens)
14+
def __init__(self, max_tokens: int):
15+
super().__init__(type=AssistantMemoryType.MESSAGE_WINDOW, max_tokens=max_tokens)

Diff for: taskingai/client/apis/__init__.py

+1-11
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,33 @@
1111
License: Apache 2.0
1212
"""
1313

14-
from .api_bulk_create_actions import *
1514
from .api_chat_completion import *
15+
from .api_clean_chat_context import *
1616
from .api_create_assistant import *
1717
from .api_create_chat import *
18-
from .api_create_chunk import *
1918
from .api_create_collection import *
2019
from .api_create_message import *
2120
from .api_create_record import *
22-
from .api_delete_action import *
2321
from .api_delete_assistant import *
2422
from .api_delete_chat import *
25-
from .api_delete_chunk import *
2623
from .api_delete_collection import *
2724
from .api_delete_message import *
2825
from .api_delete_record import *
2926
from .api_generate_message import *
30-
from .api_get_action import *
3127
from .api_get_assistant import *
3228
from .api_get_chat import *
33-
from .api_get_chunk import *
3429
from .api_get_collection import *
3530
from .api_get_message import *
3631
from .api_get_record import *
37-
from .api_list_actions import *
3832
from .api_list_assistants import *
3933
from .api_list_chats import *
40-
from .api_list_chunks import *
4134
from .api_list_collections import *
4235
from .api_list_messages import *
4336
from .api_list_records import *
4437
from .api_query_collection_chunks import *
45-
from .api_run_action import *
4638
from .api_text_embedding import *
47-
from .api_update_action import *
4839
from .api_update_assistant import *
4940
from .api_update_chat import *
50-
from .api_update_chunk import *
5141
from .api_update_collection import *
5242
from .api_update_message import *
5343
from .api_update_record import *

0 commit comments

Comments
 (0)