From ff96db394e67b55d5465623da52538b38256da3c Mon Sep 17 00:00:00 2001 From: Asghar Ibraheem Baloch Date: Mon, 3 Jun 2024 14:46:09 +0500 Subject: [PATCH] Update assistants_knowledge_retrieval.ipynb add vector store and assistant update function because assitant function is not directly accepting file id --- .../assistants_knowledge_retrieval.ipynb | 27 +++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/06_chatgpt/07_assistants_knowledge_retrieval/assistants_knowledge_retrieval.ipynb b/06_chatgpt/07_assistants_knowledge_retrieval/assistants_knowledge_retrieval.ipynb index 9a17e7ad..f0a2cf4e 100644 --- a/06_chatgpt/07_assistants_knowledge_retrieval/assistants_knowledge_retrieval.ipynb +++ b/06_chatgpt/07_assistants_knowledge_retrieval/assistants_knowledge_retrieval.ipynb @@ -131,11 +131,34 @@ " name=\"Student Support Assistant\",\n", " instructions=\"You are a student support chatbot. Use your knowledge base to best respond to student queries about Zia U. Khan.\",\n", " model=\"gpt-3.5-turbo-1106\",\n", - " tools=[{\"type\": \"retrieval\"}],\n", - " file_ids=[file.id]\n", + " tools=[{\"type\": \"file_search\"}],\n", ")\n" ] }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "vector_store = client.beta.vector_stores.create(\n", + " name=\"sir zia Documentation\",\n", + " file_ids=[file.id]\n", + ")" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "assistant = client.beta.assistants.update(\n", + " assistant_id=assistant.id,\n", + " tool_resources={\"file_search\": {\"vector_store_ids\": [vector_store.id]}},\n", + ")" + ] + }, { "cell_type": "markdown", "metadata": {},