|
230 | 230 | project_client.agents.delete_agent(agent.id) |
231 | 231 | print("Deleted agent") |
232 | 232 |
|
233 | | - |
234 | | - |
235 | | - |
236 | | -# # Upload the loan checklist file |
237 | | -# checklist_file = project_client.agents.upload_file_and_poll(file_path='./data/contoso_bank_loan_checklist.md', purpose=FilePurpose.AGENTS) |
238 | | -# print(f"Uploaded file, file ID: {checklist_file.id}") |
239 | | - |
240 | | -# # create a vector store with the file you uploaded |
241 | | -# vector_store = project_client.agents.create_vector_store_and_poll(file_ids=[checklist_file.id], name="my_vectorstore") |
242 | | -# print(f"Created vector store, vector store ID: {vector_store.id}") |
243 | | - |
244 | | -# # create a file search tool |
245 | | -# file_search_tool = FileSearchTool(vector_store_ids=[vector_store.id]) |
246 | | - |
247 | | -# # create a code interpreter tool |
248 | | -# code_interpreter = CodeInterpreterTool(file_ids=[checklist_file.id]) |
249 | | - |
250 | | -# # Upload a file for use with Code Interpreter and add it to the client |
251 | | -# file = project_client.agents.upload_file_and_poll( |
252 | | -# file_path="loan_product_eligibility_dataset.csv", purpose=FilePurpose.AGENTS |
253 | | -# ) |
254 | | -# print(f"Uploaded file, file ID: {file.id}") |
255 | | - |
256 | | -# # notices that FileSearchTool as tool and tool_resources must be added or the agent will be unable to search the file |
257 | | -# agent = project_client.agents.create_agent( |
258 | | -# model="gpt-4o-mini", |
259 | | -# name="home-loan-guide", |
260 | | -# instructions="", |
261 | | -# tools=file_search_tool.definitions, |
262 | | -# tool_resources=file_search_tool.resources, |
263 | | -# tools=code_interpreter.definitions, |
264 | | -# tool_resources=code_interpreter.resources, |
265 | | -# ) |
266 | | -# print(f"Created agent, agent ID: {agent.id}") |
267 | | - |
268 | | -# # Create a thread |
269 | | -# thread = project_client.agents.create_thread() |
270 | | -# print(f"Created thread, thread ID: {thread.id}") |
271 | | - |
272 | | -# # Upload the user provided file as a messsage attachment |
273 | | -# message_file = project_client.agents.upload_file_and_poll(file_path='contoso_bank_loan_checklist.md', purpose=FilePurpose.AGENTS) |
274 | | -# print(f"Uploaded file, file ID: {message_file.id}") |
275 | | - |
276 | | -# # Create a message with the file search attachment |
277 | | -# # Notice that vector store is created temporarily when using attachments with a default expiration policy of seven days. |
278 | | -# attachment = MessageAttachment(file_id=message_file.id, tools=FileSearchTool().definitions) |
279 | | -# message = project_client.agents.create_message( |
280 | | -# thread_id=thread.id, role="user", content="What documents do I need for a Contoso Bank loan?", attachments=[attachment] |
281 | | -# ) |
282 | | -# print(f"Created message, message ID: {message.id}") |
283 | | - |
284 | | -# run = project_client.agents.create_and_process_run(thread_id=thread.id, agent_id=agent.id) |
285 | | -# print(f"Created run, run ID: {run.id}") |
286 | | - |
287 | | -# project_client.agents.delete_vector_store(vector_store.id) |
288 | | -# print("Deleted vector store") |
289 | | - |
290 | | -# project_client.agents.delete_file(file.id) |
291 | | -# print("Deleted file") |
292 | | - |
293 | | -# project_client.agents.delete_agent(agent.id) |
294 | | -# print("Deleted agent") |
295 | | - |
296 | | -# messages = project_client.agents.list_messages(thread_id=thread.id) |
297 | | -# print(f"Messages: {messages}") |
0 commit comments