Skip to content

Commit 0bc5456

Browse files
jameszyaoSimsonW
authored andcommitted
refactor: replace old schemas with pydantic models
1 parent 905c84e commit 0bc5456

File tree

263 files changed

+7154
-19329
lines changed

Some content is hidden

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

263 files changed

+7154
-19329
lines changed

examples/assistant/chat_with_assistant.ipynb

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,12 @@
208208
"user_input = input(\"User Input: \")\n",
209209
"while user_input.strip() and user_input != \"q\":\n",
210210
" # create user message\n",
211-
" taskingai.assistant.create_message(\n",
211+
" user_message = taskingai.assistant.create_message(\n",
212212
" assistant_id=assistant.assistant_id,\n",
213213
" chat_id=chat.chat_id,\n",
214214
" text=user_input,\n",
215215
" )\n",
216-
" print(f\"User: {user_input}\")\n",
216+
" print(f\"User: {user_input} ({user_message.message_id})\")\n",
217217
" \n",
218218
" # generate assistant response\n",
219219
" assistant_message_response = taskingai.assistant.generate_message(\n",
@@ -230,8 +230,8 @@
230230
" if isinstance(item, MessageChunk):\n",
231231
" print(item.delta, end=\"\", flush=True)\n",
232232
" elif isinstance(item, Message):\n",
233-
" print(f\"\\nmessage_id: {item.message_id}\")\n",
234-
" \n",
233+
" print(f\" ({item.message_id})\")\n",
234+
" \n",
235235
" time.sleep(2)\n",
236236
" # quit by input 'q\n",
237237
" user_input = input(\"User: \")"
@@ -274,16 +274,6 @@
274274
"collapsed": false
275275
},
276276
"id": "ed39836bbfdc7a4e"
277-
},
278-
{
279-
"cell_type": "code",
280-
"execution_count": null,
281-
"outputs": [],
282-
"source": [],
283-
"metadata": {
284-
"collapsed": false
285-
},
286-
"id": "9cfed1128acbdd30"
287277
}
288278
],
289279
"metadata": {

examples/crud/assistant_crud.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@
166166
" assistant_id=assistant.assistant_id,\n",
167167
" chat_id=chat_id,\n",
168168
")\n",
169-
"print(f\"got chat: {chat}\\n\")"
169+
"print(f\"chat: {chat}\\n\")"
170170
],
171171
"metadata": {
172172
"collapsed": false

examples/crud/retrieval_crud.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"from taskingai.retrieval import Collection, Record, TokenTextSplitter\n",
3232
"\n",
3333
"# choose an available text_embedding model from your project\n",
34-
"embedding_model_id = \"YOUR_MODEL_ID\""
34+
"embedding_model_id = \"YOUR_EMBEDDING_MODEL_ID\""
3535
],
3636
"metadata": {
3737
"collapsed": false
@@ -93,7 +93,7 @@
9393
" collection_id=collection_id\n",
9494
")\n",
9595
"\n",
96-
"print(f\"got collection: {collection}\\n\")"
96+
"print(f\"collection: {collection}\\n\")"
9797
],
9898
"metadata": {
9999
"collapsed": false

examples/crud/tool_crud.ipynb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,16 @@
197197
"collapsed": false
198198
},
199199
"id": "5a1a36d15055918f"
200+
},
201+
{
202+
"cell_type": "code",
203+
"execution_count": null,
204+
"outputs": [],
205+
"source": [],
206+
"metadata": {
207+
"collapsed": false
208+
},
209+
"id": "5588d5e7457225be"
200210
}
201211
],
202212
"metadata": {

examples/retrieval/semantic_search.ipynb

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"outputs": [],
4242
"source": [
4343
"# choose an available text_embedding model from your project\n",
44-
"embedding_model_id = \"YOUR_MODEL_ID\""
44+
"embedding_model_id = \"YOUR_EMBEDDING_MODEL_ID\""
4545
],
4646
"metadata": {
4747
"collapsed": false
@@ -224,6 +224,16 @@
224224
"collapsed": false
225225
},
226226
"id": "fc9c1fa12d893dd1"
227+
},
228+
{
229+
"cell_type": "code",
230+
"execution_count": null,
231+
"outputs": [],
232+
"source": [],
233+
"metadata": {
234+
"collapsed": false
235+
},
236+
"id": "e0eb39fcac309768"
227237
}
228238
],
229239
"metadata": {

0 commit comments

Comments
 (0)