From 2827b789b1855e967c0f0c9aec9db4f265670775 Mon Sep 17 00:00:00 2001 From: jameszyao Date: Sun, 3 Mar 2024 16:07:06 +0800 Subject: [PATCH 1/4] refactor: replace old schemas with pydantic models --- examples/assistant/chat_with_assistant.ipynb | 18 +- examples/crud/assistant_crud.ipynb | 2 +- examples/crud/retrieval_crud.ipynb | 4 +- examples/crud/tool_crud.ipynb | 10 + examples/retrieval/semantic_search.ipynb | 12 +- taskingai/assistant/assistant.py | 159 +- taskingai/assistant/chat.py | 112 +- taskingai/assistant/memory.py | 20 +- taskingai/assistant/message.py | 182 +- taskingai/client/api/__init__.py | 16 - taskingai/client/api/assistant_api.py | 1629 ---------------- taskingai/client/api/assistant_async_api.py | 1631 ----------------- taskingai/client/api/inference_api.py | 203 -- taskingai/client/api/inference_async_api.py | 207 --- taskingai/client/api/retrieval_api.py | 1135 ------------ taskingai/client/api/retrieval_async_api.py | 1135 ------------ taskingai/client/api/tool_api.py | 1118 ----------- taskingai/client/api/tool_async_api.py | 1118 ----------- taskingai/client/api_client.py | 841 ++++----- taskingai/client/apis/__init__.py | 54 + .../client/apis/api_bulk_create_actions.py | 78 + taskingai/client/apis/api_chat_completion.py | 78 + taskingai/client/apis/api_create_assistant.py | 78 + taskingai/client/apis/api_create_chat.py | 82 + taskingai/client/apis/api_create_chunk.py | 82 + .../client/apis/api_create_collection.py | 78 + taskingai/client/apis/api_create_message.py | 88 + taskingai/client/apis/api_create_record.py | 82 + taskingai/client/apis/api_delete_action.py | 82 + taskingai/client/apis/api_delete_assistant.py | 82 + taskingai/client/apis/api_delete_chat.py | 84 + taskingai/client/apis/api_delete_chunk.py | 84 + .../client/apis/api_delete_collection.py | 82 + taskingai/client/apis/api_delete_message.py | 86 + taskingai/client/apis/api_delete_record.py | 84 + taskingai/client/apis/api_generate_message.py | 88 + taskingai/client/apis/api_get_action.py | 82 + taskingai/client/apis/api_get_assistant.py | 82 + taskingai/client/apis/api_get_chat.py | 84 + taskingai/client/apis/api_get_chunk.py | 84 + taskingai/client/apis/api_get_collection.py | 82 + taskingai/client/apis/api_get_message.py | 86 + taskingai/client/apis/api_get_record.py | 84 + taskingai/client/apis/api_list_actions.py | 78 + taskingai/client/apis/api_list_assistants.py | 78 + taskingai/client/apis/api_list_chats.py | 82 + taskingai/client/apis/api_list_chunks.py | 82 + taskingai/client/apis/api_list_collections.py | 78 + taskingai/client/apis/api_list_messages.py | 86 + taskingai/client/apis/api_list_records.py | 82 + .../apis/api_query_collection_chunks.py | 84 + taskingai/client/apis/api_run_action.py | 82 + taskingai/client/apis/api_text_embedding.py | 78 + taskingai/client/apis/api_update_action.py | 82 + taskingai/client/apis/api_update_assistant.py | 84 + taskingai/client/apis/api_update_chat.py | 86 + taskingai/client/apis/api_update_chunk.py | 86 + .../client/apis/api_update_collection.py | 84 + taskingai/client/apis/api_update_message.py | 90 + taskingai/client/apis/api_update_record.py | 88 + taskingai/client/constants.py | 17 +- taskingai/client/models/__init__.py | 90 +- taskingai/client/models/entities/__init__.py | 60 + taskingai/client/models/entities/action.py | 43 + .../models/entities/action_authentication.py | 25 + .../entities/action_authentication_type.py | 24 + .../models/entities/action_body_type.py | 23 + .../client/models/entities/action_method.py | 26 + .../client/models/entities/action_param.py | 26 + taskingai/client/models/entities/assistant.py | 37 + .../models/entities/assistant_memory.py | 25 + .../models/entities/assistant_memory_type.py | 23 + taskingai/client/models/entities/chat.py | 27 + .../client/models/entities/chat_completion.py | 25 + .../chat_completion_assistant_message.py | 26 + .../models/entities/chat_completion_chunk.py | 25 + .../entities/chat_completion_finish_reason.py | 26 + .../entities/chat_completion_function.py | 24 + .../entities/chat_completion_function_call.py | 25 + .../chat_completion_function_message.py | 25 + .../chat_completion_function_parameters.py | 25 + ...completion_function_parameters_property.py | 25 + .../entities/chat_completion_message.py | 23 + .../models/entities/chat_completion_role.py | 24 + .../chat_completion_system_message.py | 24 + .../entities/chat_completion_user_message.py | 24 + .../client/models/entities/chat_memory.py | 27 + .../models/entities/chat_memory_message.py | 25 + taskingai/client/models/entities/chunk.py | 31 + .../client/models/entities/collection.py | 33 + taskingai/client/models/entities/message.py | 30 + .../client/models/entities/message_chunk.py | 25 + .../client/models/entities/message_content.py | 22 + .../models/entities/message_generation_log.py | 28 + .../client/models/entities/message_role.py | 22 + taskingai/client/models/entities/record.py | 33 + .../client/models/entities/record_type.py | 21 + .../models/entities/retrieval_config.py | 26 + .../models/entities/retrieval_method.py | 23 + .../client/models/entities/retrieval_ref.py | 23 + .../client/models/entities/retrieval_type.py | 21 + .../client/models/entities/sort_order_enum.py | 22 + taskingai/client/models/entities/status.py | 25 + .../entities/text_embedding_input_type.py | 22 + .../models/entities/text_embedding_output.py | 24 + .../client/models/entities/text_splitter.py | 25 + .../models/entities/text_splitter_type.py | 21 + taskingai/client/models/entities/tool_ref.py | 23 + taskingai/client/models/entities/tool_type.py | 22 + taskingai/client/models/entity/__init__.py | 0 taskingai/client/models/entity/_base.py | 22 - .../models/entity/assistant/__init__.py | 0 .../models/entity/assistant/assistant.py | 59 - .../entity/assistant/assistant_memory.py | 61 - .../client/models/entity/assistant/chat.py | 13 - .../client/models/entity/assistant/message.py | 33 - .../models/entity/inference/__init__.py | 0 .../entity/inference/chat_completion.py | 92 - .../models/entity/inference/text_embedding.py | 29 - .../models/entity/retrieval/__init__.py | 0 .../client/models/entity/retrieval/chunk.py | 14 - .../models/entity/retrieval/collection.py | 20 - .../client/models/entity/retrieval/record.py | 18 - .../models/entity/retrieval/text_splitter.py | 53 - .../client/models/entity/tool/__init__.py | 0 taskingai/client/models/entity/tool/action.py | 36 - .../client/models/entity/tool/function.py | 22 - taskingai/client/models/rest/__init__.py | 0 .../models/rest/action_bulk_create_request.py | 131 -- .../rest/action_bulk_create_response.py | 138 -- .../models/rest/action_delete_response.py | 109 -- .../client/models/rest/action_get_response.py | 138 -- .../models/rest/action_list_response.py | 196 -- .../client/models/rest/action_run_request.py | 106 -- .../client/models/rest/action_run_response.py | 138 -- .../models/rest/action_update_request.py | 130 -- .../models/rest/action_update_response.py | 138 -- .../models/rest/assistant_create_request.py | 304 --- .../models/rest/assistant_create_response.py | 138 -- .../models/rest/assistant_delete_response.py | 109 -- .../models/rest/assistant_get_response.py | 138 -- .../models/rest/assistant_list_response.py | 196 -- .../models/rest/assistant_update_request.py | 304 --- .../models/rest/assistant_update_response.py | 138 -- .../models/rest/chat_completion_request.py | 248 --- .../models/rest/chat_completion_response.py | 142 -- .../client/models/rest/chat_create_request.py | 108 -- .../models/rest/chat_create_response.py | 138 -- .../models/rest/chat_delete_response.py | 109 -- .../client/models/rest/chat_get_response.py | 138 -- .../client/models/rest/chat_list_response.py | 196 -- .../client/models/rest/chat_update_request.py | 108 -- .../models/rest/chat_update_response.py | 138 -- .../client/models/rest/chunk_query_request.py | 138 -- .../models/rest/chunk_query_response.py | 167 -- .../models/rest/collection_create_request.py | 223 --- .../models/rest/collection_create_response.py | 138 -- .../models/rest/collection_get_response.py | 138 -- .../models/rest/collection_list_response.py | 196 -- .../models/rest/collection_update_request.py | 164 -- .../models/rest/collection_update_response.py | 138 -- .../models/rest/delete_collection_response.py | 109 -- .../models/rest/function_create_request.py | 167 -- .../models/rest/function_create_response.py | 138 -- .../models/rest/function_delete_response.py | 109 -- .../models/rest/function_get_response.py | 138 -- .../models/rest/function_list_response.py | 196 -- .../models/rest/function_update_request.py | 164 -- .../models/rest/function_update_response.py | 138 -- .../models/rest/http_validation_error.py | 106 -- .../models/rest/message_create_request.py | 166 -- .../models/rest/message_create_response.py | 138 -- .../models/rest/message_generate_request.py | 143 -- .../models/rest/message_generate_response.py | 140 -- .../models/rest/message_get_response.py | 138 -- .../models/rest/message_list_response.py | 196 -- .../models/rest/message_update_request.py | 108 -- .../models/rest/message_update_response.py | 138 -- .../models/rest/record_create_request.py | 181 -- .../models/rest/record_create_response.py | 138 -- .../models/rest/record_delete_response.py | 109 -- .../client/models/rest/record_get_response.py | 138 -- .../models/rest/record_list_response.py | 196 -- .../models/rest/record_update_request.py | 182 -- .../models/rest/record_update_response.py | 138 -- .../models/rest/text_embedding_request.py | 138 -- .../models/rest/text_embedding_response.py | 138 -- .../client/models/rest/validation_error.py | 161 -- taskingai/client/models/schemas/__init__.py | 74 + .../schemas/action_bulk_create_request.py | 24 + .../schemas/action_bulk_create_response.py | 24 + .../models/schemas/action_get_response.py | 23 + .../models/schemas/action_list_request.py | 26 + .../models/schemas/action_list_response.py | 26 + .../models/schemas/action_run_request.py | 23 + .../models/schemas/action_run_response.py | 24 + .../models/schemas/action_update_request.py | 24 + .../models/schemas/action_update_response.py | 23 + .../schemas/assistant_create_request.py | 34 + .../schemas/assistant_create_response.py | 23 + .../models/schemas/assistant_get_response.py | 23 + .../models/schemas/assistant_list_request.py | 26 + .../models/schemas/assistant_list_response.py | 26 + .../schemas/assistant_update_request.py | 34 + .../schemas/assistant_update_response.py | 23 + .../models/schemas/base_empty_response.py | 22 + .../models/schemas/chat_completion_request.py | 39 + .../schemas/chat_completion_response.py | 23 + .../models/schemas/chat_create_request.py | 23 + .../models/schemas/chat_create_response.py | 23 + .../models/schemas/chat_get_response.py | 23 + .../models/schemas/chat_list_request.py | 26 + .../models/schemas/chat_list_response.py | 26 + .../models/schemas/chat_update_request.py | 23 + .../models/schemas/chat_update_response.py | 23 + .../models/schemas/chunk_create_request.py | 24 + .../models/schemas/chunk_create_response.py | 23 + .../models/schemas/chunk_get_response.py | 23 + .../models/schemas/chunk_list_request.py | 26 + .../models/schemas/chunk_list_response.py | 26 + .../models/schemas/chunk_query_request.py | 23 + .../models/schemas/chunk_query_response.py | 25 + .../models/schemas/chunk_update_request.py | 24 + .../models/schemas/chunk_update_response.py | 23 + .../schemas/collection_create_request.py | 27 + .../schemas/collection_create_response.py | 23 + .../models/schemas/collection_get_response.py | 23 + .../models/schemas/collection_list_request.py | 26 + .../schemas/collection_list_response.py | 26 + .../schemas/collection_update_request.py | 25 + .../schemas/collection_update_response.py | 23 + .../models/schemas/message_create_request.py | 25 + .../models/schemas/message_create_response.py | 23 + .../schemas/message_generate_request.py | 25 + .../schemas/message_generate_response.py | 23 + .../models/schemas/message_get_response.py | 23 + .../models/schemas/message_list_request.py | 26 + .../models/schemas/message_list_response.py | 26 + .../models/schemas/message_update_request.py | 23 + .../models/schemas/message_update_response.py | 23 + .../models/schemas/record_create_request.py | 28 + .../models/schemas/record_create_response.py | 23 + .../models/schemas/record_get_response.py | 23 + .../models/schemas/record_list_request.py | 26 + .../models/schemas/record_list_response.py | 26 + .../models/schemas/record_update_request.py | 28 + .../models/schemas/record_update_response.py | 23 + .../models/schemas/text_embedding_request.py | 25 + .../models/schemas/text_embedding_response.py | 24 + taskingai/client/stream.py | 13 +- taskingai/client/stream_apis/__init__.py | 16 + .../stream_apis/stream_api_chat_completion.py | 80 + .../stream_api_message_generation.py | 89 + taskingai/client/utils.py | 94 +- taskingai/inference/chat_completion.py | 109 +- taskingai/inference/text_embedding.py | 50 +- taskingai/retrieval/chunk.py | 35 +- taskingai/retrieval/collection.py | 105 +- taskingai/retrieval/record.py | 100 +- taskingai/retrieval/text_splitter.py | 11 +- taskingai/tool/__init__.py | 1 - taskingai/tool/action.py | 111 +- taskingai/tool/function.py | 245 --- 263 files changed, 7154 insertions(+), 19329 deletions(-) delete mode 100644 taskingai/client/api/__init__.py delete mode 100644 taskingai/client/api/assistant_api.py delete mode 100644 taskingai/client/api/assistant_async_api.py delete mode 100644 taskingai/client/api/inference_api.py delete mode 100644 taskingai/client/api/inference_async_api.py delete mode 100644 taskingai/client/api/retrieval_api.py delete mode 100644 taskingai/client/api/retrieval_async_api.py delete mode 100644 taskingai/client/api/tool_api.py delete mode 100644 taskingai/client/api/tool_async_api.py create mode 100644 taskingai/client/apis/__init__.py create mode 100644 taskingai/client/apis/api_bulk_create_actions.py create mode 100644 taskingai/client/apis/api_chat_completion.py create mode 100644 taskingai/client/apis/api_create_assistant.py create mode 100644 taskingai/client/apis/api_create_chat.py create mode 100644 taskingai/client/apis/api_create_chunk.py create mode 100644 taskingai/client/apis/api_create_collection.py create mode 100644 taskingai/client/apis/api_create_message.py create mode 100644 taskingai/client/apis/api_create_record.py create mode 100644 taskingai/client/apis/api_delete_action.py create mode 100644 taskingai/client/apis/api_delete_assistant.py create mode 100644 taskingai/client/apis/api_delete_chat.py create mode 100644 taskingai/client/apis/api_delete_chunk.py create mode 100644 taskingai/client/apis/api_delete_collection.py create mode 100644 taskingai/client/apis/api_delete_message.py create mode 100644 taskingai/client/apis/api_delete_record.py create mode 100644 taskingai/client/apis/api_generate_message.py create mode 100644 taskingai/client/apis/api_get_action.py create mode 100644 taskingai/client/apis/api_get_assistant.py create mode 100644 taskingai/client/apis/api_get_chat.py create mode 100644 taskingai/client/apis/api_get_chunk.py create mode 100644 taskingai/client/apis/api_get_collection.py create mode 100644 taskingai/client/apis/api_get_message.py create mode 100644 taskingai/client/apis/api_get_record.py create mode 100644 taskingai/client/apis/api_list_actions.py create mode 100644 taskingai/client/apis/api_list_assistants.py create mode 100644 taskingai/client/apis/api_list_chats.py create mode 100644 taskingai/client/apis/api_list_chunks.py create mode 100644 taskingai/client/apis/api_list_collections.py create mode 100644 taskingai/client/apis/api_list_messages.py create mode 100644 taskingai/client/apis/api_list_records.py create mode 100644 taskingai/client/apis/api_query_collection_chunks.py create mode 100644 taskingai/client/apis/api_run_action.py create mode 100644 taskingai/client/apis/api_text_embedding.py create mode 100644 taskingai/client/apis/api_update_action.py create mode 100644 taskingai/client/apis/api_update_assistant.py create mode 100644 taskingai/client/apis/api_update_chat.py create mode 100644 taskingai/client/apis/api_update_chunk.py create mode 100644 taskingai/client/apis/api_update_collection.py create mode 100644 taskingai/client/apis/api_update_message.py create mode 100644 taskingai/client/apis/api_update_record.py create mode 100644 taskingai/client/models/entities/__init__.py create mode 100644 taskingai/client/models/entities/action.py create mode 100644 taskingai/client/models/entities/action_authentication.py create mode 100644 taskingai/client/models/entities/action_authentication_type.py create mode 100644 taskingai/client/models/entities/action_body_type.py create mode 100644 taskingai/client/models/entities/action_method.py create mode 100644 taskingai/client/models/entities/action_param.py create mode 100644 taskingai/client/models/entities/assistant.py create mode 100644 taskingai/client/models/entities/assistant_memory.py create mode 100644 taskingai/client/models/entities/assistant_memory_type.py create mode 100644 taskingai/client/models/entities/chat.py create mode 100644 taskingai/client/models/entities/chat_completion.py create mode 100644 taskingai/client/models/entities/chat_completion_assistant_message.py create mode 100644 taskingai/client/models/entities/chat_completion_chunk.py create mode 100644 taskingai/client/models/entities/chat_completion_finish_reason.py create mode 100644 taskingai/client/models/entities/chat_completion_function.py create mode 100644 taskingai/client/models/entities/chat_completion_function_call.py create mode 100644 taskingai/client/models/entities/chat_completion_function_message.py create mode 100644 taskingai/client/models/entities/chat_completion_function_parameters.py create mode 100644 taskingai/client/models/entities/chat_completion_function_parameters_property.py create mode 100644 taskingai/client/models/entities/chat_completion_message.py create mode 100644 taskingai/client/models/entities/chat_completion_role.py create mode 100644 taskingai/client/models/entities/chat_completion_system_message.py create mode 100644 taskingai/client/models/entities/chat_completion_user_message.py create mode 100644 taskingai/client/models/entities/chat_memory.py create mode 100644 taskingai/client/models/entities/chat_memory_message.py create mode 100644 taskingai/client/models/entities/chunk.py create mode 100644 taskingai/client/models/entities/collection.py create mode 100644 taskingai/client/models/entities/message.py create mode 100644 taskingai/client/models/entities/message_chunk.py create mode 100644 taskingai/client/models/entities/message_content.py create mode 100644 taskingai/client/models/entities/message_generation_log.py create mode 100644 taskingai/client/models/entities/message_role.py create mode 100644 taskingai/client/models/entities/record.py create mode 100644 taskingai/client/models/entities/record_type.py create mode 100644 taskingai/client/models/entities/retrieval_config.py create mode 100644 taskingai/client/models/entities/retrieval_method.py create mode 100644 taskingai/client/models/entities/retrieval_ref.py create mode 100644 taskingai/client/models/entities/retrieval_type.py create mode 100644 taskingai/client/models/entities/sort_order_enum.py create mode 100644 taskingai/client/models/entities/status.py create mode 100644 taskingai/client/models/entities/text_embedding_input_type.py create mode 100644 taskingai/client/models/entities/text_embedding_output.py create mode 100644 taskingai/client/models/entities/text_splitter.py create mode 100644 taskingai/client/models/entities/text_splitter_type.py create mode 100644 taskingai/client/models/entities/tool_ref.py create mode 100644 taskingai/client/models/entities/tool_type.py delete mode 100644 taskingai/client/models/entity/__init__.py delete mode 100644 taskingai/client/models/entity/_base.py delete mode 100644 taskingai/client/models/entity/assistant/__init__.py delete mode 100644 taskingai/client/models/entity/assistant/assistant.py delete mode 100644 taskingai/client/models/entity/assistant/assistant_memory.py delete mode 100644 taskingai/client/models/entity/assistant/chat.py delete mode 100644 taskingai/client/models/entity/assistant/message.py delete mode 100644 taskingai/client/models/entity/inference/__init__.py delete mode 100644 taskingai/client/models/entity/inference/chat_completion.py delete mode 100644 taskingai/client/models/entity/inference/text_embedding.py delete mode 100644 taskingai/client/models/entity/retrieval/__init__.py delete mode 100644 taskingai/client/models/entity/retrieval/chunk.py delete mode 100644 taskingai/client/models/entity/retrieval/collection.py delete mode 100644 taskingai/client/models/entity/retrieval/record.py delete mode 100644 taskingai/client/models/entity/retrieval/text_splitter.py delete mode 100644 taskingai/client/models/entity/tool/__init__.py delete mode 100644 taskingai/client/models/entity/tool/action.py delete mode 100644 taskingai/client/models/entity/tool/function.py delete mode 100644 taskingai/client/models/rest/__init__.py delete mode 100644 taskingai/client/models/rest/action_bulk_create_request.py delete mode 100644 taskingai/client/models/rest/action_bulk_create_response.py delete mode 100644 taskingai/client/models/rest/action_delete_response.py delete mode 100644 taskingai/client/models/rest/action_get_response.py delete mode 100644 taskingai/client/models/rest/action_list_response.py delete mode 100644 taskingai/client/models/rest/action_run_request.py delete mode 100644 taskingai/client/models/rest/action_run_response.py delete mode 100644 taskingai/client/models/rest/action_update_request.py delete mode 100644 taskingai/client/models/rest/action_update_response.py delete mode 100644 taskingai/client/models/rest/assistant_create_request.py delete mode 100644 taskingai/client/models/rest/assistant_create_response.py delete mode 100644 taskingai/client/models/rest/assistant_delete_response.py delete mode 100644 taskingai/client/models/rest/assistant_get_response.py delete mode 100644 taskingai/client/models/rest/assistant_list_response.py delete mode 100644 taskingai/client/models/rest/assistant_update_request.py delete mode 100644 taskingai/client/models/rest/assistant_update_response.py delete mode 100644 taskingai/client/models/rest/chat_completion_request.py delete mode 100644 taskingai/client/models/rest/chat_completion_response.py delete mode 100644 taskingai/client/models/rest/chat_create_request.py delete mode 100644 taskingai/client/models/rest/chat_create_response.py delete mode 100644 taskingai/client/models/rest/chat_delete_response.py delete mode 100644 taskingai/client/models/rest/chat_get_response.py delete mode 100644 taskingai/client/models/rest/chat_list_response.py delete mode 100644 taskingai/client/models/rest/chat_update_request.py delete mode 100644 taskingai/client/models/rest/chat_update_response.py delete mode 100644 taskingai/client/models/rest/chunk_query_request.py delete mode 100644 taskingai/client/models/rest/chunk_query_response.py delete mode 100644 taskingai/client/models/rest/collection_create_request.py delete mode 100644 taskingai/client/models/rest/collection_create_response.py delete mode 100644 taskingai/client/models/rest/collection_get_response.py delete mode 100644 taskingai/client/models/rest/collection_list_response.py delete mode 100644 taskingai/client/models/rest/collection_update_request.py delete mode 100644 taskingai/client/models/rest/collection_update_response.py delete mode 100644 taskingai/client/models/rest/delete_collection_response.py delete mode 100644 taskingai/client/models/rest/function_create_request.py delete mode 100644 taskingai/client/models/rest/function_create_response.py delete mode 100644 taskingai/client/models/rest/function_delete_response.py delete mode 100644 taskingai/client/models/rest/function_get_response.py delete mode 100644 taskingai/client/models/rest/function_list_response.py delete mode 100644 taskingai/client/models/rest/function_update_request.py delete mode 100644 taskingai/client/models/rest/function_update_response.py delete mode 100644 taskingai/client/models/rest/http_validation_error.py delete mode 100644 taskingai/client/models/rest/message_create_request.py delete mode 100644 taskingai/client/models/rest/message_create_response.py delete mode 100644 taskingai/client/models/rest/message_generate_request.py delete mode 100644 taskingai/client/models/rest/message_generate_response.py delete mode 100644 taskingai/client/models/rest/message_get_response.py delete mode 100644 taskingai/client/models/rest/message_list_response.py delete mode 100644 taskingai/client/models/rest/message_update_request.py delete mode 100644 taskingai/client/models/rest/message_update_response.py delete mode 100644 taskingai/client/models/rest/record_create_request.py delete mode 100644 taskingai/client/models/rest/record_create_response.py delete mode 100644 taskingai/client/models/rest/record_delete_response.py delete mode 100644 taskingai/client/models/rest/record_get_response.py delete mode 100644 taskingai/client/models/rest/record_list_response.py delete mode 100644 taskingai/client/models/rest/record_update_request.py delete mode 100644 taskingai/client/models/rest/record_update_response.py delete mode 100644 taskingai/client/models/rest/text_embedding_request.py delete mode 100644 taskingai/client/models/rest/text_embedding_response.py delete mode 100644 taskingai/client/models/rest/validation_error.py create mode 100644 taskingai/client/models/schemas/__init__.py create mode 100644 taskingai/client/models/schemas/action_bulk_create_request.py create mode 100644 taskingai/client/models/schemas/action_bulk_create_response.py create mode 100644 taskingai/client/models/schemas/action_get_response.py create mode 100644 taskingai/client/models/schemas/action_list_request.py create mode 100644 taskingai/client/models/schemas/action_list_response.py create mode 100644 taskingai/client/models/schemas/action_run_request.py create mode 100644 taskingai/client/models/schemas/action_run_response.py create mode 100644 taskingai/client/models/schemas/action_update_request.py create mode 100644 taskingai/client/models/schemas/action_update_response.py create mode 100644 taskingai/client/models/schemas/assistant_create_request.py create mode 100644 taskingai/client/models/schemas/assistant_create_response.py create mode 100644 taskingai/client/models/schemas/assistant_get_response.py create mode 100644 taskingai/client/models/schemas/assistant_list_request.py create mode 100644 taskingai/client/models/schemas/assistant_list_response.py create mode 100644 taskingai/client/models/schemas/assistant_update_request.py create mode 100644 taskingai/client/models/schemas/assistant_update_response.py create mode 100644 taskingai/client/models/schemas/base_empty_response.py create mode 100644 taskingai/client/models/schemas/chat_completion_request.py create mode 100644 taskingai/client/models/schemas/chat_completion_response.py create mode 100644 taskingai/client/models/schemas/chat_create_request.py create mode 100644 taskingai/client/models/schemas/chat_create_response.py create mode 100644 taskingai/client/models/schemas/chat_get_response.py create mode 100644 taskingai/client/models/schemas/chat_list_request.py create mode 100644 taskingai/client/models/schemas/chat_list_response.py create mode 100644 taskingai/client/models/schemas/chat_update_request.py create mode 100644 taskingai/client/models/schemas/chat_update_response.py create mode 100644 taskingai/client/models/schemas/chunk_create_request.py create mode 100644 taskingai/client/models/schemas/chunk_create_response.py create mode 100644 taskingai/client/models/schemas/chunk_get_response.py create mode 100644 taskingai/client/models/schemas/chunk_list_request.py create mode 100644 taskingai/client/models/schemas/chunk_list_response.py create mode 100644 taskingai/client/models/schemas/chunk_query_request.py create mode 100644 taskingai/client/models/schemas/chunk_query_response.py create mode 100644 taskingai/client/models/schemas/chunk_update_request.py create mode 100644 taskingai/client/models/schemas/chunk_update_response.py create mode 100644 taskingai/client/models/schemas/collection_create_request.py create mode 100644 taskingai/client/models/schemas/collection_create_response.py create mode 100644 taskingai/client/models/schemas/collection_get_response.py create mode 100644 taskingai/client/models/schemas/collection_list_request.py create mode 100644 taskingai/client/models/schemas/collection_list_response.py create mode 100644 taskingai/client/models/schemas/collection_update_request.py create mode 100644 taskingai/client/models/schemas/collection_update_response.py create mode 100644 taskingai/client/models/schemas/message_create_request.py create mode 100644 taskingai/client/models/schemas/message_create_response.py create mode 100644 taskingai/client/models/schemas/message_generate_request.py create mode 100644 taskingai/client/models/schemas/message_generate_response.py create mode 100644 taskingai/client/models/schemas/message_get_response.py create mode 100644 taskingai/client/models/schemas/message_list_request.py create mode 100644 taskingai/client/models/schemas/message_list_response.py create mode 100644 taskingai/client/models/schemas/message_update_request.py create mode 100644 taskingai/client/models/schemas/message_update_response.py create mode 100644 taskingai/client/models/schemas/record_create_request.py create mode 100644 taskingai/client/models/schemas/record_create_response.py create mode 100644 taskingai/client/models/schemas/record_get_response.py create mode 100644 taskingai/client/models/schemas/record_list_request.py create mode 100644 taskingai/client/models/schemas/record_list_response.py create mode 100644 taskingai/client/models/schemas/record_update_request.py create mode 100644 taskingai/client/models/schemas/record_update_response.py create mode 100644 taskingai/client/models/schemas/text_embedding_request.py create mode 100644 taskingai/client/models/schemas/text_embedding_response.py create mode 100644 taskingai/client/stream_apis/__init__.py create mode 100644 taskingai/client/stream_apis/stream_api_chat_completion.py create mode 100644 taskingai/client/stream_apis/stream_api_message_generation.py delete mode 100644 taskingai/tool/function.py diff --git a/examples/assistant/chat_with_assistant.ipynb b/examples/assistant/chat_with_assistant.ipynb index ba4e54b..4ab9ff8 100644 --- a/examples/assistant/chat_with_assistant.ipynb +++ b/examples/assistant/chat_with_assistant.ipynb @@ -208,12 +208,12 @@ "user_input = input(\"User Input: \")\n", "while user_input.strip() and user_input != \"q\":\n", " # create user message\n", - " taskingai.assistant.create_message(\n", + " user_message = taskingai.assistant.create_message(\n", " assistant_id=assistant.assistant_id,\n", " chat_id=chat.chat_id,\n", " text=user_input,\n", " )\n", - " print(f\"User: {user_input}\")\n", + " print(f\"User: {user_input} ({user_message.message_id})\")\n", " \n", " # generate assistant response\n", " assistant_message_response = taskingai.assistant.generate_message(\n", @@ -230,8 +230,8 @@ " if isinstance(item, MessageChunk):\n", " print(item.delta, end=\"\", flush=True)\n", " elif isinstance(item, Message):\n", - " print(f\"\\nmessage_id: {item.message_id}\")\n", - " \n", + " print(f\" ({item.message_id})\")\n", + " \n", " time.sleep(2)\n", " # quit by input 'q\n", " user_input = input(\"User: \")" @@ -274,16 +274,6 @@ "collapsed": false }, "id": "ed39836bbfdc7a4e" - }, - { - "cell_type": "code", - "execution_count": null, - "outputs": [], - "source": [], - "metadata": { - "collapsed": false - }, - "id": "9cfed1128acbdd30" } ], "metadata": { diff --git a/examples/crud/assistant_crud.ipynb b/examples/crud/assistant_crud.ipynb index 884b45b..411ead3 100644 --- a/examples/crud/assistant_crud.ipynb +++ b/examples/crud/assistant_crud.ipynb @@ -166,7 +166,7 @@ " assistant_id=assistant.assistant_id,\n", " chat_id=chat_id,\n", ")\n", - "print(f\"got chat: {chat}\\n\")" + "print(f\"chat: {chat}\\n\")" ], "metadata": { "collapsed": false diff --git a/examples/crud/retrieval_crud.ipynb b/examples/crud/retrieval_crud.ipynb index 68450cd..67f8b7b 100644 --- a/examples/crud/retrieval_crud.ipynb +++ b/examples/crud/retrieval_crud.ipynb @@ -31,7 +31,7 @@ "from taskingai.retrieval import Collection, Record, TokenTextSplitter\n", "\n", "# choose an available text_embedding model from your project\n", - "embedding_model_id = \"YOUR_MODEL_ID\"" + "embedding_model_id = \"YOUR_EMBEDDING_MODEL_ID\"" ], "metadata": { "collapsed": false @@ -93,7 +93,7 @@ " collection_id=collection_id\n", ")\n", "\n", - "print(f\"got collection: {collection}\\n\")" + "print(f\"collection: {collection}\\n\")" ], "metadata": { "collapsed": false diff --git a/examples/crud/tool_crud.ipynb b/examples/crud/tool_crud.ipynb index 865b426..51b1337 100644 --- a/examples/crud/tool_crud.ipynb +++ b/examples/crud/tool_crud.ipynb @@ -197,6 +197,16 @@ "collapsed": false }, "id": "5a1a36d15055918f" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "5588d5e7457225be" } ], "metadata": { diff --git a/examples/retrieval/semantic_search.ipynb b/examples/retrieval/semantic_search.ipynb index 3a98a3c..b5e817f 100644 --- a/examples/retrieval/semantic_search.ipynb +++ b/examples/retrieval/semantic_search.ipynb @@ -41,7 +41,7 @@ "outputs": [], "source": [ "# choose an available text_embedding model from your project\n", - "embedding_model_id = \"YOUR_MODEL_ID\"" + "embedding_model_id = \"YOUR_EMBEDDING_MODEL_ID\"" ], "metadata": { "collapsed": false @@ -224,6 +224,16 @@ "collapsed": false }, "id": "fc9c1fa12d893dd1" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [], + "metadata": { + "collapsed": false + }, + "id": "e0eb39fcac309768" } ], "metadata": { diff --git a/taskingai/assistant/assistant.py b/taskingai/assistant/assistant.py index a53a283..88cff13 100644 --- a/taskingai/assistant/assistant.py +++ b/taskingai/assistant/assistant.py @@ -1,23 +1,6 @@ from typing import Optional, List, Dict - -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import ( - Assistant, - AssistantMemory, - AssistantRetrieval, - AssistantTool, - AssistantToolType, - AssistantRetrievalType -) - -from taskingai.client.models import ( - AssistantCreateRequest, - AssistantCreateResponse, - AssistantUpdateRequest, - AssistantUpdateResponse, - AssistantGetResponse, - AssistantListResponse, -) +from taskingai.client.models import * +from taskingai.client.apis import * __all__ = [ "Assistant", @@ -37,6 +20,12 @@ "a_delete_assistant", ] +AssistantTool = ToolRef +AssistantRetrieval = RetrievalRef +AssistantToolType = ToolType +AssistantRetrievalType = RetrievalType +DEFAULT_RETRIEVAL_CONFIG = RetrievalConfig(top_k=3, method=RetrievalMethod.USER_MESSAGE) + def list_assistants( order: str = "desc", @@ -44,7 +33,6 @@ def list_assistants( after: Optional[str] = None, before: Optional[str] = None, ) -> List[Assistant]: - """ List assistants. @@ -58,25 +46,23 @@ 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) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: AssistantListResponse = api_instance.list_assistants(**params) - assistants: List[Assistant] = [Assistant(**item) for item in response.data] + payload = AssistantListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: AssistantListResponse = api_list_assistants(payload) + assistants: List[Assistant] = response.data return assistants async def a_list_assistants( - order: str = "desc", - limit: int = 20, - after: Optional[str] = None, - before: Optional[str] = None, + order: str = "desc", + limit: int = 20, + after: Optional[str] = None, + before: Optional[str] = None, ) -> List[Assistant]: """ List assistants. @@ -91,19 +77,15 @@ 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) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: AssistantListResponse = await api_instance.list_assistants(**params) - assistants: List[Assistant] = [Assistant(**item) for item in response.data] - return assistants - + payload = AssistantListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: AssistantListResponse = await async_api_list_assistants(payload) + return response.data def get_assistant(assistant_id: str) -> Assistant: @@ -113,10 +95,8 @@ def get_assistant(assistant_id: str) -> Assistant: :param assistant_id: The ID of the 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 + response: AssistantGetResponse = api_get_assistant(assistant_id=assistant_id) + return response.data async def a_get_assistant(assistant_id: str) -> Assistant: @@ -126,10 +106,8 @@ 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) - response: AssistantGetResponse = await api_instance.get_assistant(assistant_id=assistant_id) - assistant: Assistant = Assistant(**response.data) - return assistant + response: AssistantGetResponse = await async_api_get_assistant(assistant_id=assistant_id) + return response.data def create_assistant( @@ -140,6 +118,7 @@ def create_assistant( system_prompt_template: Optional[List[str]] = None, tools: Optional[List[AssistantTool]] = None, retrievals: Optional[List[AssistantRetrieval]] = None, + retrieval_configs: Optional[RetrievalConfig] = None, metadata: Optional[Dict[str, str]] = None, ) -> Assistant: """ @@ -156,21 +135,19 @@ def create_assistant( :return: The created assistant object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) - memory_dict = memory.model_dump() body = AssistantCreateRequest( model_id=model_id, - name=name, - description=description, - memory=memory_dict, - system_prompt_template=system_prompt_template, - tools=tools, - retrievals=retrievals, - metadata=metadata, + name=name or "", + description=description or "", + memory=memory, + system_prompt_template=system_prompt_template or [], + tools=tools or [], + retrievals=retrievals or [], + retrieval_configs=retrieval_configs or RetrievalConfig(top_k=3, method=RetrievalMethod.USER_MESSAGE), + metadata=metadata or {}, ) - response: AssistantCreateResponse = api_instance.create_assistant(body=body) - assistant: Assistant = Assistant(**response.data) - return assistant + response: AssistantCreateResponse = api_create_assistant(payload=body) + return response.data async def a_create_assistant( @@ -181,6 +158,7 @@ async def a_create_assistant( system_prompt_template: Optional[List[str]] = None, tools: Optional[List[AssistantTool]] = None, retrievals: Optional[List[AssistantRetrieval]] = None, + retrieval_configs: Optional[RetrievalConfig] = None, metadata: Optional[Dict[str, str]] = None, ) -> Assistant: """ @@ -197,21 +175,19 @@ async def a_create_assistant( :return: The created assistant object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) - memory_dict = memory.model_dump() body = AssistantCreateRequest( model_id=model_id, - name=name, - description=description, - memory=memory_dict, - system_prompt_template=system_prompt_template, - tools=tools, - retrievals=retrievals, - metadata=metadata, + name=name or "", + description=description or "", + memory=memory, + system_prompt_template=system_prompt_template or [], + tools=tools or [], + retrievals=retrievals or [], + retrieval_configs=retrieval_configs or DEFAULT_RETRIEVAL_CONFIG, + metadata=metadata or {}, ) - response: AssistantCreateResponse = await api_instance.create_assistant(body=body) - assistant: Assistant = Assistant(**response.data) - return assistant + response: AssistantCreateResponse = await async_api_create_assistant(payload=body) + return response.data def update_assistant( @@ -223,6 +199,7 @@ def update_assistant( memory: Optional[AssistantMemory] = None, tools: Optional[List[AssistantTool]] = None, retrievals: Optional[List[AssistantRetrieval]] = None, + retrieval_configs: Optional[RetrievalConfig] = None, metadata: Optional[Dict[str, str]] = None, ) -> Assistant: """ @@ -240,20 +217,19 @@ def update_assistant( :return: The updated assistant object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) body = AssistantUpdateRequest( model_id=model_id, name=name, description=description, - system_prompt_template=system_prompt_template, memory=memory, + system_prompt_template=system_prompt_template, tools=tools, retrievals=retrievals, + retrieval_configs=retrieval_configs, metadata=metadata, ) - response: AssistantUpdateResponse = api_instance.update_assistant(assistant_id=assistant_id, body=body) - assistant: Assistant = Assistant(**response.data) - return assistant + response: AssistantUpdateResponse = api_update_assistant(assistant_id=assistant_id, payload=body) + return response.data async def a_update_assistant( @@ -265,6 +241,7 @@ async def a_update_assistant( memory: Optional[AssistantMemory] = None, tools: Optional[List[AssistantTool]] = None, retrievals: Optional[List[AssistantRetrieval]] = None, + retrieval_configs: Optional[RetrievalConfig] = None, metadata: Optional[Dict[str, str]] = None, ) -> Assistant: """ @@ -282,20 +259,19 @@ async def a_update_assistant( :return: The updated assistant object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) body = AssistantUpdateRequest( model_id=model_id, name=name, description=description, - system_prompt_template=system_prompt_template, memory=memory, + system_prompt_template=system_prompt_template, tools=tools, retrievals=retrievals, + retrieval_configs=retrieval_configs, metadata=metadata, ) - response: AssistantUpdateResponse = await api_instance.update_assistant(assistant_id=assistant_id, body=body) - assistant: Assistant = Assistant(**response.data) - return assistant + response: AssistantUpdateResponse = await async_api_update_assistant(assistant_id=assistant_id, payload=body) + return response.data def delete_assistant(assistant_id: str) -> None: @@ -305,8 +281,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.delete_assistant(assistant_id=assistant_id) + api_delete_assistant(assistant_id=assistant_id) async def a_delete_assistant(assistant_id: str) -> None: @@ -316,6 +291,4 @@ 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) - await api_instance.delete_assistant(assistant_id=assistant_id) - + await async_api_delete_assistant(assistant_id=assistant_id) diff --git a/taskingai/assistant/chat.py b/taskingai/assistant/chat.py index 9a3b8f7..b0e46a8 100644 --- a/taskingai/assistant/chat.py +++ b/taskingai/assistant/chat.py @@ -1,10 +1,7 @@ from typing import Optional, List, Dict -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import Chat -from taskingai.client.models import ChatCreateRequest, ChatCreateResponse, \ - ChatUpdateRequest, ChatUpdateResponse, \ - ChatGetResponse, ChatListResponse +from taskingai.client.models import * +from taskingai.client.apis import * __all__ = [ "Chat", @@ -40,21 +37,18 @@ 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) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: ChatListResponse = api_instance.list_chats( + payload = ChatListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: ChatListResponse = api_list_chats( assistant_id=assistant_id, - **params + payload=payload, ) - chats: List[Chat] = [Chat(**item) for item in response.data] - return chats + return response.data async def a_list_chats( @@ -76,21 +70,18 @@ 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) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: ChatListResponse = await api_instance.list_chats( + payload = ChatListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: ChatListResponse = await async_api_list_chats( assistant_id=assistant_id, - **params + payload=payload, ) - chats: List[Chat] = [Chat(**item) for item in response.data] - return chats + return response.data def get_chat(assistant_id: str, chat_id: str) -> Chat: @@ -101,13 +92,11 @@ 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) - response: ChatGetResponse = api_instance.get_chat( + response: ChatGetResponse = api_get_chat( assistant_id=assistant_id, chat_id=chat_id, ) - chat: Chat = Chat(**response.data) - return chat + return response.data async def a_get_chat(assistant_id: str, chat_id: str) -> Chat: @@ -118,13 +107,11 @@ 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) - response: ChatGetResponse = await api_instance.get_chat( + response: ChatGetResponse = await async_api_get_chat( assistant_id=assistant_id, chat_id=chat_id, ) - chat: Chat = Chat(**response.data) - return chat + return response.data def create_chat( @@ -139,16 +126,11 @@ def create_chat( :return: The created chat object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) body = ChatCreateRequest( - metadata=metadata, - ) - response: ChatCreateResponse = api_instance.create_chat( - assistant_id=assistant_id, - body=body + metadata=metadata or {}, ) - chat: Chat = Chat(**response.data) - return chat + response: ChatCreateResponse = api_create_chat(assistant_id=assistant_id, payload=body) + return response.data async def a_create_chat( @@ -163,16 +145,11 @@ async def a_create_chat( :return: The created chat object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) body = ChatCreateRequest( - metadata=metadata, - ) - response: ChatCreateResponse = await api_instance.create_chat( - assistant_id=assistant_id, - body=body + metadata=metadata or {}, ) - chat: Chat = Chat(**response.data) - return chat + response: ChatCreateResponse = await async_api_create_chat(assistant_id=assistant_id, payload=body) + return response.data def update_chat( @@ -189,17 +166,11 @@ def update_chat( :return: The updated chat object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) body = ChatUpdateRequest( metadata=metadata, ) - response: ChatUpdateResponse = api_instance.update_chat( - assistant_id=assistant_id, - chat_id=chat_id, - body=body - ) - chat: Chat = Chat(**response.data) - return chat + response: ChatUpdateResponse = api_update_chat(assistant_id=assistant_id, chat_id=chat_id, payload=body) + return response.data async def a_update_chat( @@ -216,17 +187,11 @@ async def a_update_chat( :return: The updated chat object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) body = ChatUpdateRequest( metadata=metadata, ) - response: ChatUpdateResponse = await api_instance.update_chat( - assistant_id=assistant_id, - chat_id=chat_id, - body=body - ) - chat: Chat = Chat(**response.data) - return chat + response: ChatUpdateResponse = await async_api_update_chat(assistant_id=assistant_id, chat_id=chat_id, payload=body) + return response.data def delete_chat( @@ -240,8 +205,7 @@ def delete_chat( :param chat_id: The ID of the chat. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) - api_instance.delete_chat(assistant_id=assistant_id, chat_id=chat_id) + api_delete_chat(assistant_id=assistant_id, chat_id=chat_id) async def a_delete_chat( @@ -255,8 +219,4 @@ async def a_delete_chat( :param chat_id: The ID of the chat. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) - await api_instance.delete_chat(assistant_id=assistant_id, chat_id=chat_id) - - - + await async_api_delete_chat(assistant_id=assistant_id, chat_id=chat_id) diff --git a/taskingai/assistant/memory.py b/taskingai/assistant/memory.py index 42cf1da..3f94eb6 100644 --- a/taskingai/assistant/memory.py +++ b/taskingai/assistant/memory.py @@ -1,9 +1,6 @@ from taskingai.client.models import ( - AssistantMemoryType, AssistantMemory, - AssistantNaiveMemory, - AssistantZeroMemory, - AssistantMessageWindowMemory, + AssistantMemoryType, ) __all__ = [ @@ -13,3 +10,18 @@ "AssistantZeroMemory", "AssistantMessageWindowMemory", ] + + +class AssistantNaiveMemory(AssistantMemory): + def __init__(self): + super().__init__(type=AssistantMemoryType.NAIVE) + + +class AssistantZeroMemory(AssistantMemory): + def __init__(self): + super().__init__(type=AssistantMemoryType.ZERO) + + +class AssistantMessageWindowMemory(AssistantMemory): + def __init__(self, max_messages: int, max_tokens: int): + super().__init__(type=AssistantMemoryType.MESSAGE_WINDOW, max_messages=max_messages, max_tokens=max_tokens) diff --git a/taskingai/assistant/message.py b/taskingai/assistant/message.py index 0a99945..30f31de 100644 --- a/taskingai/assistant/message.py +++ b/taskingai/assistant/message.py @@ -1,21 +1,8 @@ from typing import Optional, List, Dict, Union -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import ( - Message, - MessageRole, - MessageContent, - MessageChunk, -) -from taskingai.client.models import ( - MessageCreateRequest, - MessageCreateResponse, - MessageUpdateRequest, - MessageUpdateResponse, - MessageGetResponse, - MessageListResponse, - MessageGenerateRequest -) +from taskingai.client.models import * +from taskingai.client.apis import * +from taskingai.client.stream_apis import * from taskingai.client.stream import Stream, AsyncStream __all__ = [ @@ -56,22 +43,19 @@ 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) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: MessageListResponse = api_instance.list_messages( + payload = MessageListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: MessageListResponse = api_list_messages( assistant_id=assistant_id, chat_id=chat_id, - **params + payload=payload, ) - messages: List[Message] = [Message(**item) for item in response.data] - return messages + return response.data async def a_list_messages( @@ -96,29 +80,22 @@ 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) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: MessageListResponse = await api_instance.list_messages( + payload = MessageListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: MessageListResponse = await async_api_list_messages( assistant_id=assistant_id, chat_id=chat_id, - **params + payload=payload, ) - messages: List[Message] = [Message(**item) for item in response.data] - return messages + return response.data -def get_message( - assistant_id: str, - chat_id: str, - message_id: str -) -> Message: +def get_message(assistant_id: str, chat_id: str, message_id: str) -> Message: """ Get a message. @@ -127,21 +104,15 @@ def get_message( :param message_id: The ID of the message. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) - response: MessageGetResponse = api_instance.get_message( + response: MessageGetResponse = api_get_message( assistant_id=assistant_id, chat_id=chat_id, message_id=message_id, ) - message: Message = Message(**response.data) - return message + return response.data -async def a_get_message( - assistant_id: str, - chat_id: str, - message_id: str -) -> Message: +async def a_get_message(assistant_id: str, chat_id: str, message_id: str) -> Message: """ Get a message in async mode. @@ -150,15 +121,12 @@ async def a_get_message( :param message_id: The ID of the message. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) - response: MessageGetResponse = await api_instance.get_message( + response: MessageGetResponse = await async_api_get_message( assistant_id=assistant_id, chat_id=chat_id, message_id=message_id, ) - message: Message = Message(**response.data) - return message - + return response.data def create_message( @@ -177,19 +145,13 @@ def create_message( :return: The created message object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) body = MessageCreateRequest( role=MessageRole.USER, content=MessageContent(text=text), - metadata=metadata, - ) - response: MessageCreateResponse = api_instance.create_message( - assistant_id=assistant_id, - chat_id=chat_id, - body=body + metadata=metadata or {}, ) - message: Message = Message(**response.data) - return message + response: MessageCreateResponse = api_create_message(assistant_id=assistant_id, chat_id=chat_id, payload=body) + return response.data async def a_create_message( @@ -208,19 +170,15 @@ async def a_create_message( :return: The created message object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) body = MessageCreateRequest( role=MessageRole.USER, content=MessageContent(text=text), - metadata=metadata, + metadata=metadata or {}, ) - response: MessageCreateResponse = await api_instance.create_message( - assistant_id=assistant_id, - chat_id=chat_id, - body=body + response: MessageCreateResponse = await async_api_create_message( + assistant_id=assistant_id, chat_id=chat_id, payload=body ) - message: Message = Message(**response.data) - return message + return response.data def update_message( @@ -238,18 +196,13 @@ def update_message( :return: The updated message object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) body = MessageUpdateRequest( - metadata=metadata, + metadata=metadata or {}, ) - response: MessageUpdateResponse = api_instance.update_message( - assistant_id=assistant_id, - chat_id=chat_id, - message_id=message_id, - body=body + response: MessageUpdateResponse = api_update_message( + assistant_id=assistant_id, chat_id=chat_id, message_id=message_id, payload=body ) - message: Message = Message(**response.data) - return message + return response.data async def a_update_message( @@ -267,19 +220,13 @@ async def a_update_message( :return: The updated message object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) body = MessageUpdateRequest( - metadata=metadata, + metadata=metadata or {}, ) - response: MessageUpdateResponse = await api_instance.update_message( - assistant_id=assistant_id, - chat_id=chat_id, - message_id=message_id, - body=body + response: MessageUpdateResponse = await async_api_update_message( + assistant_id=assistant_id, chat_id=chat_id, message_id=message_id, payload=body ) - message: Message = Message(**response.data) - return message - + return response.data def generate_message( @@ -293,36 +240,30 @@ def generate_message( :param assistant_id: The ID of the assistant. :param chat_id: The ID of the chat. - :param text: The text content of the message. - :param metadata: The message metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. + :param system_prompt_variables: The system prompt variables. + :param stream: Whether to return a stream. :return: The generated message object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT) body = MessageGenerateRequest( system_prompt_variables=system_prompt_variables, stream=stream, ) if not stream: - response = api_instance.generate_message( + response: MessageGenerateResponse = api_generate_message( assistant_id=assistant_id, chat_id=chat_id, - body=body, - stream=False, + payload=body, ) - message: Message = Message(**response["data"]) - return message + return response.data else: - response: Stream = api_instance.generate_message( - assistant_id=assistant_id, - chat_id=chat_id, - body=body, - stream=True, - _preload_content=False + response: Stream = stream_api_generate_message( + assistant_id=assistant_id, chat_id=chat_id, payload=body, _preload_content=False ) return response + async def a_generate_message( assistant_id: str, chat_id: str, @@ -334,34 +275,25 @@ async def a_generate_message( :param assistant_id: The ID of the assistant. :param chat_id: The ID of the chat. - :param text: The text content of the message. - :param metadata: The message metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. + :param system_prompt_variables: The system prompt variables. + :param stream: Whether to return a stream. :return: The generated message object. """ - api_instance = get_api_instance(ModuleType.ASSISTANT, async_client=True) body = MessageGenerateRequest( system_prompt_variables=system_prompt_variables, stream=stream, ) if not stream: - response = await api_instance.generate_message( + response: MessageGenerateResponse = await async_api_generate_message( assistant_id=assistant_id, chat_id=chat_id, - body=body, - stream=False, + payload=body, ) - message: Message = Message(**response["data"]) - return message + return response.data else: - response: AsyncStream = await api_instance.generate_message( - assistant_id=assistant_id, - chat_id=chat_id, - body=body, - stream=True, - _preload_content=False + response: AsyncStream = await async_stream_api_generate_message( + assistant_id=assistant_id, chat_id=chat_id, payload=body, stream=True, _preload_content=False ) return response - - diff --git a/taskingai/client/api/__init__.py b/taskingai/client/api/__init__.py deleted file mode 100644 index 0e6e454..0000000 --- a/taskingai/client/api/__init__.py +++ /dev/null @@ -1,16 +0,0 @@ -from __future__ import absolute_import - -# flake8: noqa - -from taskingai.client.api.assistant_api import AssistantApi -from taskingai.client.api.assistant_async_api import AsyncAssistantApi - -from taskingai.client.api.inference_api import InferenceApi -from taskingai.client.api.inference_async_api import AsyncInferenceApi - -from taskingai.client.api.retrieval_api import RetrievalApi -from taskingai.client.api.retrieval_async_api import AsyncRetrievalApi - -from taskingai.client.api.tool_api import ToolApi -from taskingai.client.api.tool_async_api import AsyncToolApi - diff --git a/taskingai/client/api/assistant_api.py b/taskingai/client/api/assistant_api.py deleted file mode 100644 index 6701d2f..0000000 --- a/taskingai/client/api/assistant_api.py +++ /dev/null @@ -1,1629 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import SyncApiClient - - -class AssistantApi(object): - - def __init__(self, api_client=None): - if api_client is None: - api_client = SyncApiClient() - self.api_client = api_client - - def create_assistant(self, body, **kwargs): # noqa: E501 - """Create assistant # noqa: E501 - - Create an assistant with a model and instructions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_assistant(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantCreateRequest body: (required) - :return: AssistantCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_assistant_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_assistant_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_assistant_with_http_info(self, body, **kwargs): # noqa: E501 - """Create assistant # noqa: E501 - - Create an assistant with a model and instructions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_assistant_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantCreateRequest body: (required) - :return: AssistantCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_chat(self, body, assistant_id, **kwargs): # noqa: E501 - """Create chat # noqa: E501 - - Create a new chat within your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_chat(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatCreateRequest body: (required) - :param object assistant_id: (required) - :return: ChatCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_chat_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - else: - (data) = self.create_chat_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - return data - - def create_chat_with_http_info(self, body, assistant_id, **kwargs): # noqa: E501 - """Create chat # noqa: E501 - - Create a new chat within your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_chat_with_http_info(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatCreateRequest body: (required) - :param object assistant_id: (required) - :return: ChatCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_chat`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `create_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_message(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Create message # noqa: E501 - - Send a new message within a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_message(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageCreateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: MessageCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_message_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = self.create_message_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - def create_message_with_http_info(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Create message # noqa: E501 - - Send a new message within a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_message_with_http_info(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageCreateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: MessageCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_message`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `create_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `create_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_assistant(self, assistant_id, **kwargs): # noqa: E501 - """Delete assistant # noqa: E501 - - Remove an existing assistant from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_assistant(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.delete_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - return data - - def delete_assistant_with_http_info(self, assistant_id, **kwargs): # noqa: E501 - """Delete assistant # noqa: E501 - - Remove an existing assistant from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_assistant_with_http_info(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `delete_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_chat(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Delete chat # noqa: E501 - - Remove an existing chat from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_chat(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.delete_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - def delete_chat_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Delete chat # noqa: E501 - - Remove an existing chat from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_chat_with_http_info(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `delete_chat`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `delete_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def generate_message(self, body, stream, assistant_id, chat_id, **kwargs): # noqa: E501 - """Generate assistant message # noqa: E501 - - Generate a new message with the role of 'assistant'. - :param MessageGenerateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.generate_message_with_http_info(body, stream, assistant_id, chat_id, **kwargs) # noqa: E501 - - def generate_message_with_http_info(self, body, stream, assistant_id, chat_id, **kwargs): # noqa: E501 - """Generate assistant message # noqa: E501 - - Generate a new message with the role of 'assistant'. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.generate_message_with_http_info(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageGenerateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method generate_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError( - "Missing the required parameter `body` when calling `generate_message`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `generate_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError( - "Missing the required parameter `chat_id` when calling `generate_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/generate', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='object', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats, - stream=stream - ) - - def get_assistant(self, assistant_id, **kwargs): # noqa: E501 - """Get assistant # noqa: E501 - - Retrieve a single assistant by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_assistant(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - else: - (data) = self.get_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - return data - - def get_assistant_with_http_info(self, assistant_id, **kwargs): # noqa: E501 - """Get assistant # noqa: E501 - - Retrieve a single assistant by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_assistant_with_http_info(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `get_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_chat(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Get chat # noqa: E501 - - Retrieve the details of a specific chat by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_chat(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = self.get_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - def get_chat_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Get chat # noqa: E501 - - Retrieve the details of a specific chat by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_chat_with_http_info(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `get_chat`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `get_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_message(self, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Get message # noqa: E501 - - Retrieve a specific message from a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_message(assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_message_with_http_info(assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - else: - (data) = self.get_message_with_http_info(assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - return data - - def get_message_with_http_info(self, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Get message # noqa: E501 - - Retrieve a specific message from a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_message_with_http_info(assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id', 'message_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `get_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `get_message`") # noqa: E501 - # verify the required parameter 'message_id' is set - if ('message_id' not in params or - params['message_id'] is None): - raise ValueError("Missing the required parameter `message_id` when calling `get_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - if 'message_id' in params: - path_params['message_id'] = params['message_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_assistants(self, **kwargs): # noqa: E501 - """List assistants # noqa: E501 - - Retrieve a list of all assistants available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_assistants(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: AssistantListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_assistants_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_assistants_with_http_info(**kwargs) # noqa: E501 - return data - - def list_assistants_with_http_info(self, **kwargs): # noqa: E501 - """List assistants # noqa: E501 - - Retrieve a list of all assistants available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_assistants_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: AssistantListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_assistants" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_chats(self, assistant_id, **kwargs): # noqa: E501 - """List chats # noqa: E501 - - Retrieve a list of all chats available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_chats(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ChatListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_chats_with_http_info(assistant_id, **kwargs) # noqa: E501 - else: - (data) = self.list_chats_with_http_info(assistant_id, **kwargs) # noqa: E501 - return data - - def list_chats_with_http_info(self, assistant_id, **kwargs): # noqa: E501 - """List chats # noqa: E501 - - Retrieve a list of all chats available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_chats_with_http_info(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ChatListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_chats" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `list_chats`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_messages(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """List messages # noqa: E501 - - Retrieve a paginated list of messages from a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_messages(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: MessageListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_messages_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = self.list_messages_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - def list_messages_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """List messages # noqa: E501 - - Retrieve a paginated list of messages from a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_messages_with_http_info(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: MessageListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id', 'limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_messages" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `list_messages`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `list_messages`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_assistant(self, body, assistant_id, **kwargs): # noqa: E501 - """Update assistant # noqa: E501 - - Update the properties of an existing assistant. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_assistant(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantUpdateRequest body: (required) - :param object assistant_id: (required) - :return: AssistantUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_assistant_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - else: - (data) = self.update_assistant_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - return data - - def update_assistant_with_http_info(self, body, assistant_id, **kwargs): # noqa: E501 - """Update assistant # noqa: E501 - - Update the properties of an existing assistant. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_assistant_with_http_info(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantUpdateRequest body: (required) - :param object assistant_id: (required) - :return: AssistantUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_assistant`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `update_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_chat(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Update chat # noqa: E501 - - Update the properties of a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_chat(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_chat_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = self.update_chat_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - def update_chat_with_http_info(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Update chat # noqa: E501 - - Update the properties of a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_chat_with_http_info(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_chat`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `update_chat`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `update_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_message(self, body, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Update message # noqa: E501 - - Modify the metadata of a specific message within a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_message(body, assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_message_with_http_info(body, assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - else: - (data) = self.update_message_with_http_info(body, assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - return data - - def update_message_with_http_info(self, body, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Update message # noqa: E501 - - Modify the metadata of a specific message within a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_message_with_http_info(body, assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id', 'message_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_message`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `update_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `update_message`") # noqa: E501 - # verify the required parameter 'message_id' is set - if ('message_id' not in params or - params['message_id'] is None): - raise ValueError("Missing the required parameter `message_id` when calling `update_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - if 'message_id' in params: - path_params['message_id'] = params['message_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/taskingai/client/api/assistant_async_api.py b/taskingai/client/api/assistant_async_api.py deleted file mode 100644 index 737acac..0000000 --- a/taskingai/client/api/assistant_async_api.py +++ /dev/null @@ -1,1631 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import AsyncApiClient - - -class AsyncAssistantApi(object): - - def __init__(self, api_client=None): - if api_client is None: - api_client = AsyncApiClient() - self.api_client = api_client - - async def create_assistant(self, body, **kwargs): # noqa: E501 - """Create assistant # noqa: E501 - - Create an assistant with a model and instructions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_assistant(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantCreateRequest body: (required) - :return: AssistantCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.create_assistant_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = await self.create_assistant_with_http_info(body, **kwargs) # noqa: E501 - return data - - async def create_assistant_with_http_info(self, body, **kwargs): # noqa: E501 - """Create assistant # noqa: E501 - - Create an assistant with a model and instructions. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_assistant_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantCreateRequest body: (required) - :return: AssistantCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def create_chat(self, body, assistant_id, **kwargs): # noqa: E501 - """Create chat # noqa: E501 - - Create a new chat within your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_chat(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatCreateRequest body: (required) - :param object assistant_id: (required) - :return: ChatCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.create_chat_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - else: - (data) = await self.create_chat_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - return data - - async def create_chat_with_http_info(self, body, assistant_id, **kwargs): # noqa: E501 - """Create chat # noqa: E501 - - Create a new chat within your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_chat_with_http_info(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatCreateRequest body: (required) - :param object assistant_id: (required) - :return: ChatCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_chat`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `create_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def create_message(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Create message # noqa: E501 - - Send a new message within a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_message(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageCreateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: MessageCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.create_message_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = await self.create_message_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - async def create_message_with_http_info(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Create message # noqa: E501 - - Send a new message within a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_message_with_http_info(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageCreateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: MessageCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_message`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `create_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `create_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def delete_assistant(self, assistant_id, **kwargs): # noqa: E501 - """Delete assistant # noqa: E501 - - Remove an existing assistant from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_assistant(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.delete_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - else: - (data) = await self.delete_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - return data - - async def delete_assistant_with_http_info(self, assistant_id, **kwargs): # noqa: E501 - """Delete assistant # noqa: E501 - - Remove an existing assistant from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_assistant_with_http_info(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `delete_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def delete_chat(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Delete chat # noqa: E501 - - Remove an existing chat from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_chat(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.delete_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = await self.delete_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - async def delete_chat_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Delete chat # noqa: E501 - - Remove an existing chat from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_chat_with_http_info(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `delete_chat`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `delete_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - - async def generate_message(self, body, stream, assistant_id, chat_id, **kwargs): # noqa: E501 - """Generate assistant message # noqa: E501 - - Generate a new message with the role of 'assistant'. - :param MessageGenerateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return await self.generate_message_with_http_info(body, stream, assistant_id, chat_id, **kwargs) # noqa: E501 - - - async def generate_message_with_http_info(self, body, stream, assistant_id, chat_id, **kwargs): # noqa: E501 - """Generate assistant message # noqa: E501 - - Generate a new message with the role of 'assistant'. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.generate_message_with_http_info(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageGenerateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method generate_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError( - "Missing the required parameter `body` when calling `generate_message`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `generate_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError( - "Missing the required parameter `chat_id` when calling `generate_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/generate', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='object', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats, - stream=stream - ) - - async def get_assistant(self, assistant_id, **kwargs): # noqa: E501 - """Get assistant # noqa: E501 - - Retrieve a single assistant by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_assistant(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.get_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_assistant_with_http_info(assistant_id, **kwargs) # noqa: E501 - return data - - async def get_assistant_with_http_info(self, assistant_id, **kwargs): # noqa: E501 - """Get assistant # noqa: E501 - - Retrieve a single assistant by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_assistant_with_http_info(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :return: AssistantGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `get_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def get_chat(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Get chat # noqa: E501 - - Retrieve the details of a specific chat by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_chat(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.get_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_chat_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - async def get_chat_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """Get chat # noqa: E501 - - Retrieve the details of a specific chat by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_chat_with_http_info(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `get_chat`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `get_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def get_message(self, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Get message # noqa: E501 - - Retrieve a specific message from a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_message(assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.get_message_with_http_info(assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_message_with_http_info(assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - return data - - async def get_message_with_http_info(self, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Get message # noqa: E501 - - Retrieve a specific message from a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_message_with_http_info(assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id', 'message_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `get_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `get_message`") # noqa: E501 - # verify the required parameter 'message_id' is set - if ('message_id' not in params or - params['message_id'] is None): - raise ValueError("Missing the required parameter `message_id` when calling `get_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - if 'message_id' in params: - path_params['message_id'] = params['message_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def list_assistants(self, **kwargs): # noqa: E501 - """List assistants # noqa: E501 - - Retrieve a list of all assistants available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_assistants(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: AssistantListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.list_assistants_with_http_info(**kwargs) # noqa: E501 - else: - (data) = await self.list_assistants_with_http_info(**kwargs) # noqa: E501 - return data - - async def list_assistants_with_http_info(self, **kwargs): # noqa: E501 - """List assistants # noqa: E501 - - Retrieve a list of all assistants available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_assistants_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: AssistantListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_assistants" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def list_chats(self, assistant_id, **kwargs): # noqa: E501 - """List chats # noqa: E501 - - Retrieve a list of all chats available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_chats(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ChatListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.list_chats_with_http_info(assistant_id, **kwargs) # noqa: E501 - else: - (data) = await self.list_chats_with_http_info(assistant_id, **kwargs) # noqa: E501 - return data - - async def list_chats_with_http_info(self, assistant_id, **kwargs): # noqa: E501 - """List chats # noqa: E501 - - Retrieve a list of all chats available in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_chats_with_http_info(assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ChatListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_chats" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `list_chats`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def list_messages(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """List messages # noqa: E501 - - Retrieve a paginated list of messages from a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_messages(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: MessageListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.list_messages_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = await self.list_messages_with_http_info(assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - async def list_messages_with_http_info(self, assistant_id, chat_id, **kwargs): # noqa: E501 - """List messages # noqa: E501 - - Retrieve a paginated list of messages from a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_messages_with_http_info(assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object assistant_id: (required) - :param object chat_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: MessageListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['assistant_id', 'chat_id', 'limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_messages" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `list_messages`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `list_messages`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def update_assistant(self, body, assistant_id, **kwargs): # noqa: E501 - """Update assistant # noqa: E501 - - Update the properties of an existing assistant. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_assistant(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantUpdateRequest body: (required) - :param object assistant_id: (required) - :return: AssistantUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.update_assistant_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_assistant_with_http_info(body, assistant_id, **kwargs) # noqa: E501 - return data - - async def update_assistant_with_http_info(self, body, assistant_id, **kwargs): # noqa: E501 - """Update assistant # noqa: E501 - - Update the properties of an existing assistant. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_assistant_with_http_info(body, assistant_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param AssistantUpdateRequest body: (required) - :param object assistant_id: (required) - :return: AssistantUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_assistant" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_assistant`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `update_assistant`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='AssistantUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def update_chat(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Update chat # noqa: E501 - - Update the properties of a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_chat(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.update_chat_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_chat_with_http_info(body, assistant_id, chat_id, **kwargs) # noqa: E501 - return data - - async def update_chat_with_http_info(self, body, assistant_id, chat_id, **kwargs): # noqa: E501 - """Update chat # noqa: E501 - - Update the properties of a specific chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_chat_with_http_info(body, assistant_id, chat_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChatUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :return: ChatUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_chat" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_chat`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError("Missing the required parameter `assistant_id` when calling `update_chat`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `update_chat`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ChatUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def update_message(self, body, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Update message # noqa: E501 - - Modify the metadata of a specific message within a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_message(body, assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.update_message_with_http_info(body, assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_message_with_http_info(body, assistant_id, chat_id, message_id, **kwargs) # noqa: E501 - return data - - async def update_message_with_http_info(self, body, assistant_id, chat_id, message_id, **kwargs): # noqa: E501 - """Update message # noqa: E501 - - Modify the metadata of a specific message within a chat. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_message_with_http_info(body, assistant_id, chat_id, message_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param MessageUpdateRequest body: (required) - :param object assistant_id: (required) - :param object chat_id: (required) - :param object message_id: (required) - :return: MessageUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'assistant_id', 'chat_id', 'message_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_message" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_message`") # noqa: E501 - # verify the required parameter 'assistant_id' is set - if ('assistant_id' not in params or - params['assistant_id'] is None): - raise ValueError( - "Missing the required parameter `assistant_id` when calling `update_message`") # noqa: E501 - # verify the required parameter 'chat_id' is set - if ('chat_id' not in params or - params['chat_id'] is None): - raise ValueError("Missing the required parameter `chat_id` when calling `update_message`") # noqa: E501 - # verify the required parameter 'message_id' is set - if ('message_id' not in params or - params['message_id'] is None): - raise ValueError("Missing the required parameter `message_id` when calling `update_message`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'assistant_id' in params: - path_params['assistant_id'] = params['assistant_id'] # noqa: E501 - if 'chat_id' in params: - path_params['chat_id'] = params['chat_id'] # noqa: E501 - if 'message_id' in params: - path_params['message_id'] = params['message_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='MessageUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/taskingai/client/api/inference_api.py b/taskingai/client/api/inference_api.py deleted file mode 100644 index 733cbf1..0000000 --- a/taskingai/client/api/inference_api.py +++ /dev/null @@ -1,203 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from ..api_client import SyncApiClient - -class InferenceApi(object): - - def __init__(self, api_client=None): - if api_client is None: - api_client = SyncApiClient() - self.api_client = api_client - - def chat_completion(self, body, stream = False, **kwargs): # noqa: E501 - """Chat Completion # noqa: E501 - - Model inference for chat completion. # noqa: E501 - :param ChatCompletionRequest body: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return self.chat_completion_with_http_info(body, stream, **kwargs) - - def chat_completion_with_http_info(self, body, stream, **kwargs): # noqa: E501 - """Chat Completion # noqa: E501 - - Model inference for chat completion. # noqa: E501 - :param ChatCompletionRequest body: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method chat_completion" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `chat_completion`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - response = self.api_client.call_api( - '/v1/inference/chat_completion', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='object', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats, - stream=stream - ) - return response - - def text_embedding(self, body, **kwargs): # noqa: E501 - """Text Embedding # noqa: E501 - - Model inference for text embedding. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.text_embedding(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TextEmbeddingRequest body: (required) - :return: TextEmbeddingResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - (data) = self.text_embedding_with_http_info(body, **kwargs) # noqa: E501 - return data - - def text_embedding_with_http_info(self, body, **kwargs): # noqa: E501 - """Text Embedding # noqa: E501 - - Model inference for text embedding. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.text_embedding_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TextEmbeddingRequest body: (required) - :return: TextEmbeddingResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method text_embedding" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `text_embedding`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/inference/text_embedding', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TextEmbeddingResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/taskingai/client/api/inference_async_api.py b/taskingai/client/api/inference_async_api.py deleted file mode 100644 index 8e8981f..0000000 --- a/taskingai/client/api/inference_async_api.py +++ /dev/null @@ -1,207 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import AsyncApiClient - - -class AsyncInferenceApi(object): - - def __init__(self, api_client=None): - if api_client is None: - api_client = AsyncApiClient() - self.api_client = api_client - - async def chat_completion(self, body, stream=False, **kwargs): # noqa: E501 - """Chat Completion # noqa: E501 - - Model inference for chat completion. # noqa: E501 - :param ChatCompletionRequest body: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - return await self.chat_completion_with_http_info(body, stream, **kwargs) - - async def chat_completion_with_http_info(self, body, stream, **kwargs): # noqa: E501 - """Chat Completion # noqa: E501 - - Model inference for chat completion. # noqa: E501 - :param ChatCompletionRequest body: (required) - :return: object - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method chat_completion" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `chat_completion`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - response = await self.api_client.call_api( - '/v1/inference/chat_completion', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='object', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats, - stream=stream - ) - return response - - async def text_embedding(self, body, **kwargs): # noqa: E501 - """Text Embedding # noqa: E501 - - Model inference for text embedding. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.text_embedding(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TextEmbeddingRequest body: (required) - :return: TextEmbeddingResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.text_embedding_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = await self.text_embedding_with_http_info(body, **kwargs) # noqa: E501 - return data - - async def text_embedding_with_http_info(self, body, **kwargs): # noqa: E501 - """Text Embedding # noqa: E501 - - Model inference for text embedding. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.text_embedding_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param TextEmbeddingRequest body: (required) - :return: TextEmbeddingResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method text_embedding" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `text_embedding`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/inference/text_embedding', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='TextEmbeddingResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/taskingai/client/api/retrieval_api.py b/taskingai/client/api/retrieval_api.py deleted file mode 100644 index cd799ee..0000000 --- a/taskingai/client/api/retrieval_api.py +++ /dev/null @@ -1,1135 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import SyncApiClient - - -class RetrievalApi(object): - def __init__(self, api_client=None): - if api_client is None: - api_client = SyncApiClient() - self.api_client = api_client - - def create_collection(self, body, **kwargs): # noqa: E501 - """Create collection # noqa: E501 - - This operation creates a new retrieval collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_collection(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionCreateRequest body: (required) - :return: CollectionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_collection_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_collection_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_collection_with_http_info(self, body, **kwargs): # noqa: E501 - """Create collection # noqa: E501 - - This operation creates a new retrieval collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_collection_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionCreateRequest body: (required) - :return: CollectionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method create_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `create_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionCreateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def create_record(self, body, collection_id, **kwargs): # noqa: E501 - """Create record # noqa: E501 - - Create a new record in a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_record(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordCreateRequest body: (required) - :param object collection_id: (required) - :return: RecordCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.create_record_with_http_info(body, collection_id, **kwargs) # noqa: E501 - else: - (data) = self.create_record_with_http_info(body, collection_id, **kwargs) # noqa: E501 - return data - - def create_record_with_http_info(self, body, collection_id, **kwargs): # noqa: E501 - """Create record # noqa: E501 - - Create a new record in a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_record_with_http_info(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordCreateRequest body: (required) - :param object collection_id: (required) - :return: RecordCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method create_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `create_record`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `create_record`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}/records", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordCreateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_collection(self, collection_id, **kwargs): # noqa: E501 - """Delete collection # noqa: E501 - - This operation deletes a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_collection(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: DeleteCollectionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - return data - - def delete_collection_with_http_info(self, collection_id, **kwargs): # noqa: E501 - """Delete collection # noqa: E501 - - This operation deletes a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_collection_with_http_info(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: DeleteCollectionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method delete_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `delete_collection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="DeleteCollectionResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def delete_record(self, collection_id, record_id, **kwargs): # noqa: E501 - """Delete record # noqa: E501 - - Delete a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_record(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.delete_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - return data - - def delete_record_with_http_info(self, collection_id, record_id, **kwargs): # noqa: E501 - """Delete record # noqa: E501 - - Delete a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_record_with_http_info(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id", "record_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method delete_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `delete_record`" - ) # noqa: E501 - # verify the required parameter 'record_id' is set - if "record_id" not in params or params["record_id"] is None: - raise ValueError("Missing the required parameter `record_id` when calling `delete_record`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - if "record_id" in params: - path_params["record_id"] = params["record_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}/records/{record_id}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordDeleteResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_collection(self, collection_id, **kwargs): # noqa: E501 - """Get collection # noqa: E501 - - This operation returns a single collection in your Text Base by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_collection(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: CollectionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - else: - (data) = self.get_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - return data - - def get_collection_with_http_info(self, collection_id, **kwargs): # noqa: E501 - """Get collection # noqa: E501 - - This operation returns a single collection in your Text Base by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_collection_with_http_info(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: CollectionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method get_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `get_collection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionGetResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def get_record(self, collection_id, record_id, **kwargs): # noqa: E501 - """Get record # noqa: E501 - - Retrieve a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_record(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.get_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - else: - (data) = self.get_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - return data - - def get_record_with_http_info(self, collection_id, record_id, **kwargs): # noqa: E501 - """Get record # noqa: E501 - - Retrieve a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_record_with_http_info(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id", "record_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method get_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError("Missing the required parameter `collection_id` when calling `get_record`") # noqa: E501 - # verify the required parameter 'record_id' is set - if "record_id" not in params or params["record_id"] is None: - raise ValueError("Missing the required parameter `record_id` when calling `get_record`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - if "record_id" in params: - path_params["record_id"] = params["record_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}/records/{record_id}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordGetResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def list_collections(self, **kwargs): # noqa: E501 - """List collections # noqa: E501 - - This operation returns a list of your retrieval collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_collections(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: CollectionListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_collections_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_collections_with_http_info(**kwargs) # noqa: E501 - return data - - def list_collections_with_http_info(self, **kwargs): # noqa: E501 - """List collections # noqa: E501 - - This operation returns a list of your retrieval collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_collections_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: CollectionListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["limit", "order", "after", "before"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method list_collections" % key) - params[key] = val - del params["kwargs"] - - collection_formats = {} - - path_params = {} - - query_params = [] - if "limit" in params: - query_params.append(("limit", params["limit"])) # noqa: E501 - if "order" in params: - query_params.append(("order", params["order"])) # noqa: E501 - if "after" in params: - query_params.append(("after", params["after"])) # noqa: E501 - if "before" in params: - query_params.append(("before", params["before"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionListResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def list_records(self, collection_id, **kwargs): # noqa: E501 - """List records # noqa: E501 - - Retrieve a paginated list of records from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_records(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: RecordListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.list_records_with_http_info(collection_id, **kwargs) # noqa: E501 - else: - (data) = self.list_records_with_http_info(collection_id, **kwargs) # noqa: E501 - return data - - def list_records_with_http_info(self, collection_id, **kwargs): # noqa: E501 - """List records # noqa: E501 - - Retrieve a paginated list of records from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_records_with_http_info(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: RecordListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id", "limit", "order", "after", "before"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method list_records" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError("Missing the required parameter `collection_id` when calling `list_records`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - if "limit" in params: - query_params.append(("limit", params["limit"])) # noqa: E501 - if "order" in params: - query_params.append(("order", params["order"])) # noqa: E501 - if "after" in params: - query_params.append(("after", params["after"])) # noqa: E501 - if "before" in params: - query_params.append(("before", params["before"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}/records", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordListResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def query_chunks(self, body, collection_id, **kwargs): # noqa: E501 - """Query chunks # noqa: E501 - - Query the most relevant chunks from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.query_chunks(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChunkQueryRequest body: (required) - :param object collection_id: (required) - :return: ChunkQueryResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.query_chunks_with_http_info(body, collection_id, **kwargs) # noqa: E501 - else: - (data) = self.query_chunks_with_http_info(body, collection_id, **kwargs) # noqa: E501 - return data - - def query_chunks_with_http_info(self, body, collection_id, **kwargs): # noqa: E501 - """Query chunks # noqa: E501 - - Query the most relevant chunks from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.query_chunks_with_http_info(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChunkQueryRequest body: (required) - :param object collection_id: (required) - :return: ChunkQueryResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method query_chunks" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `query_chunks`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError("Missing the required parameter `collection_id` when calling `query_chunks`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}/chunks/query", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="ChunkQueryResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def update_collection(self, body, collection_id, **kwargs): # noqa: E501 - """Update collection # noqa: E501 - - This operation updates the metadata of a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_collection(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionUpdateRequest body: (required) - :param object collection_id: (required) - :return: CollectionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.update_collection_with_http_info(body, collection_id, **kwargs) # noqa: E501 - else: - (data) = self.update_collection_with_http_info(body, collection_id, **kwargs) # noqa: E501 - return data - - def update_collection_with_http_info(self, body, collection_id, **kwargs): # noqa: E501 - """Update collection # noqa: E501 - - This operation updates the metadata of a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_collection_with_http_info(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionUpdateRequest body: (required) - :param object collection_id: (required) - :return: CollectionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method update_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `update_collection`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `update_collection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionUpdateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - def update_record(self, body, collection_id, record_id, **kwargs): # noqa: E501 - """Update record # noqa: E501 - - Modify the metadata of a specific record within a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_record(body, collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordUpdateRequest body: (required) - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return self.update_record_with_http_info(body, collection_id, record_id, **kwargs) # noqa: E501 - else: - (data) = self.update_record_with_http_info(body, collection_id, record_id, **kwargs) # noqa: E501 - return data - - def update_record_with_http_info(self, body, collection_id, record_id, **kwargs): # noqa: E501 - """Update record # noqa: E501 - - Modify the metadata of a specific record within a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_record_with_http_info(body, collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordUpdateRequest body: (required) - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id", "record_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method update_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `update_record`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `update_record`" - ) # noqa: E501 - # verify the required parameter 'record_id' is set - if "record_id" not in params or params["record_id"] is None: - raise ValueError("Missing the required parameter `record_id` when calling `update_record`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - if "record_id" in params: - path_params["record_id"] = params["record_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - "/v1/collections/{collection_id}/records/{record_id}", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordUpdateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/taskingai/client/api/retrieval_async_api.py b/taskingai/client/api/retrieval_async_api.py deleted file mode 100644 index 29ab676..0000000 --- a/taskingai/client/api/retrieval_async_api.py +++ /dev/null @@ -1,1135 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import AsyncApiClient - - -class AsyncRetrievalApi(object): - def __init__(self, api_client=None): - if api_client is None: - api_client = AsyncApiClient() - self.api_client = api_client - - async def create_collection(self, body, **kwargs): # noqa: E501 - """Create collection # noqa: E501 - - This operation creates a new retrieval collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_collection(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionCreateRequest body: (required) - :return: CollectionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.create_collection_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = await self.create_collection_with_http_info(body, **kwargs) # noqa: E501 - return data - - async def create_collection_with_http_info(self, body, **kwargs): # noqa: E501 - """Create collection # noqa: E501 - - This operation creates a new retrieval collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_collection_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionCreateRequest body: (required) - :return: CollectionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method create_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `create_collection`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionCreateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def create_record(self, body, collection_id, **kwargs): # noqa: E501 - """Create record # noqa: E501 - - Create a new record in a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_record(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordCreateRequest body: (required) - :param object collection_id: (required) - :return: RecordCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.create_record_with_http_info(body, collection_id, **kwargs) # noqa: E501 - else: - (data) = await self.create_record_with_http_info(body, collection_id, **kwargs) # noqa: E501 - return data - - async def create_record_with_http_info(self, body, collection_id, **kwargs): # noqa: E501 - """Create record # noqa: E501 - - Create a new record in a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_record_with_http_info(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordCreateRequest body: (required) - :param object collection_id: (required) - :return: RecordCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method create_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `create_record`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `create_record`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}/records", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordCreateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def delete_collection(self, collection_id, **kwargs): # noqa: E501 - """Delete collection # noqa: E501 - - This operation deletes a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_collection(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: DeleteCollectionResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.delete_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - else: - (data) = await self.delete_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - return data - - async def delete_collection_with_http_info(self, collection_id, **kwargs): # noqa: E501 - """Delete collection # noqa: E501 - - This operation deletes a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_collection_with_http_info(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: DeleteCollectionResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method delete_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `delete_collection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="DeleteCollectionResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def delete_record(self, collection_id, record_id, **kwargs): # noqa: E501 - """Delete record # noqa: E501 - - Delete a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_record(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.delete_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - else: - (data) = await self.delete_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - return data - - async def delete_record_with_http_info(self, collection_id, record_id, **kwargs): # noqa: E501 - """Delete record # noqa: E501 - - Delete a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_record_with_http_info(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id", "record_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method delete_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `delete_record`" - ) # noqa: E501 - # verify the required parameter 'record_id' is set - if "record_id" not in params or params["record_id"] is None: - raise ValueError("Missing the required parameter `record_id` when calling `delete_record`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - if "record_id" in params: - path_params["record_id"] = params["record_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}/records/{record_id}", - "DELETE", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordDeleteResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def get_collection(self, collection_id, **kwargs): # noqa: E501 - """Get collection # noqa: E501 - - This operation returns a single collection in your Text Base by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_collection(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: CollectionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.get_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_collection_with_http_info(collection_id, **kwargs) # noqa: E501 - return data - - async def get_collection_with_http_info(self, collection_id, **kwargs): # noqa: E501 - """Get collection # noqa: E501 - - This operation returns a single collection in your Text Base by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_collection_with_http_info(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :return: CollectionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method get_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `get_collection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionGetResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def get_record(self, collection_id, record_id, **kwargs): # noqa: E501 - """Get record # noqa: E501 - - Retrieve a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_record(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.get_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_record_with_http_info(collection_id, record_id, **kwargs) # noqa: E501 - return data - - async def get_record_with_http_info(self, collection_id, record_id, **kwargs): # noqa: E501 - """Get record # noqa: E501 - - Retrieve a specific record from a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_record_with_http_info(collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id", "record_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method get_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError("Missing the required parameter `collection_id` when calling `get_record`") # noqa: E501 - # verify the required parameter 'record_id' is set - if "record_id" not in params or params["record_id"] is None: - raise ValueError("Missing the required parameter `record_id` when calling `get_record`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - if "record_id" in params: - path_params["record_id"] = params["record_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}/records/{record_id}", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordGetResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def list_collections(self, **kwargs): # noqa: E501 - """List collections # noqa: E501 - - This operation returns a list of your retrieval collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_collections(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: CollectionListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.list_collections_with_http_info(**kwargs) # noqa: E501 - else: - (data) = await self.list_collections_with_http_info(**kwargs) # noqa: E501 - return data - - async def list_collections_with_http_info(self, **kwargs): # noqa: E501 - """List collections # noqa: E501 - - This operation returns a list of your retrieval collections. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_collections_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: CollectionListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["limit", "order", "after", "before"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method list_collections" % key) - params[key] = val - del params["kwargs"] - - collection_formats = {} - - path_params = {} - - query_params = [] - if "limit" in params: - query_params.append(("limit", params["limit"])) # noqa: E501 - if "order" in params: - query_params.append(("order", params["order"])) # noqa: E501 - if "after" in params: - query_params.append(("after", params["after"])) # noqa: E501 - if "before" in params: - query_params.append(("before", params["before"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionListResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def list_records(self, collection_id, **kwargs): # noqa: E501 - """List records # noqa: E501 - - Retrieve a paginated list of records from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_records(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: RecordListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.list_records_with_http_info(collection_id, **kwargs) # noqa: E501 - else: - (data) = await self.list_records_with_http_info(collection_id, **kwargs) # noqa: E501 - return data - - async def list_records_with_http_info(self, collection_id, **kwargs): # noqa: E501 - """List records # noqa: E501 - - Retrieve a paginated list of records from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_records_with_http_info(collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object collection_id: (required) - :param object limit: - :param object order: - :param object after: - :param object before: - :return: RecordListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["collection_id", "limit", "order", "after", "before"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method list_records" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError("Missing the required parameter `collection_id` when calling `list_records`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - if "limit" in params: - query_params.append(("limit", params["limit"])) # noqa: E501 - if "order" in params: - query_params.append(("order", params["order"])) # noqa: E501 - if "after" in params: - query_params.append(("after", params["after"])) # noqa: E501 - if "before" in params: - query_params.append(("before", params["before"])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}/records", - "GET", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordListResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def query_chunks(self, body, collection_id, **kwargs): # noqa: E501 - """Query chunks # noqa: E501 - - Query the most relevant chunks from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.query_chunks(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChunkQueryRequest body: (required) - :param object collection_id: (required) - :return: ChunkQueryResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.query_chunks_with_http_info(body, collection_id, **kwargs) # noqa: E501 - else: - (data) = await self.query_chunks_with_http_info(body, collection_id, **kwargs) # noqa: E501 - return data - - async def query_chunks_with_http_info(self, body, collection_id, **kwargs): # noqa: E501 - """Query chunks # noqa: E501 - - Query the most relevant chunks from a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.query_chunks_with_http_info(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ChunkQueryRequest body: (required) - :param object collection_id: (required) - :return: ChunkQueryResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method query_chunks" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `query_chunks`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError("Missing the required parameter `collection_id` when calling `query_chunks`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}/chunks/query", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="ChunkQueryResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def update_collection(self, body, collection_id, **kwargs): # noqa: E501 - """Update collection # noqa: E501 - - This operation updates the metadata of a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_collection(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionUpdateRequest body: (required) - :param object collection_id: (required) - :return: CollectionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.update_collection_with_http_info(body, collection_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_collection_with_http_info(body, collection_id, **kwargs) # noqa: E501 - return data - - async def update_collection_with_http_info(self, body, collection_id, **kwargs): # noqa: E501 - """Update collection # noqa: E501 - - This operation updates the metadata of a specific collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_collection_with_http_info(body, collection_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param CollectionUpdateRequest body: (required) - :param object collection_id: (required) - :return: CollectionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method update_collection" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `update_collection`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `update_collection`" - ) # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="CollectionUpdateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) - - async def update_record(self, body, collection_id, record_id, **kwargs): # noqa: E501 - """Update record # noqa: E501 - - Modify the metadata of a specific record within a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_record(body, collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordUpdateRequest body: (required) - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs["_return_http_data_only"] = True - if kwargs.get("async_req"): - return await self.update_record_with_http_info(body, collection_id, record_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_record_with_http_info(body, collection_id, record_id, **kwargs) # noqa: E501 - return data - - async def update_record_with_http_info(self, body, collection_id, record_id, **kwargs): # noqa: E501 - """Update record # noqa: E501 - - Modify the metadata of a specific record within a collection. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_record_with_http_info(body, collection_id, record_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param RecordUpdateRequest body: (required) - :param object collection_id: (required) - :param object record_id: (required) - :return: RecordUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ["body", "collection_id", "record_id"] # noqa: E501 - all_params.append("async_req") - all_params.append("_return_http_data_only") - all_params.append("_preload_content") - all_params.append("_request_timeout") - - params = locals() - for key, val in six.iteritems(params["kwargs"]): - if key not in all_params: - raise TypeError("Got an unexpected keyword argument '%s'" " to method update_record" % key) - params[key] = val - del params["kwargs"] - # verify the required parameter 'body' is set - if "body" not in params or params["body"] is None: - raise ValueError("Missing the required parameter `body` when calling `update_record`") # noqa: E501 - # verify the required parameter 'collection_id' is set - if "collection_id" not in params or params["collection_id"] is None: - raise ValueError( - "Missing the required parameter `collection_id` when calling `update_record`" - ) # noqa: E501 - # verify the required parameter 'record_id' is set - if "record_id" not in params or params["record_id"] is None: - raise ValueError("Missing the required parameter `record_id` when calling `update_record`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if "collection_id" in params: - path_params["collection_id"] = params["collection_id"] # noqa: E501 - if "record_id" in params: - path_params["record_id"] = params["record_id"] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if "body" in params: - body_params = params["body"] - # HTTP header `Accept` - header_params["Accept"] = self.api_client.select_header_accept(["application/json"]) # noqa: E501 - - # HTTP header `Content-Type` - header_params["Content-Type"] = self.api_client.select_header_content_type( # noqa: E501 - ["application/json"] - ) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - "/v1/collections/{collection_id}/records/{record_id}", - "POST", - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type="RecordUpdateResponse", # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get("_return_http_data_only"), - _preload_content=params.get("_preload_content", True), - _request_timeout=params.get("_request_timeout"), - collection_formats=collection_formats, - ) diff --git a/taskingai/client/api/tool_api.py b/taskingai/client/api/tool_api.py deleted file mode 100644 index 0676975..0000000 --- a/taskingai/client/api/tool_api.py +++ /dev/null @@ -1,1118 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import SyncApiClient - - -class ToolApi(object): - - def __init__(self, api_client=None): - if api_client is None: - api_client = SyncApiClient() - self.api_client = api_client - - def bulk_create_action(self, body, **kwargs): # noqa: E501 - """Bulk create action # noqa: E501 - - Bulk create actions with an OpenAPI schema. If there are multiple paths and methods in the schema, multiple actions will be created. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.bulk_create_action(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionBulkCreateRequest body: (required) - :return: ActionBulkCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.bulk_create_action_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.bulk_create_action_with_http_info(body, **kwargs) # noqa: E501 - return data - - def bulk_create_action_with_http_info(self, body, **kwargs): # noqa: E501 - """Bulk create action # noqa: E501 - - Bulk create actions with an OpenAPI schema. If there are multiple paths and methods in the schema, multiple actions will be created. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.bulk_create_action_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionBulkCreateRequest body: (required) - :return: ActionBulkCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method bulk_create_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `bulk_create_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/actions/bulk_create', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionBulkCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def create_function(self, body, **kwargs): # noqa: E501 - """Create function # noqa: E501 - - This operation creates a new function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_function(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionCreateRequest body: (required) - :return: FunctionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.create_function_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = self.create_function_with_http_info(body, **kwargs) # noqa: E501 - return data - - def create_function_with_http_info(self, body, **kwargs): # noqa: E501 - """Create function # noqa: E501 - - This operation creates a new function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_function_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionCreateRequest body: (required) - :return: FunctionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/functions', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_action(self, action_id, **kwargs): # noqa: E501 - """Delete an action # noqa: E501 - - Remove an existing action from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_action(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.delete_action_with_http_info(action_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_action_with_http_info(action_id, **kwargs) # noqa: E501 - return data - - def delete_action_with_http_info(self, action_id, **kwargs): # noqa: E501 - """Delete an action # noqa: E501 - - Remove an existing action from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_action_with_http_info(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `delete_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/actions/{action_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def delete_function(self, function_id, **kwargs): # noqa: E501 - """Delete function # noqa: E501 - - Remove an existing function from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_function(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.delete_function_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.delete_function_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def delete_function_with_http_info(self, function_id, **kwargs): # noqa: E501 - """Delete function # noqa: E501 - - Remove an existing function from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_function_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in params or - params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `delete_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in params: - path_params['function_id'] = params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/functions/{function_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_action(self, action_id, **kwargs): # noqa: E501 - """Get action # noqa: E501 - - This operation returns a single action in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_action(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_action_with_http_info(action_id, **kwargs) # noqa: E501 - else: - (data) = self.get_action_with_http_info(action_id, **kwargs) # noqa: E501 - return data - - def get_action_with_http_info(self, action_id, **kwargs): # noqa: E501 - """Get action # noqa: E501 - - This operation returns a single action in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_action_with_http_info(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `get_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/actions/{action_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def get_function(self, function_id, **kwargs): # noqa: E501 - """Get function # noqa: E501 - - This operation returns a single function in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_function(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.get_function_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = self.get_function_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - def get_function_with_http_info(self, function_id, **kwargs): # noqa: E501 - """Get function # noqa: E501 - - This operation returns a single function in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_function_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in params or - params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `get_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in params: - path_params['function_id'] = params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/functions/{function_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_actions(self, **kwargs): # noqa: E501 - """List actions # noqa: E501 - - This operation returns a list of all your actions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_actions(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ActionListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_actions_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_actions_with_http_info(**kwargs) # noqa: E501 - return data - - def list_actions_with_http_info(self, **kwargs): # noqa: E501 - """List actions # noqa: E501 - - This operation returns a list of all your actions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_actions_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ActionListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_actions" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/actions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def list_functions(self, **kwargs): # noqa: E501 - """List functions # noqa: E501 - - This operation returns a list of all your functions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_functions(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: FunctionListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.list_functions_with_http_info(**kwargs) # noqa: E501 - else: - (data) = self.list_functions_with_http_info(**kwargs) # noqa: E501 - return data - - def list_functions_with_http_info(self, **kwargs): # noqa: E501 - """List functions # noqa: E501 - - This operation returns a list of all your functions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_functions_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: FunctionListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_functions" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/functions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def run_action(self, body, action_id, **kwargs): # noqa: E501 - """Run an action # noqa: E501 - - Run and test an action with API call. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.run_action(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionRunRequest body: (required) - :param object action_id: (required) - :return: ActionRunResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.run_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - else: - (data) = self.run_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - return data - - def run_action_with_http_info(self, body, action_id, **kwargs): # noqa: E501 - """Run an action # noqa: E501 - - Run and test an action with API call. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.run_action_with_http_info(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionRunRequest body: (required) - :param object action_id: (required) - :return: ActionRunResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method run_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `run_action`") # noqa: E501 - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `run_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/actions/{action_id}/run', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionRunResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_action(self, body, action_id, **kwargs): # noqa: E501 - """Update action # noqa: E501 - - Update an existing action with an OpenAPI schema. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_action(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionUpdateRequest body: (required) - :param object action_id: (required) - :return: ActionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - else: - (data) = self.update_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - return data - - def update_action_with_http_info(self, body, action_id, **kwargs): # noqa: E501 - """Update action # noqa: E501 - - Update an existing action with an OpenAPI schema. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_action_with_http_info(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionUpdateRequest body: (required) - :param object action_id: (required) - :return: ActionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_action`") # noqa: E501 - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `update_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/actions/{action_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - def update_function(self, body, function_id, **kwargs): # noqa: E501 - """Update function # noqa: E501 - - Update a function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_function(body, function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionUpdateRequest body: (required) - :param object function_id: (required) - :return: FunctionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return self.update_function_with_http_info(body, function_id, **kwargs) # noqa: E501 - else: - (data) = self.update_function_with_http_info(body, function_id, **kwargs) # noqa: E501 - return data - - def update_function_with_http_info(self, body, function_id, **kwargs): # noqa: E501 - """Update function # noqa: E501 - - Update a function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_function_with_http_info(body, function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionUpdateRequest body: (required) - :param object function_id: (required) - :return: FunctionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_function`") # noqa: E501 - # verify the required parameter 'function_id' is set - if ('function_id' not in params or - params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `update_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in params: - path_params['function_id'] = params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return self.api_client.call_api( - '/v1/functions/{function_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/taskingai/client/api/tool_async_api.py b/taskingai/client/api/tool_async_api.py deleted file mode 100644 index 3813387..0000000 --- a/taskingai/client/api/tool_async_api.py +++ /dev/null @@ -1,1118 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from __future__ import absolute_import - -import re # noqa: F401 - -# python 2 and python 3 compatibility library -import six - -from taskingai.client.api_client import AsyncApiClient - - -class AsyncToolApi(object): - - def __init__(self, api_client=None): - if api_client is None: - api_client = AsyncApiClient() - self.api_client = api_client - - async def bulk_create_action(self, body, **kwargs): # noqa: E501 - """Bulk create action # noqa: E501 - - Bulk create actions with an OpenAPI schema. If there are multiple paths and methods in the schema, multiple actions will be created. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.bulk_create_action(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionBulkCreateRequest body: (required) - :return: ActionBulkCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.bulk_create_action_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = await self.bulk_create_action_with_http_info(body, **kwargs) # noqa: E501 - return data - - async def bulk_create_action_with_http_info(self, body, **kwargs): # noqa: E501 - """Bulk create action # noqa: E501 - - Bulk create actions with an OpenAPI schema. If there are multiple paths and methods in the schema, multiple actions will be created. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.bulk_create_action_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionBulkCreateRequest body: (required) - :return: ActionBulkCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method bulk_create_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `bulk_create_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/actions/bulk_create', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionBulkCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def create_function(self, body, **kwargs): # noqa: E501 - """Create function # noqa: E501 - - This operation creates a new function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_function(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionCreateRequest body: (required) - :return: FunctionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.create_function_with_http_info(body, **kwargs) # noqa: E501 - else: - (data) = await self.create_function_with_http_info(body, **kwargs) # noqa: E501 - return data - - async def create_function_with_http_info(self, body, **kwargs): # noqa: E501 - """Create function # noqa: E501 - - This operation creates a new function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.create_function_with_http_info(body, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionCreateRequest body: (required) - :return: FunctionCreateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method create_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `create_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/functions', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionCreateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def delete_action(self, action_id, **kwargs): # noqa: E501 - """Delete an action # noqa: E501 - - Remove an existing action from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_action(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.delete_action_with_http_info(action_id, **kwargs) # noqa: E501 - else: - (data) = await self.delete_action_with_http_info(action_id, **kwargs) # noqa: E501 - return data - - async def delete_action_with_http_info(self, action_id, **kwargs): # noqa: E501 - """Delete an action # noqa: E501 - - Remove an existing action from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_action_with_http_info(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `delete_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/actions/{action_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def delete_function(self, function_id, **kwargs): # noqa: E501 - """Delete function # noqa: E501 - - Remove an existing function from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_function(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.delete_function_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = await self.delete_function_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - async def delete_function_with_http_info(self, function_id, **kwargs): # noqa: E501 - """Delete function # noqa: E501 - - Remove an existing function from your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.delete_function_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionDeleteResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method delete_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in params or - params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `delete_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in params: - path_params['function_id'] = params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/functions/{function_id}', 'DELETE', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionDeleteResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def get_action(self, action_id, **kwargs): # noqa: E501 - """Get action # noqa: E501 - - This operation returns a single action in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_action(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.get_action_with_http_info(action_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_action_with_http_info(action_id, **kwargs) # noqa: E501 - return data - - async def get_action_with_http_info(self, action_id, **kwargs): # noqa: E501 - """Get action # noqa: E501 - - This operation returns a single action in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_action_with_http_info(action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object action_id: (required) - :return: ActionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `get_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/actions/{action_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def get_function(self, function_id, **kwargs): # noqa: E501 - """Get function # noqa: E501 - - This operation returns a single function in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_function(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.get_function_with_http_info(function_id, **kwargs) # noqa: E501 - else: - (data) = await self.get_function_with_http_info(function_id, **kwargs) # noqa: E501 - return data - - async def get_function_with_http_info(self, function_id, **kwargs): # noqa: E501 - """Get function # noqa: E501 - - This operation returns a single function in your project by its unique ID. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.get_function_with_http_info(function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object function_id: (required) - :return: FunctionGetResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method get_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'function_id' is set - if ('function_id' not in params or - params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `get_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in params: - path_params['function_id'] = params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/functions/{function_id}', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionGetResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def list_actions(self, **kwargs): # noqa: E501 - """List actions # noqa: E501 - - This operation returns a list of all your actions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_actions(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ActionListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.list_actions_with_http_info(**kwargs) # noqa: E501 - else: - (data) = await self.list_actions_with_http_info(**kwargs) # noqa: E501 - return data - - async def list_actions_with_http_info(self, **kwargs): # noqa: E501 - """List actions # noqa: E501 - - This operation returns a list of all your actions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_actions_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: ActionListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_actions" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/actions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def list_functions(self, **kwargs): # noqa: E501 - """List functions # noqa: E501 - - This operation returns a list of all your functions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_functions(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: FunctionListResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.list_functions_with_http_info(**kwargs) # noqa: E501 - else: - (data) = await self.list_functions_with_http_info(**kwargs) # noqa: E501 - return data - - async def list_functions_with_http_info(self, **kwargs): # noqa: E501 - """List functions # noqa: E501 - - This operation returns a list of all your functions in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.list_functions_with_http_info(async_req=True) - >>> result = thread.get() - - :param async_req bool - :param object limit: - :param object order: - :param object after: - :param object before: - :return: FunctionListResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['limit', 'order', 'after', 'before'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method list_functions" % key - ) - params[key] = val - del params['kwargs'] - - collection_formats = {} - - path_params = {} - - query_params = [] - if 'limit' in params: - query_params.append(('limit', params['limit'])) # noqa: E501 - if 'order' in params: - query_params.append(('order', params['order'])) # noqa: E501 - if 'after' in params: - query_params.append(('after', params['after'])) # noqa: E501 - if 'before' in params: - query_params.append(('before', params['before'])) # noqa: E501 - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/functions', 'GET', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionListResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def run_action(self, body, action_id, **kwargs): # noqa: E501 - """Run an action # noqa: E501 - - Run and test an action with API call. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.run_action(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionRunRequest body: (required) - :param object action_id: (required) - :return: ActionRunResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.run_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - else: - (data) = await self.run_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - return data - - async def run_action_with_http_info(self, body, action_id, **kwargs): # noqa: E501 - """Run an action # noqa: E501 - - Run and test an action with API call. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.run_action_with_http_info(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionRunRequest body: (required) - :param object action_id: (required) - :return: ActionRunResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method run_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `run_action`") # noqa: E501 - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `run_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/actions/{action_id}/run', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionRunResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def update_action(self, body, action_id, **kwargs): # noqa: E501 - """Update action # noqa: E501 - - Update an existing action with an OpenAPI schema. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_action(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionUpdateRequest body: (required) - :param object action_id: (required) - :return: ActionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.update_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_action_with_http_info(body, action_id, **kwargs) # noqa: E501 - return data - - async def update_action_with_http_info(self, body, action_id, **kwargs): # noqa: E501 - """Update action # noqa: E501 - - Update an existing action with an OpenAPI schema. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_action_with_http_info(body, action_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param ActionUpdateRequest body: (required) - :param object action_id: (required) - :return: ActionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'action_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_action" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_action`") # noqa: E501 - # verify the required parameter 'action_id' is set - if ('action_id' not in params or - params['action_id'] is None): - raise ValueError("Missing the required parameter `action_id` when calling `update_action`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'action_id' in params: - path_params['action_id'] = params['action_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/actions/{action_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='ActionUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) - - async def update_function(self, body, function_id, **kwargs): # noqa: E501 - """Update function # noqa: E501 - - Update a function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_function(body, function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionUpdateRequest body: (required) - :param object function_id: (required) - :return: FunctionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - kwargs['_return_http_data_only'] = True - if kwargs.get('async_req'): - return await self.update_function_with_http_info(body, function_id, **kwargs) # noqa: E501 - else: - (data) = await self.update_function_with_http_info(body, function_id, **kwargs) # noqa: E501 - return data - - async def update_function_with_http_info(self, body, function_id, **kwargs): # noqa: E501 - """Update function # noqa: E501 - - Update a function in your project. # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - >>> thread = api.update_function_with_http_info(body, function_id, async_req=True) - >>> result = thread.get() - - :param async_req bool - :param FunctionUpdateRequest body: (required) - :param object function_id: (required) - :return: FunctionUpdateResponse - If the method is called asynchronously, - returns the request thread. - """ - - all_params = ['body', 'function_id'] # noqa: E501 - all_params.append('async_req') - all_params.append('_return_http_data_only') - all_params.append('_preload_content') - all_params.append('_request_timeout') - - params = locals() - for key, val in six.iteritems(params['kwargs']): - if key not in all_params: - raise TypeError( - "Got an unexpected keyword argument '%s'" - " to method update_function" % key - ) - params[key] = val - del params['kwargs'] - # verify the required parameter 'body' is set - if ('body' not in params or - params['body'] is None): - raise ValueError("Missing the required parameter `body` when calling `update_function`") # noqa: E501 - # verify the required parameter 'function_id' is set - if ('function_id' not in params or - params['function_id'] is None): - raise ValueError("Missing the required parameter `function_id` when calling `update_function`") # noqa: E501 - - collection_formats = {} - - path_params = {} - if 'function_id' in params: - path_params['function_id'] = params['function_id'] # noqa: E501 - - query_params = [] - - header_params = {} - - form_params = [] - local_var_files = {} - - body_params = None - if 'body' in params: - body_params = params['body'] - # HTTP header `Accept` - header_params['Accept'] = self.api_client.select_header_accept( - ['application/json']) # noqa: E501 - - # HTTP header `Content-Type` - header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501 - ['application/json']) # noqa: E501 - - # Authentication setting - auth_settings = [] # noqa: E501 - - return await self.api_client.call_api( - '/v1/functions/{function_id}', 'POST', - path_params, - query_params, - header_params, - body=body_params, - post_params=form_params, - files=local_var_files, - response_type='FunctionUpdateResponse', # noqa: E501 - auth_settings=auth_settings, - _return_http_data_only=params.get('_return_http_data_only'), - _preload_content=params.get('_preload_content', True), - _request_timeout=params.get('_request_timeout'), - collection_formats=collection_formats) diff --git a/taskingai/client/api_client.py b/taskingai/client/api_client.py index 6c6810e..abe9bfc 100644 --- a/taskingai/client/api_client.py +++ b/taskingai/client/api_client.py @@ -12,6 +12,7 @@ import os import re import tempfile +from typing import Type # python 2 and python 3 compatibility library import six @@ -19,7 +20,6 @@ from taskingai.client.configuration import Configuration from taskingai.client import rest -import taskingai.client as client from pydantic import BaseModel @@ -45,18 +45,17 @@ class BaseApiClient(object): PRIMITIVE_TYPES = (float, bool, bytes, six.text_type) + six.integer_types NATIVE_TYPES_MAPPING = { - 'int': int, - 'long': int if six.PY3 else long, # noqa: F821 - 'float': float, - 'str': str, - 'bool': bool, - 'date': datetime.date, - 'datetime': datetime.datetime, - 'object': object, + "int": int, + "long": int if six.PY3 else long, # noqa: F821 + "float": float, + "str": str, + "bool": bool, + "date": datetime.date, + "datetime": datetime.datetime, + "object": object, } - def __init__(self, configuration=None, header_name=None, header_value=None, - cookie=None): + def __init__(self, configuration=None, header_name=None, header_value=None, cookie=None): if configuration is None: configuration = Configuration() self.configuration = configuration @@ -66,65 +65,21 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie # Set default User-Agent. - self.user_agent = 'TaskingAI-Client/1.0.0/python' + self.user_agent = "TaskingAI-Client/1.0.0/python" @property def user_agent(self): """User agent for this API client""" - return self.default_headers['User-Agent'] + return self.default_headers["User-Agent"] @user_agent.setter def user_agent(self, value): - self.default_headers['User-Agent'] = value + self.default_headers["User-Agent"] = value def set_default_header(self, header_name, header_value): self.default_headers[header_name] = header_value - def sanitize_for_serialization(self, obj): - """Builds a JSON POST object. - - If obj is None, return None. - If obj is str, int, long, float, bool, return directly. - If obj is datetime.datetime, datetime.date - convert to string in iso8601 format. - If obj is list, sanitize each element in the list. - If obj is dict, return the dict. - If obj is swagger model, return the properties dict. - - :param obj: The data to serialize. - :return: The serialized form of data. - """ - if obj is None: - return None - elif isinstance(obj, self.PRIMITIVE_TYPES): - return obj - elif isinstance(obj, list): - return [self.sanitize_for_serialization(sub_obj) - for sub_obj in obj] - elif isinstance(obj, tuple): - return tuple(self.sanitize_for_serialization(sub_obj) - for sub_obj in obj) - elif isinstance(obj, (datetime.datetime, datetime.date)): - return obj.isoformat() - elif isinstance(obj, BaseModel): - return obj.model_dump() - - if isinstance(obj, dict): - obj_dict = obj - else: - # Convert model obj to dict except - # attributes `swagger_types`, `attribute_map` - # and attributes which value is not None. - # Convert attribute name to json key in - # model definition for request. - obj_dict = {obj.attribute_map[attr]: getattr(obj, attr) - for attr, _ in six.iteritems(obj.swagger_types) - if getattr(obj, attr) is not None} - - return {key: self.sanitize_for_serialization(val) - for key, val in six.iteritems(obj_dict)} - - def deserialize(self, response, response_type): + def deserialize(self, response, response_type: Type[BaseModel]): """Deserializes response into an object. :param response: RESTResponse object to be deserialized. @@ -144,76 +99,7 @@ def deserialize(self, response, response_type): except ValueError: data = response.data - return self.__deserialize(data, response_type) - - def __deserialize(self, data, klass): - """Deserializes dict, list, str into an object. - - :param data: dict, list or str. - :param klass: class literal, or string of class name. - - :return: object. - """ - if data is None: - return None - - if type(klass) == str: - if klass.startswith('list['): - sub_kls = re.match(r'list\[(.*)\]', klass).group(1) - return [self.__deserialize(sub_data, sub_kls) - for sub_data in data] - - if klass.startswith('dict('): - sub_kls = re.match(r'dict\(([^,]*), (.*)\)', klass).group(2) - return {k: self.__deserialize(v, sub_kls) - for k, v in six.iteritems(data)} - - # convert str to class - if klass in self.NATIVE_TYPES_MAPPING: - klass = self.NATIVE_TYPES_MAPPING[klass] - else: - klass = getattr(client.models, klass) - - if klass in self.PRIMITIVE_TYPES: - return self.__deserialize_primitive(data, klass) - elif klass == object: - return self.__deserialize_object(data) - elif klass == datetime.date: - return self.__deserialize_date(data) - elif klass == datetime.datetime: - return self.__deserialize_datatime(data) - else: - return self.__deserialize_model(data, klass) - - def parameters_to_tuples(self, params, collection_formats): - """Get parameters as list of tuples, formatting collections. - - :param params: Parameters as dict or list of two-tuples - :param dict collection_formats: Parameter collection formats - :return: Parameters as list of tuples, collections formatted - """ - new_params = [] - if collection_formats is None: - collection_formats = {} - for k, v in six.iteritems(params) if isinstance(params, dict) else params: # noqa: E501 - if k in collection_formats: - collection_format = collection_formats[k] - if collection_format == 'multi': - new_params.extend((k, value) for value in v) - else: - if collection_format == 'ssv': - delimiter = ' ' - elif collection_format == 'tsv': - delimiter = '\t' - elif collection_format == 'pipes': - delimiter = '|' - else: # csv is the default - delimiter = ',' - new_params.append( - (k, delimiter.join(str(value) for value in v))) - else: - new_params.append((k, v)) - return new_params + return response_type(**data) def prepare_post_parameters(self, post_params=None, files=None): """Builds form parameters. @@ -233,13 +119,11 @@ def prepare_post_parameters(self, post_params=None, files=None): continue file_names = v if type(v) is list else [v] for n in file_names: - with open(n, 'rb') as f: + with open(n, "rb") as f: filename = os.path.basename(f.name) filedata = f.read() - mimetype = (mimetypes.guess_type(filename)[0] or - 'application/octet-stream') - params.append( - tuple([k, tuple([filename, filedata, mimetype])])) + mimetype = mimetypes.guess_type(filename)[0] or "application/octet-stream" + params.append(tuple([k, tuple([filename, filedata, mimetype])])) return params @@ -254,10 +138,10 @@ def select_header_accept(self, accepts): accepts = [x.lower() for x in accepts] - if 'application/json' in accepts: - return 'application/json' + if "application/json" in accepts: + return "application/json" else: - return ', '.join(accepts) + return ", ".join(accepts) def select_header_content_type(self, content_types): """Returns `Content-Type` based on an array of content_types provided. @@ -266,12 +150,12 @@ def select_header_content_type(self, content_types): :return: Content-Type (e.g. application/json). """ if not content_types: - return 'application/json' + return "application/json" content_types = [x.lower() for x in content_types] - if 'application/json' in content_types or '*/*' in content_types: - return 'application/json' + if "application/json" in content_types or "*/*" in content_types: + return "application/json" else: return content_types[0] @@ -288,16 +172,14 @@ def update_params_for_auth(self, headers, querys, auth_settings): for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if not auth_setting['value']: + if not auth_setting["value"]: continue - elif auth_setting['in'] == 'header': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) + elif auth_setting["in"] == "header": + headers[auth_setting["key"]] = auth_setting["value"] + elif auth_setting["in"] == "query": + querys.append((auth_setting["key"], auth_setting["value"])) else: - raise ValueError( - 'Authentication token must be in `query` or `header`' - ) + raise ValueError("Authentication token must be in `query` or `header`") def __deserialize_file(self, response): """Deserializes body to file @@ -314,187 +196,86 @@ def __deserialize_file(self, response): content_disposition = response.getheader("Content-Disposition") if content_disposition: - filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', - content_disposition).group(1) + filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition).group(1) path = os.path.join(os.path.dirname(path), filename) response_data = response.data with open(path, "wb") as f: if isinstance(response_data, str): # change str to bytes so we can write it - response_data = response_data.encode('utf-8') + response_data = response_data.encode("utf-8") f.write(response_data) else: f.write(response_data) return path - def __deserialize_primitive(self, data, klass): - """Deserializes string to primitive type. - - :param data: str. - :param klass: class literal. - - :return: int, long, float, str, bool. - """ - try: - return klass(data) - except UnicodeEncodeError: - return six.text_type(data) - except TypeError: - return data - - def __deserialize_object(self, value): - """Return a original value. - - :return: object. - """ - return value - - def __deserialize_date(self, string): - """Deserializes string to date. - - :param string: str. - :return: date. - """ - try: - from dateutil.parser import parse - return parse(string).date() - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason="Failed to parse `{0}` as date object".format(string) - ) - - def __deserialize_datatime(self, string): - """Deserializes string to datetime. - - The string should be in iso8601 datetime format. - - :param string: str. - :return: datetime. - """ - try: - from dateutil.parser import parse - return parse(string) - except ImportError: - return string - except ValueError: - raise rest.ApiException( - status=0, - reason=( - "Failed to parse `{0}` as datetime object" - .format(string) - ) - ) - def __hasattr(self, object, name): - return name in object.__class__.__dict__ - - def __deserialize_model(self, data, klass): - """Deserializes list or dict to model. - - :param data: dict, list. - :param klass: class literal. - :return: model object. - """ - - if not klass.swagger_types and not self.__hasattr(klass, 'get_real_child_model'): - return data - - kwargs = {} - if klass.swagger_types is not None: - for attr, attr_type in six.iteritems(klass.swagger_types): - if (data is not None and - klass.attribute_map[attr] in data and - isinstance(data, (list, dict))): - value = data[klass.attribute_map[attr]] - kwargs[attr] = self.__deserialize(value, attr_type) - - instance = klass(**kwargs) - - if (isinstance(instance, dict) and - klass.swagger_types is not None and - isinstance(data, dict)): - for key, value in data.items(): - if key not in klass.swagger_types: - instance[key] = value - if self.__hasattr(instance, 'get_real_child_model'): - klass_name = instance.get_real_child_model(data) - if klass_name: - instance = self.__deserialize(data, klass_name) - return instance + return name in object.__class__.__dict__ class SyncApiClient(BaseApiClient): - def __init__(self, *args, **kwargs): super(SyncApiClient, self).__init__(*args, **kwargs) self.rest_client = rest.RESTSyncClientObject(self.configuration) def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, stream=False): - + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + stream=False, + ): config = self.configuration # header parameters header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params['Cookie'] = self.cookie + header_params["Cookie"] = self.cookie if header_params: - header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) if config.api_key_prefix and config.api_key: - header_params['Authorization'] = f'{config.api_key_prefix} {config.api_key}' + header_params["Authorization"] = f"{config.api_key_prefix} {config.api_key}" # path parameters if path_params: - path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) - for k, v in path_params: + for k, v in path_params.items(): # specified safe chars, encode everything - resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) - - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) + resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)) # post parameters if post_params or files: post_params = self.prepare_post_parameters(post_params, files) - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) # auth setting self.update_params_for_auth(header_params, query_params, auth_settings) # body - if body: - body = self.sanitize_for_serialization(body) # request url url = self.configuration.host + resource_path # perform request and return response response_data = self.request( - method, url, stream=stream, - query_params=query_params, headers=header_params, - post_params=post_params, body=body, + method, + url, + stream=stream, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout) + _request_timeout=_request_timeout, + ) if stream: return response_data @@ -510,18 +291,28 @@ def __call_api( return_data = None if _return_http_data_only: - return (return_data) + return return_data else: - return (return_data, response_data.status, - response_data.getheaders()) - - - def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, stream=False): + return (return_data, response_data.status, response_data.getheaders()) + + def call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + stream=False, + ): """Makes the HTTP request (synchronous) and returns deserialized data. :param resource_path: Path to method endpoint. @@ -550,135 +341,165 @@ def call_api(self, resource_path, method, (connection, read) timeouts. :return: Response object data. """ - return self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, stream) - - - def request(self, method, url, stream=False, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): + return self.__call_api( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + stream, + ) + + def request( + self, + method, + url, + stream=False, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): """Makes the HTTP request using RESTClient.""" if method == "GET": - return self.rest_client.GET(url, - stream=stream, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.GET( + url, + stream=stream, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "HEAD": - return self.rest_client.HEAD(url, - stream=stream, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return self.rest_client.HEAD( + url, + stream=stream, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "OPTIONS": - return self.rest_client.OPTIONS(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.OPTIONS( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "POST": - return self.rest_client.POST(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.POST( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PUT": - return self.rest_client.PUT(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PUT( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PATCH": - return self.rest_client.PATCH(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return self.rest_client.PATCH( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "DELETE": - return self.rest_client.DELETE(url, - stream=stream, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ValueError( - "http method must be `GET`, `HEAD`, `OPTIONS`," - " `POST`, `PATCH`, `PUT` or `DELETE`." + return self.rest_client.DELETE( + url, + stream=stream, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, ) - + else: + raise ValueError("http method must be `GET`, `HEAD`, `OPTIONS`," " `POST`, `PATCH`, `PUT` or `DELETE`.") class AsyncApiClient(BaseApiClient): - def __init__(self, *args, **kwargs): super(AsyncApiClient, self).__init__(*args, **kwargs) # Initialize the asynchronous REST client here self.rest_client = rest.RESTAsyncClientObject(self.configuration) async def __call_api( - self, resource_path, method, path_params=None, - query_params=None, header_params=None, body=None, post_params=None, - files=None, response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, stream=False): - + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + stream=False, + ): config = self.configuration + # header parameters header_params = header_params or {} header_params.update(self.default_headers) if self.cookie: - header_params['Cookie'] = self.cookie + header_params["Cookie"] = self.cookie if header_params: - header_params = self.sanitize_for_serialization(header_params) - header_params = dict(self.parameters_to_tuples(header_params, - collection_formats)) if config.api_key_prefix and config.api_key: - header_params['Authorization'] = f'{config.api_key_prefix} {config.api_key}' + header_params["Authorization"] = f"{config.api_key_prefix} {config.api_key}" # path parameters if path_params: - path_params = self.sanitize_for_serialization(path_params) - path_params = self.parameters_to_tuples(path_params, - collection_formats) + path_params = self.parameters_to_tuples(path_params, collection_formats) for k, v in path_params: # specified safe chars, encode everything - resource_path = resource_path.replace( - '{%s}' % k, - quote(str(v), safe=config.safe_chars_for_path_param) - ) + resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)) # query parameters if query_params: query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, - collection_formats) + query_params = self.parameters_to_tuples(query_params, collection_formats) # post parameters if post_params or files: post_params = self.prepare_post_parameters(post_params, files) post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, - collection_formats) + post_params = self.parameters_to_tuples(post_params, collection_formats) # auth setting self.update_params_for_auth(header_params, query_params, auth_settings) @@ -692,11 +513,16 @@ async def __call_api( # perform request and return response response_data = await self.request( - method, url, stream, - query_params=query_params, headers=header_params, - post_params=post_params, body=body, + method, + url, + stream, + query_params=query_params, + headers=header_params, + post_params=post_params, + body=body, _preload_content=_preload_content, - _request_timeout=_request_timeout) + _request_timeout=_request_timeout, + ) if stream: return response_data @@ -712,114 +538,155 @@ async def __call_api( return_data = None if _return_http_data_only: - return (return_data) + return return_data else: - return (return_data, response_data.status, - response_data.getheaders()) - - async def call_api(self, resource_path, method, - path_params=None, query_params=None, header_params=None, - body=None, post_params=None, files=None, - response_type=None, auth_settings=None, - _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, stream=False): + return (return_data, response_data.status, response_data.getheaders()) + + async def call_api( + self, + resource_path, + method, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, + response_type=None, + auth_settings=None, + _return_http_data_only=None, + collection_formats=None, + _preload_content=True, + _request_timeout=None, + stream=False, + ): + """ + Asynchronously makes the HTTP request and returns deserialized data. + + This method prepares and executes an HTTP request asynchronously based on the specified parameters + and the method to be called. It supports various HTTP methods like GET, POST, PUT, DELETE, etc. + + :param resource_path: Path to the API endpoint. For example, '/items/{itemId}'. + :param method: HTTP method to be used for the request, e.g., 'GET', 'POST', 'PUT', 'DELETE'. + :param path_params: Dictionary of path parameters to be replaced in the resource_path. + :param query_params: Dictionary of query parameters to be appended to the URL. + :param header_params: Dictionary of header parameters to be included in the request header. + :param body: Payload to be sent with the request. Usually for POST/PUT/PATCH methods. + :param post_params: Dictionary of parameters for form-encoded data (used with POST, typically for file uploads). + :param files: Dictionary with file names as keys and file paths as values for multipart file uploading. + :param response_type: Expected data type of the response, e.g., a model class or a primitive type. + :param auth_settings: List of authentication setting names to configure the request. + :param _return_http_data_only: If True, returns only the data part of the response, excluding status code and headers. + :param collection_formats: Specifies the format of collection parameters (query, path, header, post parameters). + :param _preload_content: If False, the response object will be returned without reading/decoding response data. Default is True. + :param _request_timeout: Specifies the request timeout. Can be a single number (total timeout) or a tuple (connection, read timeouts). + + :return: If _return_http_data_only is True, returns only the data part of the response. + Otherwise, returns a tuple containing data, HTTP status code, and HTTP headers. """ - Asynchronously makes the HTTP request and returns deserialized data. - - This method prepares and executes an HTTP request asynchronously based on the specified parameters - and the method to be called. It supports various HTTP methods like GET, POST, PUT, DELETE, etc. - - :param resource_path: Path to the API endpoint. For example, '/items/{itemId}'. - :param method: HTTP method to be used for the request, e.g., 'GET', 'POST', 'PUT', 'DELETE'. - :param path_params: Dictionary of path parameters to be replaced in the resource_path. - :param query_params: Dictionary of query parameters to be appended to the URL. - :param header_params: Dictionary of header parameters to be included in the request header. - :param body: Payload to be sent with the request. Usually for POST/PUT/PATCH methods. - :param post_params: Dictionary of parameters for form-encoded data (used with POST, typically for file uploads). - :param files: Dictionary with file names as keys and file paths as values for multipart file uploading. - :param response_type: Expected data type of the response, e.g., a model class or a primitive type. - :param auth_settings: List of authentication setting names to configure the request. - :param _return_http_data_only: If True, returns only the data part of the response, excluding status code and headers. - :param collection_formats: Specifies the format of collection parameters (query, path, header, post parameters). - :param _preload_content: If False, the response object will be returned without reading/decoding response data. Default is True. - :param _request_timeout: Specifies the request timeout. Can be a single number (total timeout) or a tuple (connection, read timeouts). - - :return: If _return_http_data_only is True, returns only the data part of the response. - Otherwise, returns a tuple containing data, HTTP status code, and HTTP headers. - """ - - return await self.__call_api(resource_path, method, - path_params, query_params, header_params, - body, post_params, files, - response_type, auth_settings, - _return_http_data_only, collection_formats, - _preload_content, _request_timeout, stream) - - - async def request(self, method, url, stream, query_params=None, headers=None, - post_params=None, body=None, _preload_content=True, - _request_timeout=None): + + return await self.__call_api( + resource_path, + method, + path_params, + query_params, + header_params, + body, + post_params, + files, + response_type, + auth_settings, + _return_http_data_only, + collection_formats, + _preload_content, + _request_timeout, + stream, + ) + + async def request( + self, + method, + url, + stream, + query_params=None, + headers=None, + post_params=None, + body=None, + _preload_content=True, + _request_timeout=None, + ): """Makes the HTTP request using the asynchronous RESTClient.""" if method == "GET": - return await self.rest_client.GET(url, - stream=stream, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return await self.rest_client.GET( + url, + stream=stream, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "HEAD": - return await self.rest_client.HEAD(url, - stream=stream, - query_params=query_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - headers=headers) + return await self.rest_client.HEAD( + url, + stream=stream, + query_params=query_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + headers=headers, + ) elif method == "OPTIONS": - return await self.rest_client.OPTIONS(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return await self.rest_client.OPTIONS( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "POST": - return await self.rest_client.POST(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return await self.rest_client.POST( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PUT": - return await self.rest_client.PUT(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return await self.rest_client.PUT( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "PATCH": - return await self.rest_client.PATCH(url, - stream=stream, - query_params=query_params, - headers=headers, - post_params=post_params, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) + return await self.rest_client.PATCH( + url, + stream=stream, + query_params=query_params, + headers=headers, + post_params=post_params, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, + ) elif method == "DELETE": - return await self.rest_client.DELETE(url, - stream=stream, - query_params=query_params, - headers=headers, - _preload_content=_preload_content, - _request_timeout=_request_timeout, - body=body) - else: - raise ValueError( - "HTTP method must be `GET`, `HEAD`, `OPTIONS`, " - "`POST`, `PATCH`, `PUT`, or `DELETE`." + return await self.rest_client.DELETE( + url, + stream=stream, + query_params=query_params, + headers=headers, + _preload_content=_preload_content, + _request_timeout=_request_timeout, + body=body, ) + else: + raise ValueError("HTTP method must be `GET`, `HEAD`, `OPTIONS`, " "`POST`, `PATCH`, `PUT`, or `DELETE`.") diff --git a/taskingai/client/apis/__init__.py b/taskingai/client/apis/__init__.py new file mode 100644 index 0000000..caaa634 --- /dev/null +++ b/taskingai/client/apis/__init__.py @@ -0,0 +1,54 @@ +# -*- coding: utf-8 -*- + +# __init__.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from .api_bulk_create_actions import * +from .api_chat_completion import * +from .api_create_assistant import * +from .api_create_chat import * +from .api_create_chunk import * +from .api_create_collection import * +from .api_create_message import * +from .api_create_record import * +from .api_delete_action import * +from .api_delete_assistant import * +from .api_delete_chat import * +from .api_delete_chunk import * +from .api_delete_collection import * +from .api_delete_message import * +from .api_delete_record import * +from .api_generate_message import * +from .api_get_action import * +from .api_get_assistant import * +from .api_get_chat import * +from .api_get_chunk import * +from .api_get_collection import * +from .api_get_message import * +from .api_get_record import * +from .api_list_actions import * +from .api_list_assistants import * +from .api_list_chats import * +from .api_list_chunks import * +from .api_list_collections import * +from .api_list_messages import * +from .api_list_records import * +from .api_query_collection_chunks import * +from .api_run_action import * +from .api_text_embedding import * +from .api_update_action import * +from .api_update_assistant import * +from .api_update_chat import * +from .api_update_chunk import * +from .api_update_collection import * +from .api_update_message import * +from .api_update_record import * diff --git a/taskingai/client/apis/api_bulk_create_actions.py b/taskingai/client/apis/api_bulk_create_actions.py new file mode 100644 index 0000000..fbd4bf9 --- /dev/null +++ b/taskingai/client/apis/api_bulk_create_actions.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_bulk_create_actions.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ActionBulkCreateRequest, ActionBulkCreateResponse + +__all__ = ["api_bulk_create_actions", "async_api_bulk_create_actions"] + + +def api_bulk_create_actions(payload: ActionBulkCreateRequest, **kwargs) -> ActionBulkCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/actions/bulk_create", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionBulkCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_bulk_create_actions(payload: ActionBulkCreateRequest, **kwargs) -> ActionBulkCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/actions/bulk_create", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionBulkCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_chat_completion.py b/taskingai/client/apis/api_chat_completion.py new file mode 100644 index 0000000..22e533e --- /dev/null +++ b/taskingai/client/apis/api_chat_completion.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_chat_completion.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChatCompletionRequest, ChatCompletionResponse + +__all__ = ["api_chat_completion", "async_api_chat_completion"] + + +def api_chat_completion(payload: ChatCompletionRequest, **kwargs) -> ChatCompletionResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/inference/chat_completion", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatCompletionResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_chat_completion(payload: ChatCompletionRequest, **kwargs) -> ChatCompletionResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/inference/chat_completion", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatCompletionResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_create_assistant.py b/taskingai/client/apis/api_create_assistant.py new file mode 100644 index 0000000..0fa2e2b --- /dev/null +++ b/taskingai/client/apis/api_create_assistant.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_create_assistant.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import AssistantCreateRequest, AssistantCreateResponse + +__all__ = ["api_create_assistant", "async_api_create_assistant"] + + +def api_create_assistant(payload: AssistantCreateRequest, **kwargs) -> AssistantCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_create_assistant(payload: AssistantCreateRequest, **kwargs) -> AssistantCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_create_chat.py b/taskingai/client/apis/api_create_chat.py new file mode 100644 index 0000000..bbbf141 --- /dev/null +++ b/taskingai/client/apis/api_create_chat.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_create_chat.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChatCreateRequest, ChatCreateResponse + +__all__ = ["api_create_chat", "async_api_create_chat"] + + +def api_create_chat(assistant_id: str, payload: ChatCreateRequest, **kwargs) -> ChatCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_create_chat(assistant_id: str, payload: ChatCreateRequest, **kwargs) -> ChatCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_create_chunk.py b/taskingai/client/apis/api_create_chunk.py new file mode 100644 index 0000000..e16518e --- /dev/null +++ b/taskingai/client/apis/api_create_chunk.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_create_chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChunkCreateRequest, ChunkCreateResponse + +__all__ = ["api_create_chunk", "async_api_create_chunk"] + + +def api_create_chunk(collection_id: str, payload: ChunkCreateRequest, **kwargs) -> ChunkCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_create_chunk(collection_id: str, payload: ChunkCreateRequest, **kwargs) -> ChunkCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_create_collection.py b/taskingai/client/apis/api_create_collection.py new file mode 100644 index 0000000..1318f34 --- /dev/null +++ b/taskingai/client/apis/api_create_collection.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_create_collection.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import CollectionCreateRequest, CollectionCreateResponse + +__all__ = ["api_create_collection", "async_api_create_collection"] + + +def api_create_collection(payload: CollectionCreateRequest, **kwargs) -> CollectionCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_create_collection(payload: CollectionCreateRequest, **kwargs) -> CollectionCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_create_message.py b/taskingai/client/apis/api_create_message.py new file mode 100644 index 0000000..9818361 --- /dev/null +++ b/taskingai/client/apis/api_create_message.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +# api_create_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import MessageCreateRequest, MessageCreateResponse + +__all__ = ["api_create_message", "async_api_create_message"] + + +def api_create_message( + assistant_id: str, chat_id: str, payload: MessageCreateRequest, **kwargs +) -> MessageCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_create_message( + assistant_id: str, chat_id: str, payload: MessageCreateRequest, **kwargs +) -> MessageCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_create_record.py b/taskingai/client/apis/api_create_record.py new file mode 100644 index 0000000..596f43d --- /dev/null +++ b/taskingai/client/apis/api_create_record.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_create_record.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import RecordCreateRequest, RecordCreateResponse + +__all__ = ["api_create_record", "async_api_create_record"] + + +def api_create_record(collection_id: str, payload: RecordCreateRequest, **kwargs) -> RecordCreateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_create_record(collection_id: str, payload: RecordCreateRequest, **kwargs) -> RecordCreateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordCreateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_action.py b/taskingai/client/apis/api_delete_action.py new file mode 100644 index 0000000..5fcb04d --- /dev/null +++ b/taskingai/client/apis/api_delete_action.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_delete_action.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_action", "async_api_delete_action"] + + +def api_delete_action(action_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/actions/{action_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_action(action_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/actions/{action_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_assistant.py b/taskingai/client/apis/api_delete_assistant.py new file mode 100644 index 0000000..6f4dbec --- /dev/null +++ b/taskingai/client/apis/api_delete_assistant.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_delete_assistant.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_assistant", "async_api_delete_assistant"] + + +def api_delete_assistant(assistant_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_assistant(assistant_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_chat.py b/taskingai/client/apis/api_delete_chat.py new file mode 100644 index 0000000..d635216 --- /dev/null +++ b/taskingai/client/apis/api_delete_chat.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_delete_chat.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_chat", "async_api_delete_chat"] + + +def api_delete_chat(assistant_id: str, chat_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_chat(assistant_id: str, chat_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_chunk.py b/taskingai/client/apis/api_delete_chunk.py new file mode 100644 index 0000000..426b231 --- /dev/null +++ b/taskingai/client/apis/api_delete_chunk.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_delete_chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_chunk", "async_api_delete_chunk"] + + +def api_delete_chunk(collection_id: str, chunk_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "chunk_id": chunk_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/{chunk_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_chunk(collection_id: str, chunk_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "chunk_id": chunk_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/{chunk_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_collection.py b/taskingai/client/apis/api_delete_collection.py new file mode 100644 index 0000000..cd873f2 --- /dev/null +++ b/taskingai/client/apis/api_delete_collection.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_delete_collection.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_collection", "async_api_delete_collection"] + + +def api_delete_collection(collection_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_collection(collection_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_message.py b/taskingai/client/apis/api_delete_message.py new file mode 100644 index 0000000..ecd4be3 --- /dev/null +++ b/taskingai/client/apis/api_delete_message.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# api_delete_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_message", "async_api_delete_message"] + + +def api_delete_message(assistant_id: str, chat_id: str, message_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + "message_id": message_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_message(assistant_id: str, chat_id: str, message_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + "message_id": message_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_delete_record.py b/taskingai/client/apis/api_delete_record.py new file mode 100644 index 0000000..ac34397 --- /dev/null +++ b/taskingai/client/apis/api_delete_record.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_delete_record.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import BaseEmptyResponse + +__all__ = ["api_delete_record", "async_api_delete_record"] + + +def api_delete_record(collection_id: str, record_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "record_id": record_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records/{record_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_delete_record(collection_id: str, record_id: str, **kwargs) -> BaseEmptyResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "record_id": record_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records/{record_id}", + method="DELETE", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=BaseEmptyResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_generate_message.py b/taskingai/client/apis/api_generate_message.py new file mode 100644 index 0000000..7bcc98e --- /dev/null +++ b/taskingai/client/apis/api_generate_message.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +# api_generate_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import MessageGenerateRequest, MessageGenerateResponse + +__all__ = ["api_generate_message", "async_api_generate_message"] + + +def api_generate_message( + assistant_id: str, chat_id: str, payload: MessageGenerateRequest, **kwargs +) -> MessageGenerateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/generate", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageGenerateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_generate_message( + assistant_id: str, chat_id: str, payload: MessageGenerateRequest, **kwargs +) -> MessageGenerateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/generate", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageGenerateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_action.py b/taskingai/client/apis/api_get_action.py new file mode 100644 index 0000000..6f8f255 --- /dev/null +++ b/taskingai/client/apis/api_get_action.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_get_action.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ActionGetResponse + +__all__ = ["api_get_action", "async_api_get_action"] + + +def api_get_action(action_id: str, **kwargs) -> ActionGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/actions/{action_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_action(action_id: str, **kwargs) -> ActionGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/actions/{action_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_assistant.py b/taskingai/client/apis/api_get_assistant.py new file mode 100644 index 0000000..6b397e7 --- /dev/null +++ b/taskingai/client/apis/api_get_assistant.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_get_assistant.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import AssistantGetResponse + +__all__ = ["api_get_assistant", "async_api_get_assistant"] + + +def api_get_assistant(assistant_id: str, **kwargs) -> AssistantGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_assistant(assistant_id: str, **kwargs) -> AssistantGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_chat.py b/taskingai/client/apis/api_get_chat.py new file mode 100644 index 0000000..f108dc1 --- /dev/null +++ b/taskingai/client/apis/api_get_chat.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_get_chat.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChatGetResponse + +__all__ = ["api_get_chat", "async_api_get_chat"] + + +def api_get_chat(assistant_id: str, chat_id: str, **kwargs) -> ChatGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_chat(assistant_id: str, chat_id: str, **kwargs) -> ChatGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_chunk.py b/taskingai/client/apis/api_get_chunk.py new file mode 100644 index 0000000..2153ad7 --- /dev/null +++ b/taskingai/client/apis/api_get_chunk.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_get_chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChunkGetResponse + +__all__ = ["api_get_chunk", "async_api_get_chunk"] + + +def api_get_chunk(collection_id: str, chunk_id: str, **kwargs) -> ChunkGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "chunk_id": chunk_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/{chunk_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_chunk(collection_id: str, chunk_id: str, **kwargs) -> ChunkGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "chunk_id": chunk_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/{chunk_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_collection.py b/taskingai/client/apis/api_get_collection.py new file mode 100644 index 0000000..fcd6f00 --- /dev/null +++ b/taskingai/client/apis/api_get_collection.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_get_collection.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import CollectionGetResponse + +__all__ = ["api_get_collection", "async_api_get_collection"] + + +def api_get_collection(collection_id: str, **kwargs) -> CollectionGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_collection(collection_id: str, **kwargs) -> CollectionGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_message.py b/taskingai/client/apis/api_get_message.py new file mode 100644 index 0000000..ed1db76 --- /dev/null +++ b/taskingai/client/apis/api_get_message.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# api_get_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import MessageGetResponse + +__all__ = ["api_get_message", "async_api_get_message"] + + +def api_get_message(assistant_id: str, chat_id: str, message_id: str, **kwargs) -> MessageGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + "message_id": message_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_message(assistant_id: str, chat_id: str, message_id: str, **kwargs) -> MessageGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + "message_id": message_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_get_record.py b/taskingai/client/apis/api_get_record.py new file mode 100644 index 0000000..96097a8 --- /dev/null +++ b/taskingai/client/apis/api_get_record.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_get_record.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import RecordGetResponse + +__all__ = ["api_get_record", "async_api_get_record"] + + +def api_get_record(collection_id: str, record_id: str, **kwargs) -> RecordGetResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "record_id": record_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records/{record_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_get_record(collection_id: str, record_id: str, **kwargs) -> RecordGetResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "record_id": record_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records/{record_id}", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordGetResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_actions.py b/taskingai/client/apis/api_list_actions.py new file mode 100644 index 0000000..aac945b --- /dev/null +++ b/taskingai/client/apis/api_list_actions.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_list_actions.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import ActionListRequest, ActionListResponse + +__all__ = ["api_list_actions", "async_api_list_actions"] + + +def api_list_actions(payload: ActionListRequest, **kwargs) -> ActionListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/actions", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_actions(payload: ActionListRequest, **kwargs) -> ActionListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/actions", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_assistants.py b/taskingai/client/apis/api_list_assistants.py new file mode 100644 index 0000000..df32338 --- /dev/null +++ b/taskingai/client/apis/api_list_assistants.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_list_assistants.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import AssistantListRequest, AssistantListResponse + +__all__ = ["api_list_assistants", "async_api_list_assistants"] + + +def api_list_assistants(payload: AssistantListRequest, **kwargs) -> AssistantListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_assistants(payload: AssistantListRequest, **kwargs) -> AssistantListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_chats.py b/taskingai/client/apis/api_list_chats.py new file mode 100644 index 0000000..09eca78 --- /dev/null +++ b/taskingai/client/apis/api_list_chats.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_list_chats.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import ChatListRequest, ChatListResponse + +__all__ = ["api_list_chats", "async_api_list_chats"] + + +def api_list_chats(assistant_id: str, payload: ChatListRequest, **kwargs) -> ChatListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_chats(assistant_id: str, payload: ChatListRequest, **kwargs) -> ChatListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_chunks.py b/taskingai/client/apis/api_list_chunks.py new file mode 100644 index 0000000..84cf5eb --- /dev/null +++ b/taskingai/client/apis/api_list_chunks.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_list_chunks.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import ChunkListRequest, ChunkListResponse + +__all__ = ["api_list_chunks", "async_api_list_chunks"] + + +def api_list_chunks(collection_id: str, payload: ChunkListRequest, **kwargs) -> ChunkListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_chunks(collection_id: str, payload: ChunkListRequest, **kwargs) -> ChunkListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_collections.py b/taskingai/client/apis/api_list_collections.py new file mode 100644 index 0000000..514be1b --- /dev/null +++ b/taskingai/client/apis/api_list_collections.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_list_collections.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import CollectionListRequest, CollectionListResponse + +__all__ = ["api_list_collections", "async_api_list_collections"] + + +def api_list_collections(payload: CollectionListRequest, **kwargs) -> CollectionListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_collections(payload: CollectionListRequest, **kwargs) -> CollectionListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_messages.py b/taskingai/client/apis/api_list_messages.py new file mode 100644 index 0000000..2e4d2f3 --- /dev/null +++ b/taskingai/client/apis/api_list_messages.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# api_list_messages.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import MessageListRequest, MessageListResponse + +__all__ = ["api_list_messages", "async_api_list_messages"] + + +def api_list_messages(assistant_id: str, chat_id: str, payload: MessageListRequest, **kwargs) -> MessageListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_messages( + assistant_id: str, chat_id: str, payload: MessageListRequest, **kwargs +) -> MessageListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_list_records.py b/taskingai/client/apis/api_list_records.py new file mode 100644 index 0000000..9785f82 --- /dev/null +++ b/taskingai/client/apis/api_list_records.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_list_records.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client, convert_query_params_dict +from ..models import RecordListRequest, RecordListResponse + +__all__ = ["api_list_records", "async_api_list_records"] + + +def api_list_records(collection_id: str, payload: RecordListRequest, **kwargs) -> RecordListResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_list_records(collection_id: str, payload: RecordListRequest, **kwargs) -> RecordListResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = convert_query_params_dict(payload.model_dump()) + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = {} + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records", + method="GET", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordListResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_query_collection_chunks.py b/taskingai/client/apis/api_query_collection_chunks.py new file mode 100644 index 0000000..e838640 --- /dev/null +++ b/taskingai/client/apis/api_query_collection_chunks.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_query_collection_chunks.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChunkQueryRequest, ChunkQueryResponse + +__all__ = ["api_query_collection_chunks", "async_api_query_collection_chunks"] + + +def api_query_collection_chunks(collection_id: str, payload: ChunkQueryRequest, **kwargs) -> ChunkQueryResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/query", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkQueryResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_query_collection_chunks( + collection_id: str, payload: ChunkQueryRequest, **kwargs +) -> ChunkQueryResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/query", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkQueryResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_run_action.py b/taskingai/client/apis/api_run_action.py new file mode 100644 index 0000000..c77d8da --- /dev/null +++ b/taskingai/client/apis/api_run_action.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_run_action.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ActionRunRequest, ActionRunResponse + +__all__ = ["api_run_action", "async_api_run_action"] + + +def api_run_action(action_id: str, payload: ActionRunRequest, **kwargs) -> ActionRunResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/actions/{action_id}/run", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionRunResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_run_action(action_id: str, payload: ActionRunRequest, **kwargs) -> ActionRunResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/actions/{action_id}/run", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionRunResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_text_embedding.py b/taskingai/client/apis/api_text_embedding.py new file mode 100644 index 0000000..87560fa --- /dev/null +++ b/taskingai/client/apis/api_text_embedding.py @@ -0,0 +1,78 @@ +# -*- coding: utf-8 -*- + +# api_text_embedding.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import TextEmbeddingRequest, TextEmbeddingResponse + +__all__ = ["api_text_embedding", "async_api_text_embedding"] + + +def api_text_embedding(payload: TextEmbeddingRequest, **kwargs) -> TextEmbeddingResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/inference/text_embedding", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=TextEmbeddingResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_text_embedding(payload: TextEmbeddingRequest, **kwargs) -> TextEmbeddingResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/inference/text_embedding", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=TextEmbeddingResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_action.py b/taskingai/client/apis/api_update_action.py new file mode 100644 index 0000000..7ce12bc --- /dev/null +++ b/taskingai/client/apis/api_update_action.py @@ -0,0 +1,82 @@ +# -*- coding: utf-8 -*- + +# api_update_action.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ActionUpdateRequest, ActionUpdateResponse + +__all__ = ["api_update_action", "async_api_update_action"] + + +def api_update_action(action_id: str, payload: ActionUpdateRequest, **kwargs) -> ActionUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/actions/{action_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_action(action_id: str, payload: ActionUpdateRequest, **kwargs) -> ActionUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "action_id": action_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/actions/{action_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ActionUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_assistant.py b/taskingai/client/apis/api_update_assistant.py new file mode 100644 index 0000000..fe9d064 --- /dev/null +++ b/taskingai/client/apis/api_update_assistant.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_update_assistant.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import AssistantUpdateRequest, AssistantUpdateResponse + +__all__ = ["api_update_assistant", "async_api_update_assistant"] + + +def api_update_assistant(assistant_id: str, payload: AssistantUpdateRequest, **kwargs) -> AssistantUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_assistant( + assistant_id: str, payload: AssistantUpdateRequest, **kwargs +) -> AssistantUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=AssistantUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_chat.py b/taskingai/client/apis/api_update_chat.py new file mode 100644 index 0000000..454e7bc --- /dev/null +++ b/taskingai/client/apis/api_update_chat.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# api_update_chat.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChatUpdateRequest, ChatUpdateResponse + +__all__ = ["api_update_chat", "async_api_update_chat"] + + +def api_update_chat(assistant_id: str, chat_id: str, payload: ChatUpdateRequest, **kwargs) -> ChatUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_chat( + assistant_id: str, chat_id: str, payload: ChatUpdateRequest, **kwargs +) -> ChatUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChatUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_chunk.py b/taskingai/client/apis/api_update_chunk.py new file mode 100644 index 0000000..b6dda49 --- /dev/null +++ b/taskingai/client/apis/api_update_chunk.py @@ -0,0 +1,86 @@ +# -*- coding: utf-8 -*- + +# api_update_chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import ChunkUpdateRequest, ChunkUpdateResponse + +__all__ = ["api_update_chunk", "async_api_update_chunk"] + + +def api_update_chunk(collection_id: str, chunk_id: str, payload: ChunkUpdateRequest, **kwargs) -> ChunkUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "chunk_id": chunk_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/{chunk_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_chunk( + collection_id: str, chunk_id: str, payload: ChunkUpdateRequest, **kwargs +) -> ChunkUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "chunk_id": chunk_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/chunks/{chunk_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=ChunkUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_collection.py b/taskingai/client/apis/api_update_collection.py new file mode 100644 index 0000000..a6aa2d1 --- /dev/null +++ b/taskingai/client/apis/api_update_collection.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- + +# api_update_collection.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import CollectionUpdateRequest, CollectionUpdateResponse + +__all__ = ["api_update_collection", "async_api_update_collection"] + + +def api_update_collection(collection_id: str, payload: CollectionUpdateRequest, **kwargs) -> CollectionUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_collection( + collection_id: str, payload: CollectionUpdateRequest, **kwargs +) -> CollectionUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=CollectionUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_message.py b/taskingai/client/apis/api_update_message.py new file mode 100644 index 0000000..2bf7247 --- /dev/null +++ b/taskingai/client/apis/api_update_message.py @@ -0,0 +1,90 @@ +# -*- coding: utf-8 -*- + +# api_update_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import MessageUpdateRequest, MessageUpdateResponse + +__all__ = ["api_update_message", "async_api_update_message"] + + +def api_update_message( + assistant_id: str, chat_id: str, message_id: str, payload: MessageUpdateRequest, **kwargs +) -> MessageUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + "message_id": message_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_message( + assistant_id: str, chat_id: str, message_id: str, payload: MessageUpdateRequest, **kwargs +) -> MessageUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + "message_id": message_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/messages/{message_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=MessageUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/apis/api_update_record.py b/taskingai/client/apis/api_update_record.py new file mode 100644 index 0000000..1351153 --- /dev/null +++ b/taskingai/client/apis/api_update_record.py @@ -0,0 +1,88 @@ +# -*- coding: utf-8 -*- + +# api_update_record.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from ..models import RecordUpdateRequest, RecordUpdateResponse + +__all__ = ["api_update_record", "async_api_update_record"] + + +def api_update_record( + collection_id: str, record_id: str, payload: RecordUpdateRequest, **kwargs +) -> RecordUpdateResponse: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "record_id": record_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records/{record_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) + + +async def async_api_update_record( + collection_id: str, record_id: str, payload: RecordUpdateRequest, **kwargs +) -> RecordUpdateResponse: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "collection_id": collection_id, + "record_id": record_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/collections/{collection_id}/records/{record_id}", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=RecordUpdateResponse, + auth_settings=[], + _return_http_data_only=True, + _preload_content=True, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + ) diff --git a/taskingai/client/constants.py b/taskingai/client/constants.py index b06070e..a4a88a9 100644 --- a/taskingai/client/constants.py +++ b/taskingai/client/constants.py @@ -1,15 +1,2 @@ -from enum import Enum - -PARENT_LOGGER_NAME = 'taskingai' -DEFAULT_PARENT_LOGGER_LEVEL = 'ERROR' - -class ModuleType(str, Enum): - ASSISTANT = "assistant" - TOOL = "tool" - RETRIEVAL = "retrieval" - INFERENCE = "inference" - - - - - +PARENT_LOGGER_NAME = "taskingai" +DEFAULT_PARENT_LOGGER_LEVEL = "ERROR" diff --git a/taskingai/client/models/__init__.py b/taskingai/client/models/__init__.py index 6c7e63f..4653939 100644 --- a/taskingai/client/models/__init__.py +++ b/taskingai/client/models/__init__.py @@ -1,90 +1,22 @@ -# coding: utf-8 +# -*- coding: utf-8 -*- + +# __init__.py -# flake8: noqa """ - TaskingAI API +This script is automatically generated for TaskingAI python client +Do not modify the file manually - OpenAPI spec version: 0.1.0 +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 """ -from __future__ import absolute_import import warnings -# filter wanrings from pydantic warnings.filterwarnings("ignore", module="pydantic") -# import models into model package -from taskingai.client.models.entity.assistant.assistant import * -from taskingai.client.models.entity.assistant.chat import * -from taskingai.client.models.entity.assistant.message import * -from taskingai.client.models.entity.tool.action import * -from taskingai.client.models.entity.tool.function import * -from taskingai.client.models.entity.retrieval.collection import * -from taskingai.client.models.entity.retrieval.record import * -from taskingai.client.models.entity.retrieval.chunk import * -from taskingai.client.models.entity.retrieval.text_splitter import * -from taskingai.client.models.entity.inference.text_embedding import * -from taskingai.client.models.entity.inference.chat_completion import * -from taskingai.client.models.rest.action_bulk_create_request import ActionBulkCreateRequest -from taskingai.client.models.rest.action_bulk_create_response import ActionBulkCreateResponse -from taskingai.client.models.rest.action_delete_response import ActionDeleteResponse -from taskingai.client.models.rest.action_get_response import ActionGetResponse -from taskingai.client.models.rest.action_list_response import ActionListResponse -from taskingai.client.models.rest.action_run_request import ActionRunRequest -from taskingai.client.models.rest.action_run_response import ActionRunResponse -from taskingai.client.models.rest.action_update_request import ActionUpdateRequest -from taskingai.client.models.rest.action_update_response import ActionUpdateResponse -from taskingai.client.models.rest.assistant_create_request import AssistantCreateRequest -from taskingai.client.models.rest.assistant_create_response import AssistantCreateResponse -from taskingai.client.models.rest.assistant_delete_response import AssistantDeleteResponse -from taskingai.client.models.rest.assistant_get_response import AssistantGetResponse -from taskingai.client.models.rest.assistant_list_response import AssistantListResponse -from taskingai.client.models.rest.assistant_update_request import AssistantUpdateRequest -from taskingai.client.models.rest.assistant_update_response import AssistantUpdateResponse -from taskingai.client.models.rest.chat_completion_response import ChatCompletionResponse -from taskingai.client.models.rest.chat_completion_request import ChatCompletionRequest -from taskingai.client.models.rest.chat_create_request import ChatCreateRequest -from taskingai.client.models.rest.chat_create_response import ChatCreateResponse -from taskingai.client.models.rest.chat_delete_response import ChatDeleteResponse -from taskingai.client.models.rest.chat_get_response import ChatGetResponse -from taskingai.client.models.rest.chat_list_response import ChatListResponse -from taskingai.client.models.rest.chat_update_request import ChatUpdateRequest -from taskingai.client.models.rest.chat_update_response import ChatUpdateResponse -from taskingai.client.models.rest.chunk_query_request import ChunkQueryRequest -from taskingai.client.models.rest.chunk_query_response import ChunkQueryResponse -from taskingai.client.models.rest.collection_create_request import CollectionCreateRequest -from taskingai.client.models.rest.collection_create_response import CollectionCreateResponse -from taskingai.client.models.rest.collection_get_response import CollectionGetResponse -from taskingai.client.models.rest.collection_list_response import CollectionListResponse -from taskingai.client.models.rest.collection_update_request import CollectionUpdateRequest -from taskingai.client.models.rest.collection_update_response import CollectionUpdateResponse -from taskingai.client.models.rest.delete_collection_response import DeleteCollectionResponse -from taskingai.client.models.rest.function_create_request import FunctionCreateRequest -from taskingai.client.models.rest.function_create_response import FunctionCreateResponse -from taskingai.client.models.rest.function_delete_response import FunctionDeleteResponse -from taskingai.client.models.rest.function_get_response import FunctionGetResponse -from taskingai.client.models.rest.function_list_response import FunctionListResponse -from taskingai.client.models.rest.function_update_request import FunctionUpdateRequest -from taskingai.client.models.rest.function_update_response import FunctionUpdateResponse -from taskingai.client.models.rest.http_validation_error import HTTPValidationError -from taskingai.client.models.rest.message_create_request import MessageCreateRequest -from taskingai.client.models.rest.message_create_response import MessageCreateResponse -from taskingai.client.models.rest.message_generate_request import MessageGenerateRequest -from taskingai.client.models.rest.message_generate_response import MessageGenerateResponse -from taskingai.client.models.rest.message_get_response import MessageGetResponse -from taskingai.client.models.rest.message_list_response import MessageListResponse -from taskingai.client.models.rest.message_update_request import MessageUpdateRequest -from taskingai.client.models.rest.message_update_response import MessageUpdateResponse -from taskingai.client.models.rest.record_create_request import RecordCreateRequest -from taskingai.client.models.rest.record_create_response import RecordCreateResponse -from taskingai.client.models.rest.record_delete_response import RecordDeleteResponse -from taskingai.client.models.rest.record_get_response import RecordGetResponse -from taskingai.client.models.rest.record_list_response import RecordListResponse -from taskingai.client.models.rest.record_update_request import RecordUpdateRequest -from taskingai.client.models.rest.record_update_response import RecordUpdateResponse -from taskingai.client.models.rest.text_embedding_request import TextEmbeddingRequest -from taskingai.client.models.rest.text_embedding_response import TextEmbeddingResponse -from taskingai.client.models.rest.validation_error import ValidationError +from .entities import * +from .schemas import * -# allow filter warnigns from pydantic warnings.filterwarnings("default", module="pydantic") diff --git a/taskingai/client/models/entities/__init__.py b/taskingai/client/models/entities/__init__.py new file mode 100644 index 0000000..6f4d966 --- /dev/null +++ b/taskingai/client/models/entities/__init__.py @@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- + +# __init__.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from .action import * +from .action_authentication import * +from .action_authentication_type import * +from .action_body_type import * +from .action_method import * +from .action_param import * +from .assistant import * +from .assistant_memory import * +from .assistant_memory_type import * +from .chat import * +from .chat_completion import * +from .chat_completion_assistant_message import * +from .chat_completion_chunk import * +from .chat_completion_finish_reason import * +from .chat_completion_function import * +from .chat_completion_function_call import * +from .chat_completion_function_message import * +from .chat_completion_function_parameters import * +from .chat_completion_function_parameters_property import * +from .chat_completion_message import * +from .chat_completion_role import * +from .chat_completion_system_message import * +from .chat_completion_user_message import * +from .chat_memory import * +from .chat_memory_message import * +from .chunk import * +from .collection import * +from .message import * +from .message_chunk import * +from .message_content import * +from .message_generation_log import * +from .message_role import * +from .record import * +from .record_type import * +from .retrieval_config import * +from .retrieval_method import * +from .retrieval_ref import * +from .retrieval_type import * +from .sort_order_enum import * +from .status import * +from .text_embedding_input_type import * +from .text_embedding_output import * +from .text_splitter import * +from .text_splitter_type import * +from .tool_ref import * +from .tool_type import * diff --git a/taskingai/client/models/entities/action.py b/taskingai/client/models/entities/action.py new file mode 100644 index 0000000..11a1db9 --- /dev/null +++ b/taskingai/client/models/entities/action.py @@ -0,0 +1,43 @@ +# -*- coding: utf-8 -*- + +# action.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Any, Dict +from .action_method import ActionMethod +from .action_param import ActionParam +from .action_param import ActionParam +from .action_body_type import ActionBodyType +from .action_param import ActionParam +from .chat_completion_function import ChatCompletionFunction +from .action_authentication import ActionAuthentication + +__all__ = ["Action"] + + +class Action(BaseModel): + action_id: str = Field(..., min_length=20, max_length=30) + name: str = Field(..., min_length=1, max_length=128) + operation_id: str = Field(...) + description: str = Field(..., min_length=1, max_length=512) + url: str = Field(...) + method: ActionMethod = Field(...) + path_param_schema: Optional[Dict[str, ActionParam]] = Field(None) + query_param_schema: Optional[Dict[str, ActionParam]] = Field(None) + body_type: ActionBodyType = Field(...) + body_param_schema: Optional[Dict[str, ActionParam]] = Field(None) + function_def: ChatCompletionFunction = Field(...) + openapi_schema: Dict[str, Any] = Field(...) + authentication: ActionAuthentication = Field(...) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/action_authentication.py b/taskingai/client/models/entities/action_authentication.py new file mode 100644 index 0000000..3913800 --- /dev/null +++ b/taskingai/client/models/entities/action_authentication.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# action_authentication.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict +from .action_authentication_type import ActionAuthenticationType + +__all__ = ["ActionAuthentication"] + + +class ActionAuthentication(BaseModel): + type: ActionAuthenticationType = Field(...) + secret: Optional[str] = Field(None, min_length=1, max_length=1024) + content: Optional[Dict] = Field(None) diff --git a/taskingai/client/models/entities/action_authentication_type.py b/taskingai/client/models/entities/action_authentication_type.py new file mode 100644 index 0000000..ee3eef1 --- /dev/null +++ b/taskingai/client/models/entities/action_authentication_type.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# action_authentication_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["ActionAuthenticationType"] + + +class ActionAuthenticationType(str, Enum): + BEARER = "bearer" + BASIC = "basic" + CUSTOM = "custom" + NONE = "none" diff --git a/taskingai/client/models/entities/action_body_type.py b/taskingai/client/models/entities/action_body_type.py new file mode 100644 index 0000000..28a4c30 --- /dev/null +++ b/taskingai/client/models/entities/action_body_type.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# action_body_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["ActionBodyType"] + + +class ActionBodyType(str, Enum): + JSON = "JSON" + FORM = "FORM" + NONE = "NONE" diff --git a/taskingai/client/models/entities/action_method.py b/taskingai/client/models/entities/action_method.py new file mode 100644 index 0000000..2c01286 --- /dev/null +++ b/taskingai/client/models/entities/action_method.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# action_method.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["ActionMethod"] + + +class ActionMethod(str, Enum): + GET = "GET" + POST = "POST" + PUT = "PUT" + DELETE = "DELETE" + PATCH = "PATCH" + NONE = "NONE" diff --git a/taskingai/client/models/entities/action_param.py b/taskingai/client/models/entities/action_param.py new file mode 100644 index 0000000..7704a2a --- /dev/null +++ b/taskingai/client/models/entities/action_param.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# action_param.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, List + + +__all__ = ["ActionParam"] + + +class ActionParam(BaseModel): + type: str = Field(...) + description: str = Field(...) + enum: Optional[List[str]] = Field(None) + required: bool = Field(...) diff --git a/taskingai/client/models/entities/assistant.py b/taskingai/client/models/entities/assistant.py new file mode 100644 index 0000000..e74f6c1 --- /dev/null +++ b/taskingai/client/models/entities/assistant.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- + +# assistant.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict, List +from .assistant_memory import AssistantMemory +from .tool_ref import ToolRef +from .retrieval_ref import RetrievalRef +from .retrieval_config import RetrievalConfig + +__all__ = ["Assistant"] + + +class Assistant(BaseModel): + assistant_id: str = Field(..., min_length=20, max_length=30) + model_id: str = Field(..., min_length=8, max_length=8) + name: str = Field("", min_length=0, max_length=256) + description: str = Field("", min_length=0, max_length=512) + system_prompt_template: List[str] = Field([], min_length=0, max_length=32) + memory: AssistantMemory = Field(...) + tools: List[ToolRef] = Field([], min_length=0, max_length=32) + retrievals: List[RetrievalRef] = Field([], min_length=0, max_length=32) + retrieval_configs: RetrievalConfig = Field(...) + metadata: Dict[str, str] = Field({}, min_length=0, max_length=16) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/assistant_memory.py b/taskingai/client/models/entities/assistant_memory.py new file mode 100644 index 0000000..6d2456d --- /dev/null +++ b/taskingai/client/models/entities/assistant_memory.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# assistant_memory.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from .assistant_memory_type import AssistantMemoryType + +__all__ = ["AssistantMemory"] + + +class AssistantMemory(BaseModel): + type: AssistantMemoryType = Field(...) + max_messages: Optional[int] = Field(None, ge=1, le=1024) + max_tokens: Optional[int] = Field(None, ge=1, le=8192) diff --git a/taskingai/client/models/entities/assistant_memory_type.py b/taskingai/client/models/entities/assistant_memory_type.py new file mode 100644 index 0000000..c00527d --- /dev/null +++ b/taskingai/client/models/entities/assistant_memory_type.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# assistant_memory_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["AssistantMemoryType"] + + +class AssistantMemoryType(str, Enum): + ZERO = "zero" + NAIVE = "naive" + MESSAGE_WINDOW = "message_window" diff --git a/taskingai/client/models/entities/chat.py b/taskingai/client/models/entities/chat.py new file mode 100644 index 0000000..bf53609 --- /dev/null +++ b/taskingai/client/models/entities/chat.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# chat.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["Chat"] + + +class Chat(BaseModel): + chat_id: str = Field(..., min_length=20, max_length=30) + assistant_id: str = Field(..., min_length=20, max_length=30) + metadata: Dict[str, str] = Field({}, min_length=0, max_length=16) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/chat_completion.py b/taskingai/client/models/entities/chat_completion.py new file mode 100644 index 0000000..b4cfed7 --- /dev/null +++ b/taskingai/client/models/entities/chat_completion.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_completion.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from .chat_completion_finish_reason import ChatCompletionFinishReason +from .chat_completion_assistant_message import ChatCompletionAssistantMessage + +__all__ = ["ChatCompletion"] + + +class ChatCompletion(BaseModel): + finish_reason: ChatCompletionFinishReason = Field(...) + message: ChatCompletionAssistantMessage = Field(...) + created_timestamp: int = Field(...) diff --git a/taskingai/client/models/entities/chat_completion_assistant_message.py b/taskingai/client/models/entities/chat_completion_assistant_message.py new file mode 100644 index 0000000..449c96e --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_assistant_message.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# chat_completion_assistant_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, List +from .chat_completion_role import ChatCompletionRole +from .chat_completion_function_call import ChatCompletionFunctionCall + +__all__ = ["ChatCompletionAssistantMessage"] + + +class ChatCompletionAssistantMessage(BaseModel): + content: Optional[str] = Field(None) + role: ChatCompletionRole = Field(...) + function_calls: Optional[List[ChatCompletionFunctionCall]] = Field(None) diff --git a/taskingai/client/models/entities/chat_completion_chunk.py b/taskingai/client/models/entities/chat_completion_chunk.py new file mode 100644 index 0000000..b43336f --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_chunk.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_completion_chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from .chat_completion_role import ChatCompletionRole + +__all__ = ["ChatCompletionChunk"] + + +class ChatCompletionChunk(BaseModel): + role: ChatCompletionRole = Field("assistant") + index: int = Field(...) + delta: str = Field(...) + created_timestamp: int = Field(...) diff --git a/taskingai/client/models/entities/chat_completion_finish_reason.py b/taskingai/client/models/entities/chat_completion_finish_reason.py new file mode 100644 index 0000000..61a58bf --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_finish_reason.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# chat_completion_finish_reason.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["ChatCompletionFinishReason"] + + +class ChatCompletionFinishReason(str, Enum): + STOP = "stop" + LENGTH = "length" + FUNCTION_CALLS = "function_calls" + RECITATION = "recitation" + ERROR = "error" + UNKNOWN = "unknown" diff --git a/taskingai/client/models/entities/chat_completion_function.py b/taskingai/client/models/entities/chat_completion_function.py new file mode 100644 index 0000000..f03a496 --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_function.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# chat_completion_function.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from .chat_completion_function_parameters import ChatCompletionFunctionParameters + +__all__ = ["ChatCompletionFunction"] + + +class ChatCompletionFunction(BaseModel): + name: str = Field(...) + description: str = Field(...) + parameters: ChatCompletionFunctionParameters = Field(...) diff --git a/taskingai/client/models/entities/chat_completion_function_call.py b/taskingai/client/models/entities/chat_completion_function_call.py new file mode 100644 index 0000000..7ede894 --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_function_call.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_completion_function_call.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Any, Dict + + +__all__ = ["ChatCompletionFunctionCall"] + + +class ChatCompletionFunctionCall(BaseModel): + id: str = Field(...) + arguments: Dict[str, Any] = Field(...) + name: str = Field(...) diff --git a/taskingai/client/models/entities/chat_completion_function_message.py b/taskingai/client/models/entities/chat_completion_function_message.py new file mode 100644 index 0000000..27a18a6 --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_function_message.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_completion_function_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from .chat_completion_role import ChatCompletionRole + +__all__ = ["ChatCompletionFunctionMessage"] + + +class ChatCompletionFunctionMessage(BaseModel): + content: Optional[str] = Field(None) + role: ChatCompletionRole = Field(...) + id: str = Field(...) diff --git a/taskingai/client/models/entities/chat_completion_function_parameters.py b/taskingai/client/models/entities/chat_completion_function_parameters.py new file mode 100644 index 0000000..4d42beb --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_function_parameters.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_completion_function_parameters.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict, List +from .chat_completion_function_parameters_property import ChatCompletionFunctionParametersProperty + +__all__ = ["ChatCompletionFunctionParameters"] + + +class ChatCompletionFunctionParameters(BaseModel): + type: str = Field("object") + properties: Dict[str, ChatCompletionFunctionParametersProperty] = Field(...) + required: List[str] = Field([]) diff --git a/taskingai/client/models/entities/chat_completion_function_parameters_property.py b/taskingai/client/models/entities/chat_completion_function_parameters_property.py new file mode 100644 index 0000000..d909c59 --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_function_parameters_property.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_completion_function_parameters_property.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, List + + +__all__ = ["ChatCompletionFunctionParametersProperty"] + + +class ChatCompletionFunctionParametersProperty(BaseModel): + type: str = Field(..., pattern="^(string|number|integer|boolean)$") + description: str = Field("", max_length=256) + enum: Optional[List[str]] = Field(None) diff --git a/taskingai/client/models/entities/chat_completion_message.py b/taskingai/client/models/entities/chat_completion_message.py new file mode 100644 index 0000000..ce82cd6 --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_message.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_completion_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional + + +__all__ = ["ChatCompletionMessage"] + + +class ChatCompletionMessage(BaseModel): + content: Optional[str] = Field(None) diff --git a/taskingai/client/models/entities/chat_completion_role.py b/taskingai/client/models/entities/chat_completion_role.py new file mode 100644 index 0000000..475a9bc --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_role.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# chat_completion_role.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["ChatCompletionRole"] + + +class ChatCompletionRole(str, Enum): + SYSTEM = "system" + ASSISTANT = "assistant" + USER = "user" + FUNCTION = "function" diff --git a/taskingai/client/models/entities/chat_completion_system_message.py b/taskingai/client/models/entities/chat_completion_system_message.py new file mode 100644 index 0000000..35076ff --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_system_message.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# chat_completion_system_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from .chat_completion_role import ChatCompletionRole + +__all__ = ["ChatCompletionSystemMessage"] + + +class ChatCompletionSystemMessage(BaseModel): + content: Optional[str] = Field(None) + role: ChatCompletionRole = Field(...) diff --git a/taskingai/client/models/entities/chat_completion_user_message.py b/taskingai/client/models/entities/chat_completion_user_message.py new file mode 100644 index 0000000..c20fb0c --- /dev/null +++ b/taskingai/client/models/entities/chat_completion_user_message.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# chat_completion_user_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from .chat_completion_role import ChatCompletionRole + +__all__ = ["ChatCompletionUserMessage"] + + +class ChatCompletionUserMessage(BaseModel): + content: Optional[str] = Field(None) + role: ChatCompletionRole = Field(...) diff --git a/taskingai/client/models/entities/chat_memory.py b/taskingai/client/models/entities/chat_memory.py new file mode 100644 index 0000000..4a30379 --- /dev/null +++ b/taskingai/client/models/entities/chat_memory.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# chat_memory.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, List +from .assistant_memory_type import AssistantMemoryType +from .chat_memory_message import ChatMemoryMessage + +__all__ = ["ChatMemory"] + + +class ChatMemory(BaseModel): + type: AssistantMemoryType = Field(...) + messages: List[ChatMemoryMessage] = Field([]) + max_messages: Optional[int] = Field(None, ge=1, le=1024) + max_tokens: Optional[int] = Field(None, ge=1, le=8192) diff --git a/taskingai/client/models/entities/chat_memory_message.py b/taskingai/client/models/entities/chat_memory_message.py new file mode 100644 index 0000000..e2cbf71 --- /dev/null +++ b/taskingai/client/models/entities/chat_memory_message.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chat_memory_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional + + +__all__ = ["ChatMemoryMessage"] + + +class ChatMemoryMessage(BaseModel): + role: str = Field(...) + content: str = Field(...) + token_count: Optional[int] = Field(None) diff --git a/taskingai/client/models/entities/chunk.py b/taskingai/client/models/entities/chunk.py new file mode 100644 index 0000000..ab22914 --- /dev/null +++ b/taskingai/client/models/entities/chunk.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +# chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict + + +__all__ = ["Chunk"] + + +class Chunk(BaseModel): + chunk_id: str = Field(..., min_length=20, max_length=30) + record_id: Optional[str] = Field(..., min_length=20, max_length=30) + collection_id: str = Field(..., min_length=20, max_length=30) + content: str = Field(..., min_length=1) + num_tokens: int = Field(..., ge=0) + metadata: Dict = Field({}, min_length=0, max_length=16) + score: Optional[float] = Field(None, ge=0, le=1) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/collection.py b/taskingai/client/models/entities/collection.py new file mode 100644 index 0000000..eb97c0a --- /dev/null +++ b/taskingai/client/models/entities/collection.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +# collection.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["Collection"] + + +class Collection(BaseModel): + collection_id: str = Field(..., min_length=24, max_length=24) + name: str = Field("", min_length=0, max_length=256) + description: str = Field("", min_length=0, max_length=512) + capacity: int = Field(1000, ge=1) + num_records: int = Field(..., ge=0) + num_chunks: int = Field(..., ge=0) + embedding_model_id: str = Field(..., min_length=8, max_length=8) + metadata: Dict[str, str] = Field({}, min_length=0, max_length=16) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) + status: str = Field(...) diff --git a/taskingai/client/models/entities/message.py b/taskingai/client/models/entities/message.py new file mode 100644 index 0000000..9109d76 --- /dev/null +++ b/taskingai/client/models/entities/message.py @@ -0,0 +1,30 @@ +# -*- coding: utf-8 -*- + +# message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict +from .message_content import MessageContent + +__all__ = ["Message"] + + +class Message(BaseModel): + message_id: str = Field(..., min_length=20, max_length=30) + chat_id: str = Field(..., min_length=20, max_length=30) + assistant_id: str = Field(None, min_length=20, max_length=30) + role: str = Field(..., min_length=1, max_length=20) + content: MessageContent = Field(...) + metadata: Dict[str, str] = Field({}, min_length=0, max_length=16) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/message_chunk.py b/taskingai/client/models/entities/message_chunk.py new file mode 100644 index 0000000..d1eb6cf --- /dev/null +++ b/taskingai/client/models/entities/message_chunk.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# message_chunk.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from .message_role import MessageRole + +__all__ = ["MessageChunk"] + + +class MessageChunk(BaseModel): + role: MessageRole = Field(...) + index: int = Field(...) + delta: str = Field(...) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/message_content.py b/taskingai/client/models/entities/message_content.py new file mode 100644 index 0000000..8ea926c --- /dev/null +++ b/taskingai/client/models/entities/message_content.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# message_content.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field + + +__all__ = ["MessageContent"] + + +class MessageContent(BaseModel): + text: str = Field(...) diff --git a/taskingai/client/models/entities/message_generation_log.py b/taskingai/client/models/entities/message_generation_log.py new file mode 100644 index 0000000..de0bbea --- /dev/null +++ b/taskingai/client/models/entities/message_generation_log.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# message_generation_log.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Any, Dict + + +__all__ = ["MessageGenerationLog"] + + +class MessageGenerationLog(BaseModel): + session_id: str = Field(..., min_length=20, max_length=30) + event: str = Field(...) + event_id: str = Field(..., min_length=20, max_length=30) + event_step: str = Field(...) + timestamp: int = Field(..., ge=0) + content: Dict[str, Any] = Field(...) diff --git a/taskingai/client/models/entities/message_role.py b/taskingai/client/models/entities/message_role.py new file mode 100644 index 0000000..8e8cbe0 --- /dev/null +++ b/taskingai/client/models/entities/message_role.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# message_role.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["MessageRole"] + + +class MessageRole(str, Enum): + USER = "user" + ASSISTANT = "assistant" diff --git a/taskingai/client/models/entities/record.py b/taskingai/client/models/entities/record.py new file mode 100644 index 0000000..a1afee2 --- /dev/null +++ b/taskingai/client/models/entities/record.py @@ -0,0 +1,33 @@ +# -*- coding: utf-8 -*- + +# record.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict +from .status import Status +from .record_type import RecordType + +__all__ = ["Record"] + + +class Record(BaseModel): + record_id: str = Field(..., min_length=20, max_length=30) + collection_id: str = Field(..., min_length=20, max_length=30) + title: str = Field("", min_length=0, max_length=255) + status: Status = Field(...) + num_chunks: int = Field(..., ge=0) + type: RecordType = Field(...) + content: str = Field(..., min_length=1, max_length=65535) + metadata: Dict = Field({}, min_length=0, max_length=16) + updated_timestamp: int = Field(..., ge=0) + created_timestamp: int = Field(..., ge=0) diff --git a/taskingai/client/models/entities/record_type.py b/taskingai/client/models/entities/record_type.py new file mode 100644 index 0000000..711c13f --- /dev/null +++ b/taskingai/client/models/entities/record_type.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +# record_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["RecordType"] + + +class RecordType(str, Enum): + TEXT = "text" diff --git a/taskingai/client/models/entities/retrieval_config.py b/taskingai/client/models/entities/retrieval_config.py new file mode 100644 index 0000000..1eef5c1 --- /dev/null +++ b/taskingai/client/models/entities/retrieval_config.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# retrieval_config.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from .retrieval_method import RetrievalMethod + +__all__ = ["RetrievalConfig"] + + +class RetrievalConfig(BaseModel): + top_k: int = Field(3, ge=1, le=20) + max_tokens: Optional[int] = Field(None, ge=1, le=8192) + method: RetrievalMethod = Field(...) + function_description: Optional[str] = Field(None) diff --git a/taskingai/client/models/entities/retrieval_method.py b/taskingai/client/models/entities/retrieval_method.py new file mode 100644 index 0000000..72bb888 --- /dev/null +++ b/taskingai/client/models/entities/retrieval_method.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# retrieval_method.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["RetrievalMethod"] + + +class RetrievalMethod(str, Enum): + FUNCTION_CALL = "function_call" + USER_MESSAGE = "user_message" + MEMORY = "memory" diff --git a/taskingai/client/models/entities/retrieval_ref.py b/taskingai/client/models/entities/retrieval_ref.py new file mode 100644 index 0000000..24dfde3 --- /dev/null +++ b/taskingai/client/models/entities/retrieval_ref.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# retrieval_ref.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from .retrieval_type import RetrievalType + +__all__ = ["RetrievalRef"] + + +class RetrievalRef(BaseModel): + type: RetrievalType = Field(...) + id: str = Field(...) diff --git a/taskingai/client/models/entities/retrieval_type.py b/taskingai/client/models/entities/retrieval_type.py new file mode 100644 index 0000000..2bc2add --- /dev/null +++ b/taskingai/client/models/entities/retrieval_type.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +# retrieval_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["RetrievalType"] + + +class RetrievalType(str, Enum): + COLLECTION = "collection" diff --git a/taskingai/client/models/entities/sort_order_enum.py b/taskingai/client/models/entities/sort_order_enum.py new file mode 100644 index 0000000..6f0b0b9 --- /dev/null +++ b/taskingai/client/models/entities/sort_order_enum.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# sort_order_enum.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["SortOrderEnum"] + + +class SortOrderEnum(str, Enum): + DESC = "desc" + ASC = "asc" diff --git a/taskingai/client/models/entities/status.py b/taskingai/client/models/entities/status.py new file mode 100644 index 0000000..bf1753e --- /dev/null +++ b/taskingai/client/models/entities/status.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# status.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["Status"] + + +class Status(str, Enum): + CREATING = "creating" + READY = "ready" + DELETING = "deleting" + ERROR = "error" + PARTIAL = "partial" diff --git a/taskingai/client/models/entities/text_embedding_input_type.py b/taskingai/client/models/entities/text_embedding_input_type.py new file mode 100644 index 0000000..3a5b985 --- /dev/null +++ b/taskingai/client/models/entities/text_embedding_input_type.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# text_embedding_input_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["TextEmbeddingInputType"] + + +class TextEmbeddingInputType(str, Enum): + DOCUMENT = "document" + QUERY = "query" diff --git a/taskingai/client/models/entities/text_embedding_output.py b/taskingai/client/models/entities/text_embedding_output.py new file mode 100644 index 0000000..72e3aec --- /dev/null +++ b/taskingai/client/models/entities/text_embedding_output.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# text_embedding_output.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List + + +__all__ = ["TextEmbeddingOutput"] + + +class TextEmbeddingOutput(BaseModel): + index: int = Field(...) + embedding: List[float] = Field(...) diff --git a/taskingai/client/models/entities/text_splitter.py b/taskingai/client/models/entities/text_splitter.py new file mode 100644 index 0000000..9e6a3d7 --- /dev/null +++ b/taskingai/client/models/entities/text_splitter.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# text_splitter.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from .text_splitter_type import TextSplitterType + +__all__ = ["TextSplitter"] + + +class TextSplitter(BaseModel): + type: TextSplitterType = Field(...) + chunk_size: Optional[int] = Field(None, ge=50, le=1000) + chunk_overlap: Optional[int] = Field(None, ge=0, le=200) diff --git a/taskingai/client/models/entities/text_splitter_type.py b/taskingai/client/models/entities/text_splitter_type.py new file mode 100644 index 0000000..a0037b0 --- /dev/null +++ b/taskingai/client/models/entities/text_splitter_type.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- + +# text_splitter_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["TextSplitterType"] + + +class TextSplitterType(str, Enum): + TOKEN = "token" diff --git a/taskingai/client/models/entities/tool_ref.py b/taskingai/client/models/entities/tool_ref.py new file mode 100644 index 0000000..e864ee0 --- /dev/null +++ b/taskingai/client/models/entities/tool_ref.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# tool_ref.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from .tool_type import ToolType + +__all__ = ["ToolRef"] + + +class ToolRef(BaseModel): + type: ToolType = Field(...) + id: str = Field(...) diff --git a/taskingai/client/models/entities/tool_type.py b/taskingai/client/models/entities/tool_type.py new file mode 100644 index 0000000..592d112 --- /dev/null +++ b/taskingai/client/models/entities/tool_type.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# tool_type.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from enum import Enum + +__all__ = ["ToolType"] + + +class ToolType(str, Enum): + ACTION = "action" + PLUGIN = "plugin" diff --git a/taskingai/client/models/entity/__init__.py b/taskingai/client/models/entity/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/taskingai/client/models/entity/_base.py b/taskingai/client/models/entity/_base.py deleted file mode 100644 index a58dde0..0000000 --- a/taskingai/client/models/entity/_base.py +++ /dev/null @@ -1,22 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -from pydantic import BaseModel - - -class TaskingaiBaseModel(BaseModel): - - def to_dict(self): - """Returns the model properties as a dict""" - return self.model_dump() - - def to_str(self): - """Returns the string representation of the model""" - return self.model_dump_json() - - diff --git a/taskingai/client/models/entity/assistant/__init__.py b/taskingai/client/models/entity/assistant/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/taskingai/client/models/entity/assistant/assistant.py b/taskingai/client/models/entity/assistant/assistant.py deleted file mode 100644 index 1d7364e..0000000 --- a/taskingai/client/models/entity/assistant/assistant.py +++ /dev/null @@ -1,59 +0,0 @@ -from typing import List, Dict -from pydantic import field_validator -from .._base import TaskingaiBaseModel -from .assistant_memory import * -from enum import Enum - -__all__ = [ - "Assistant", - "AssistantMemoryType", - "AssistantNaiveMemory", - "AssistantZeroMemory", - "AssistantMessageWindowMemory", - "AssistantTool", - "AssistantRetrieval", - "AssistantToolType", - "AssistantRetrievalType", - "AssistantMemory" -] - - -class AssistantToolType(str, Enum): - ACTION = "action" - FUNCTION = "function" - - -class AssistantRetrievalType(str, Enum): - COLLECTION = "collection" - - -class AssistantRetrieval(TaskingaiBaseModel): - type: AssistantRetrievalType - id: str - - -class AssistantTool(TaskingaiBaseModel): - type: AssistantToolType - id: str - - -class Assistant(TaskingaiBaseModel): - object: str - assistant_id: str - model_id: str - name: str - description: str - system_prompt_template: List[str] - memory: AssistantMemory - tools: List[AssistantTool] - retrievals: List[AssistantRetrieval] - metadata: Dict[str, str] - created_timestamp: int - - - @field_validator('memory', mode='before') - def validate_memory(cls, memory_dict: Dict): - memory: AssistantMemory = build_assistant_memory(memory_dict) - if not memory: - raise ValueError('Invalid input memory') - return memory diff --git a/taskingai/client/models/entity/assistant/assistant_memory.py b/taskingai/client/models/entity/assistant/assistant_memory.py deleted file mode 100644 index 4f0121b..0000000 --- a/taskingai/client/models/entity/assistant/assistant_memory.py +++ /dev/null @@ -1,61 +0,0 @@ -from enum import Enum -from pydantic import BaseModel, Field -from abc import ABC -from typing import Optional, Dict - - -class AssistantMemoryType(str, Enum): - ZERO = "zero" - NAIVE = "naive" - MESSAGE_WINDOW = "message_window" - - -class AssistantMemory(BaseModel, ABC): - type: AssistantMemoryType = Field(..., description="The type of the memory.") - - -class AssistantMessageWindowMemory(AssistantMemory): - type: AssistantMemoryType = Field(AssistantMemoryType.MESSAGE_WINDOW, Literal=AssistantMemoryType.MESSAGE_WINDOW) - max_messages: int = Field(...) - max_tokens: int = Field(...) - - -class AssistantNaiveMemory(AssistantMemory): - type: AssistantMemoryType = Field(AssistantMemoryType.NAIVE, Literal=AssistantMemoryType.NAIVE) - - -class AssistantZeroMemory(AssistantMemory): - type: AssistantMemoryType = Field(AssistantMemoryType.ZERO, Literal=AssistantMemoryType.ZERO) - - -def build_assistant_memory(memory_dict: Dict) -> Optional[AssistantMemory]: - # Check if the memory dictionary is provided and has the 'type' key - if not memory_dict or 'type' not in memory_dict: - return None - - memory_type = memory_dict['type'] - - if memory_type == AssistantMemoryType.ZERO.value: - # For zero memory, no additional information is needed - return AssistantZeroMemory() - - elif memory_type == AssistantMemoryType.NAIVE.value: - # For naive memory, no additional configuration is needed - return AssistantNaiveMemory() - - elif memory_type == AssistantMemoryType.MESSAGE_WINDOW.value: - # For message window memory, additional configuration is needed - max_messages = memory_dict.get('max_messages') - max_tokens = memory_dict.get('max_tokens') - - # Validate that required fields are present - if max_messages is None or max_tokens is None: - return None - - return AssistantMessageWindowMemory(max_messages=max_messages, max_tokens=max_tokens) - - else: - # If the memory type is unknown, return None - return None - - diff --git a/taskingai/client/models/entity/assistant/chat.py b/taskingai/client/models/entity/assistant/chat.py deleted file mode 100644 index 791d0b8..0000000 --- a/taskingai/client/models/entity/assistant/chat.py +++ /dev/null @@ -1,13 +0,0 @@ -from typing import Dict -from .._base import TaskingaiBaseModel - -__all__ = [ - "Chat", -] - -class Chat(TaskingaiBaseModel): - object: str - chat_id: str - assistant_id: str - metadata: Dict[str, str] - created_timestamp: int diff --git a/taskingai/client/models/entity/assistant/message.py b/taskingai/client/models/entity/assistant/message.py deleted file mode 100644 index e90d1cd..0000000 --- a/taskingai/client/models/entity/assistant/message.py +++ /dev/null @@ -1,33 +0,0 @@ -from typing import Optional, Dict -from .._base import TaskingaiBaseModel -from enum import Enum - -__all__ = ["Message", "MessageContent", "MessageRole", "MessageChunk"] - - -class MessageRole(str, Enum): - USER = "user" - ASSISTANT = "assistant" - - -class MessageContent(TaskingaiBaseModel): - text: str - - -class Message(TaskingaiBaseModel): - object: str - message_id: str - chat_id: str - assistant_id: Optional[str] - role: MessageRole - content: MessageContent - metadata: Dict[str, str] - created_timestamp: int - - -class MessageChunk(TaskingaiBaseModel): - object: str - role: MessageRole - index: int - delta: str - created_timestamp: int diff --git a/taskingai/client/models/entity/inference/__init__.py b/taskingai/client/models/entity/inference/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/taskingai/client/models/entity/inference/chat_completion.py b/taskingai/client/models/entity/inference/chat_completion.py deleted file mode 100644 index 3cb2187..0000000 --- a/taskingai/client/models/entity/inference/chat_completion.py +++ /dev/null @@ -1,92 +0,0 @@ -from typing import Dict, Optional, Any, List -from pydantic import Field -from .._base import TaskingaiBaseModel -from enum import Enum -from abc import ABCMeta -from typing_extensions import Literal - -__all__ = [ - "ChatCompletion", - "ChatCompletionMessage", - "ChatCompletionSystemMessage", - "ChatCompletionUserMessage", - "ChatCompletionAssistantMessage", - "ChatCompletionFunctionMessage", - "ChatCompletionRole", - "ChatCompletionFunctionCall", - "ChatCompletionFunction", - "ChatCompletionFinishReason", - "ChatCompletionChunk", - "INFERENCE_CHAT_COMPLETION_STREAM_CAST_MAP" -] - - -class ChatCompletionRole(str, Enum): - SYSTEM = "system" - ASSISTANT = "assistant" - USER = "user" - FUNCTION = "function" - - -class ChatCompletionFunctionCall(TaskingaiBaseModel): - id: str - arguments: Dict[str, Any] - name: str - - -class ChatCompletionFunction(TaskingaiBaseModel): - name: str - description: str - parameters: Dict - - -class ChatCompletionMessage(TaskingaiBaseModel, metaclass=ABCMeta): - content: Optional[str] - - -class ChatCompletionSystemMessage(ChatCompletionMessage): - role: ChatCompletionRole = Field(Literal[ChatCompletionRole.SYSTEM]) - - -class ChatCompletionUserMessage(ChatCompletionMessage): - role: ChatCompletionRole = Field(Literal[ChatCompletionRole.USER]) - - -class ChatCompletionAssistantMessage(ChatCompletionMessage): - role: ChatCompletionRole = Field(Literal[ChatCompletionRole.ASSISTANT]) - function_calls: Optional[List[ChatCompletionFunctionCall]] - - -class ChatCompletionFunctionMessage(ChatCompletionMessage): - role: ChatCompletionRole = Field(Literal[ChatCompletionRole.FUNCTION]) - id: str - - -class ChatCompletionFinishReason(str, Enum): - STOP = "stop" - LENGTH = "length" - FUNCTION_CALLS = "function_calls" - RECITATION = "recitation" - ERROR = "error" - UNKNOWN = "unknown" - - -class ChatCompletion(TaskingaiBaseModel): - object: str = Field(Literal["ChatCompletion"]) - finish_reason: ChatCompletionFinishReason - message: ChatCompletionAssistantMessage - created_timestamp: int - - -class ChatCompletionChunk(TaskingaiBaseModel): - object: str - role: ChatCompletionRole - index: int - delta: str - created_timestamp: int - - -INFERENCE_CHAT_COMPLETION_STREAM_CAST_MAP = { - "ChatCompletion": ChatCompletion, - "ChatCompletionChunk": ChatCompletionChunk -} diff --git a/taskingai/client/models/entity/inference/text_embedding.py b/taskingai/client/models/entity/inference/text_embedding.py deleted file mode 100644 index 2effc80..0000000 --- a/taskingai/client/models/entity/inference/text_embedding.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - - -from typing import List -from .._base import TaskingaiBaseModel - -__all__ = [ - "TextEmbeddingOutput", -] - -class TextEmbeddingOutput(TaskingaiBaseModel): - - index: int - embedding: List[float] - - def to_dict(self): - """Returns the model properties as a dict""" - return self.model_dump() - - def to_str(self): - """Returns the string representation of the model""" - return self.model_dump_json() - diff --git a/taskingai/client/models/entity/retrieval/__init__.py b/taskingai/client/models/entity/retrieval/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/taskingai/client/models/entity/retrieval/chunk.py b/taskingai/client/models/entity/retrieval/chunk.py deleted file mode 100644 index 60767d6..0000000 --- a/taskingai/client/models/entity/retrieval/chunk.py +++ /dev/null @@ -1,14 +0,0 @@ -from .._base import TaskingaiBaseModel - -__all__ = [ - "Chunk", -] - - -class Chunk(TaskingaiBaseModel): - object: str - chunk_id: str - record_id: str - collection_id: str - content: str - score: float diff --git a/taskingai/client/models/entity/retrieval/collection.py b/taskingai/client/models/entity/retrieval/collection.py deleted file mode 100644 index 712fc9b..0000000 --- a/taskingai/client/models/entity/retrieval/collection.py +++ /dev/null @@ -1,20 +0,0 @@ -from typing import Dict -from .._base import TaskingaiBaseModel - -__all__ = [ - "Collection", -] - - -class Collection(TaskingaiBaseModel): - object: str - collection_id: str - name: str - description: str - capacity: int - num_records: int - num_chunks: int - embedding_model_id: str - metadata: Dict[str, str] - created_timestamp: int - status: str diff --git a/taskingai/client/models/entity/retrieval/record.py b/taskingai/client/models/entity/retrieval/record.py deleted file mode 100644 index 754c782..0000000 --- a/taskingai/client/models/entity/retrieval/record.py +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Dict -from .._base import TaskingaiBaseModel - -__all__ = [ - "Record", -] - - -class Record(TaskingaiBaseModel): - object: str - record_id: str - collection_id: str - type: str - num_chunks: int - content: str - metadata: Dict[str, str] - created_timestamp: int - status: str diff --git a/taskingai/client/models/entity/retrieval/text_splitter.py b/taskingai/client/models/entity/retrieval/text_splitter.py deleted file mode 100644 index 7ae6847..0000000 --- a/taskingai/client/models/entity/retrieval/text_splitter.py +++ /dev/null @@ -1,53 +0,0 @@ -from enum import Enum -from .._base import TaskingaiBaseModel -from pydantic import Field, model_validator -from typing import Optional, Dict, Any - -__all__ = [ - "TextSplitter", - "TextSplitterType", - "TokenTextSplitter", - "build_text_splitter", -] - - -class TextSplitterType(str, Enum): - """TextSplitterType enum.""" - - TOKEN = "token" - - -class TextSplitter(TaskingaiBaseModel): - type: TextSplitterType = Field(...) - - -class TokenTextSplitter(TextSplitter): - type: TextSplitterType = Field(TextSplitterType.TOKEN, Literal=TextSplitterType.TOKEN) - chunk_size: int = Field(...) - chunk_overlap: int = Field(...) - - # check chunk_overlap <= chunk_size/2 - @model_validator(mode="after") - def validate_chunk_overlap(cls, data: Any): - if data.chunk_overlap > data.chunk_size / 2: - raise ValueError("chunk_overlap must be less than or equal to chunk_size/2") - return data - - -def build_text_splitter(data: Dict) -> Optional[TextSplitter]: - if not isinstance(data, Dict): - raise ValueError("Text splitter input data must be a valid dictionary") - - splitter_type = data.get("type") - if splitter_type is None: - return None - - # Depending on the type of splitter, initialize the appropriate splitter instance - if splitter_type == TextSplitterType.TOKEN.value: - chunk_size = data.get("chunk_size") - chunk_overlap = data.get("chunk_overlap") - return TokenTextSplitter(chunk_size=chunk_size, chunk_overlap=chunk_overlap) - - else: - # If the splitter_type is unknown, return None - return None diff --git a/taskingai/client/models/entity/tool/__init__.py b/taskingai/client/models/entity/tool/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/taskingai/client/models/entity/tool/action.py b/taskingai/client/models/entity/tool/action.py deleted file mode 100644 index e7a1e24..0000000 --- a/taskingai/client/models/entity/tool/action.py +++ /dev/null @@ -1,36 +0,0 @@ -from typing import Dict, Any, Optional -from enum import Enum -from .._base import TaskingaiBaseModel - - -__all__ = [ - "ActionAuthenticationType", - "ActionAuthentication", - "Action", -] - - -class ActionAuthenticationType(str, Enum): - BASIC = "basic" - BEARER = "bearer" - CUSTOM = "custom" - NONE = "none" - - -class ActionAuthentication(TaskingaiBaseModel): - type: ActionAuthenticationType - secret: Optional[str] = None - content: Optional[Dict] = None - - -class Action(TaskingaiBaseModel): - object: str - action_id: str - name: str - description: str - openapi_schema: Dict[str, Any] - authentication: ActionAuthentication - created_timestamp: int - - class Config: - allow_population_by_field_name = True diff --git a/taskingai/client/models/entity/tool/function.py b/taskingai/client/models/entity/tool/function.py deleted file mode 100644 index 5a5f9a3..0000000 --- a/taskingai/client/models/entity/tool/function.py +++ /dev/null @@ -1,22 +0,0 @@ -from typing import Dict, Any, List -from .._base import TaskingaiBaseModel - -__all__ = [ - "Function", - "FunctionParameters", -] - - -class FunctionParameters(TaskingaiBaseModel): - type: str - properties: Dict[str, Any] - required: List[str] - - -class Function(TaskingaiBaseModel): - object: str - function_id: str - name: str - description: str - parameters: FunctionParameters - created_timestamp: int diff --git a/taskingai/client/models/rest/__init__.py b/taskingai/client/models/rest/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/taskingai/client/models/rest/action_bulk_create_request.py b/taskingai/client/models/rest/action_bulk_create_request.py deleted file mode 100644 index fdae1c7..0000000 --- a/taskingai/client/models/rest/action_bulk_create_request.py +++ /dev/null @@ -1,131 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - - -class ActionBulkCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = {"openapi_schema": "object", "authentication": "object"} - - attribute_map = {"openapi_schema": "openapi_schema", "authentication": "authentication"} - - def __init__(self, openapi_schema=None, authentication=None): # noqa: E501 - """ActionBulkCreateRequest - a model defined in Swagger""" # noqa: E501 - self._openapi_schema = None - self._authentication = None - self.discriminator = None - self.openapi_schema = openapi_schema - if authentication is not None: - self.authentication = authentication - - @property - def openapi_schema(self): - """Gets the openapi_schema of this ActionBulkCreateRequest. # noqa: E501 - - The action openapi_schema is compliant with the OpenAPI Specification. If there are multiple paths and methods in the openapi_schema, the service will create multiple actions whose openapi_schema only has exactly one path and one method # noqa: E501 - - :return: The openapi_schema of this ActionBulkCreateRequest. # noqa: E501 - :rtype: object - """ - return self._openapi_schema - - @openapi_schema.setter - def openapi_schema(self, openapi_schema): - """Sets the openapi_schema of this ActionBulkCreateRequest. - - The action openapi_schema is compliant with the OpenAPI Specification. If there are multiple paths and methods in the openapi_schema, the service will create multiple actions whose openapi_schema only has exactly one path and one method # noqa: E501 - - :param openapi_schema: The openapi_schema of this ActionBulkCreateRequest. # noqa: E501 - :type: object - """ - if openapi_schema is None: - raise ValueError("Invalid value for `openapi_schema`, must not be `None`") # noqa: E501 - - self._openapi_schema = openapi_schema - - @property - def authentication(self): - """Gets the authentication of this ActionBulkCreateRequest. # noqa: E501 - - The action API authentication. # noqa: E501 - - :return: The authentication of this ActionBulkCreateRequest. # noqa: E501 - :rtype: object - """ - return self._authentication - - @authentication.setter - def authentication(self, authentication): - """Sets the authentication of this ActionBulkCreateRequest. - - The action API authentication. # noqa: E501 - - :param authentication: The authentication of this ActionBulkCreateRequest. # noqa: E501 - :type: object - """ - - self._authentication = authentication - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(ActionBulkCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionBulkCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_bulk_create_response.py b/taskingai/client/models/rest/action_bulk_create_response.py deleted file mode 100644 index 533fdf0..0000000 --- a/taskingai/client/models/rest/action_bulk_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionBulkCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ActionBulkCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ActionBulkCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ActionBulkCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ActionBulkCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this ActionBulkCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ActionBulkCreateResponse. # noqa: E501 - - The created actions. # noqa: E501 - - :return: The data of this ActionBulkCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ActionBulkCreateResponse. - - The created actions. # noqa: E501 - - :param data: The data of this ActionBulkCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionBulkCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionBulkCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_delete_response.py b/taskingai/client/models/rest/action_delete_response.py deleted file mode 100644 index 629f99d..0000000 --- a/taskingai/client/models/rest/action_delete_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionDeleteResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object' - } - - attribute_map = { - 'status': 'status' - } - - def __init__(self, status=None): # noqa: E501 - """ActionDeleteResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self.discriminator = None - self.status = status - - @property - def status(self): - """Gets the status of this ActionDeleteResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ActionDeleteResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ActionDeleteResponse. - - The response status. # noqa: E501 - - :param status: The status of this ActionDeleteResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionDeleteResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionDeleteResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_get_response.py b/taskingai/client/models/rest/action_get_response.py deleted file mode 100644 index f848b2a..0000000 --- a/taskingai/client/models/rest/action_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ActionGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ActionGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ActionGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ActionGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this ActionGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ActionGetResponse. # noqa: E501 - - The response action data. # noqa: E501 - - :return: The data of this ActionGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ActionGetResponse. - - The response action data. # noqa: E501 - - :param data: The data of this ActionGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_list_response.py b/taskingai/client/models/rest/action_list_response.py deleted file mode 100644 index 49a0ade..0000000 --- a/taskingai/client/models/rest/action_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'fetched_count': 'object', - 'has_more': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'fetched_count': 'fetched_count', - 'has_more': 'has_more' - } - - def __init__(self, status=None, data=None, fetched_count=None, has_more=None): # noqa: E501 - """ActionListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._fetched_count = None - self._has_more = None - self.discriminator = None - self.status = status - self.data = data - self.fetched_count = fetched_count - self.has_more = has_more - - @property - def status(self): - """Gets the status of this ActionListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ActionListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ActionListResponse. - - The response status. # noqa: E501 - - :param status: The status of this ActionListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ActionListResponse. # noqa: E501 - - List of actions. # noqa: E501 - - :return: The data of this ActionListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ActionListResponse. - - List of actions. # noqa: E501 - - :param data: The data of this ActionListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def fetched_count(self): - """Gets the fetched_count of this ActionListResponse. # noqa: E501 - - The number of actions returned in the response. # noqa: E501 - - :return: The fetched_count of this ActionListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this ActionListResponse. - - The number of actions returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this ActionListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - @property - def has_more(self): - """Gets the has_more of this ActionListResponse. # noqa: E501 - - Whether there are more actions to fetch. # noqa: E501 - - :return: The has_more of this ActionListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this ActionListResponse. - - Whether there are more actions to fetch. # noqa: E501 - - :param has_more: The has_more of this ActionListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_run_request.py b/taskingai/client/models/rest/action_run_request.py deleted file mode 100644 index 366dd63..0000000 --- a/taskingai/client/models/rest/action_run_request.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionRunRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'parameters': 'object' - } - - attribute_map = { - 'parameters': 'parameters' - } - - def __init__(self, parameters=None): # noqa: E501 - """ActionRunRequest - a model defined in Swagger""" # noqa: E501 - self._parameters = None - self.discriminator = None - if parameters is not None: - self.parameters = parameters - - @property - def parameters(self): - """Gets the parameters of this ActionRunRequest. # noqa: E501 - - - :return: The parameters of this ActionRunRequest. # noqa: E501 - :rtype: object - """ - return self._parameters - - @parameters.setter - def parameters(self, parameters): - """Sets the parameters of this ActionRunRequest. - - - :param parameters: The parameters of this ActionRunRequest. # noqa: E501 - :type: object - """ - - self._parameters = parameters - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionRunRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionRunRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_run_response.py b/taskingai/client/models/rest/action_run_response.py deleted file mode 100644 index d09d66f..0000000 --- a/taskingai/client/models/rest/action_run_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionRunResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ActionRunResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ActionRunResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ActionRunResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ActionRunResponse. - - The response status. # noqa: E501 - - :param status: The status of this ActionRunResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ActionRunResponse. # noqa: E501 - - The action API response data. # noqa: E501 - - :return: The data of this ActionRunResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ActionRunResponse. - - The action API response data. # noqa: E501 - - :param data: The data of this ActionRunResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionRunResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionRunResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_update_request.py b/taskingai/client/models/rest/action_update_request.py deleted file mode 100644 index afe8fb0..0000000 --- a/taskingai/client/models/rest/action_update_request.py +++ /dev/null @@ -1,130 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - - -class ActionUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = {"openapi_schema": "object", "authentication": "object"} - - attribute_map = {"openapi_schema": "openapi_schema", "authentication": "authentication"} - - def __init__(self, openapi_schema=None, authentication=None): # noqa: E501 - """ActionUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._openapi_schema = None - self._authentication = None - self.discriminator = None - if openapi_schema is not None: - self.openapi_schema = openapi_schema - if authentication is not None: - self.authentication = authentication - - @property - def openapi_schema(self): - """Gets the openapi_schema of this ActionUpdateRequest. # noqa: E501 - - The action openapi_schema, which is compliant with the OpenAPI Specification. # noqa: E501 - - :return: The openapi_schema of this ActionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._openapi_schema - - @openapi_schema.setter - def openapi_schema(self, openapi_schema): - """Sets the openapi_schema of this ActionUpdateRequest. - - The action openapi_schema, which is compliant with the OpenAPI Specification. # noqa: E501 - - :param openapi_schema: The openapi_schema of this ActionUpdateRequest. # noqa: E501 - :type: object - """ - - self._openapi_schema = openapi_schema - - @property - def authentication(self): - """Gets the authentication of this ActionUpdateRequest. # noqa: E501 - - The action API authentication. # noqa: E501 - - :return: The authentication of this ActionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._authentication - - @authentication.setter - def authentication(self, authentication): - """Sets the authentication of this ActionUpdateRequest. - - The action API authentication. # noqa: E501 - - :param authentication: The authentication of this ActionUpdateRequest. # noqa: E501 - :type: object - """ - - self._authentication = authentication - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(ActionUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/action_update_response.py b/taskingai/client/models/rest/action_update_response.py deleted file mode 100644 index 83e3a40..0000000 --- a/taskingai/client/models/rest/action_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ActionUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ActionUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ActionUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ActionUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ActionUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this ActionUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ActionUpdateResponse. # noqa: E501 - - The updated action. # noqa: E501 - - :return: The data of this ActionUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ActionUpdateResponse. - - The updated action. # noqa: E501 - - :param data: The data of this ActionUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ActionUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ActionUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_create_request.py b/taskingai/client/models/rest/assistant_create_request.py deleted file mode 100644 index 98e2d27..0000000 --- a/taskingai/client/models/rest/assistant_create_request.py +++ /dev/null @@ -1,304 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'model_id': 'object', - 'name': 'object', - 'description': 'object', - 'system_prompt_template': 'object', - 'memory': 'object', - 'tools': 'object', - 'retrievals': 'object', - 'metadata': 'object' - } - - attribute_map = { - 'model_id': 'model_id', - 'name': 'name', - 'description': 'description', - 'system_prompt_template': 'system_prompt_template', - 'memory': 'memory', - 'tools': 'tools', - 'retrievals': 'retrievals', - 'metadata': 'metadata' - } - - def __init__(self, model_id=None, name=None, description=None, system_prompt_template=None, memory=None, tools=None, retrievals=None, metadata=None): # noqa: E501 - """AssistantCreateRequest - a model defined in Swagger""" # noqa: E501 - self._model_id = None - self._name = None - self._description = None - self._system_prompt_template = None - self._memory = None - self._tools = None - self._retrievals = None - self._metadata = None - self.discriminator = None - self.model_id = model_id - self.memory = memory - if name is not None: - self.name = name - if description is not None: - self.description = description - if system_prompt_template is not None: - self.system_prompt_template = system_prompt_template - if tools is not None: - self.tools = tools - if retrievals is not None: - self.retrievals = retrievals - if metadata is not None: - self.metadata = metadata - - @property - def model_id(self): - """Gets the model_id of this AssistantCreateRequest. # noqa: E501 - - The ID of an available chat completion model in your project. # noqa: E501 - - :return: The model_id of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._model_id - - @model_id.setter - def model_id(self, model_id): - """Sets the model_id of this AssistantCreateRequest. - - The ID of an available chat completion model in your project. # noqa: E501 - - :param model_id: The model_id of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - if model_id is None: - raise ValueError("Invalid value for `model_id`, must not be `None`") # noqa: E501 - - self._model_id = model_id - - @property - def name(self): - """Gets the name of this AssistantCreateRequest. # noqa: E501 - - The assistant name # noqa: E501 - - :return: The name of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this AssistantCreateRequest. - - The assistant name # noqa: E501 - - :param name: The name of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._name = name - - @property - def description(self): - """Gets the description of this AssistantCreateRequest. # noqa: E501 - - The assistant description # noqa: E501 - - :return: The description of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this AssistantCreateRequest. - - The assistant description # noqa: E501 - - :param description: The description of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._description = description - - @property - def system_prompt_template(self): - """Gets the system_prompt_template of this AssistantCreateRequest. # noqa: E501 - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :return: The system_prompt_template of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._system_prompt_template - - @system_prompt_template.setter - def system_prompt_template(self, system_prompt_template): - """Sets the system_prompt_template of this AssistantCreateRequest. - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :param system_prompt_template: The system_prompt_template of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._system_prompt_template = system_prompt_template - - @property - def memory(self): - """Gets the memory of this AssistantCreateRequest. # noqa: E501 - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :return: The memory of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._memory - - @memory.setter - def memory(self, memory): - """Sets the memory of this AssistantCreateRequest. - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :param memory: The memory of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._memory = memory - - @property - def tools(self): - """Gets the tools of this AssistantCreateRequest. # noqa: E501 - - A list of tools. # noqa: E501 - - :return: The tools of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._tools - - @tools.setter - def tools(self, tools): - """Sets the tools of this AssistantCreateRequest. - - A list of tools. # noqa: E501 - - :param tools: The tools of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._tools = tools - - @property - def retrievals(self): - """Gets the retrievals of this AssistantCreateRequest. # noqa: E501 - - A list of retrieval sources. # noqa: E501 - - :return: The retrievals of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._retrievals - - @retrievals.setter - def retrievals(self, retrievals): - """Sets the retrievals of this AssistantCreateRequest. - - A list of retrieval sources. # noqa: E501 - - :param retrievals: The retrievals of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._retrievals = retrievals - - @property - def metadata(self): - """Gets the metadata of this AssistantCreateRequest. # noqa: E501 - - The assistant metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this AssistantCreateRequest. - - The assistant metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_create_response.py b/taskingai/client/models/rest/assistant_create_response.py deleted file mode 100644 index 3a41204..0000000 --- a/taskingai/client/models/rest/assistant_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """AssistantCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this AssistantCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this AssistantCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this AssistantCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this AssistantCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this AssistantCreateResponse. # noqa: E501 - - The created assistant. # noqa: E501 - - :return: The data of this AssistantCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this AssistantCreateResponse. - - The created assistant. # noqa: E501 - - :param data: The data of this AssistantCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_delete_response.py b/taskingai/client/models/rest/assistant_delete_response.py deleted file mode 100644 index 168ceb6..0000000 --- a/taskingai/client/models/rest/assistant_delete_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantDeleteResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object' - } - - attribute_map = { - 'status': 'status' - } - - def __init__(self, status=None): # noqa: E501 - """AssistantDeleteResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self.discriminator = None - self.status = status - - @property - def status(self): - """Gets the status of this AssistantDeleteResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this AssistantDeleteResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this AssistantDeleteResponse. - - The response status. # noqa: E501 - - :param status: The status of this AssistantDeleteResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantDeleteResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantDeleteResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_get_response.py b/taskingai/client/models/rest/assistant_get_response.py deleted file mode 100644 index 07df908..0000000 --- a/taskingai/client/models/rest/assistant_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """AssistantGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this AssistantGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this AssistantGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this AssistantGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this AssistantGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this AssistantGetResponse. # noqa: E501 - - The response assistant data. # noqa: E501 - - :return: The data of this AssistantGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this AssistantGetResponse. - - The response assistant data. # noqa: E501 - - :param data: The data of this AssistantGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_list_response.py b/taskingai/client/models/rest/assistant_list_response.py deleted file mode 100644 index 7715e20..0000000 --- a/taskingai/client/models/rest/assistant_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'has_more': 'object', - 'fetched_count': 'object', - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'has_more': 'has_more', - 'fetched_count': 'fetched_count', - } - - def __init__(self, status=None, data=None, has_more=None, fetched_count=None): # noqa: E501 - """AssistantListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._has_more = None - self._fetched_count = None - self.discriminator = None - self.status = status - self.data = data - self.has_more = has_more - self.fetched_count = fetched_count - - @property - def status(self): - """Gets the status of this AssistantListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this AssistantListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this AssistantListResponse. - - The response status. # noqa: E501 - - :param status: The status of this AssistantListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this AssistantListResponse. # noqa: E501 - - List of assistants. # noqa: E501 - - :return: The data of this AssistantListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this AssistantListResponse. - - List of assistants. # noqa: E501 - - :param data: The data of this AssistantListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def has_more(self): - """Gets the has_more of this AssistantListResponse. # noqa: E501 - - Whether there are more assistants to return. # noqa: E501 - - :return: The has_more of this AssistantListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this AssistantListResponse. - - Whether there are more assistants to return. # noqa: E501 - - :param has_more: The has_more of this AssistantListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - @property - def fetched_count(self): - """Gets the fetched_count of this AssistantListResponse. # noqa: E501 - - The number of assistants returned in the response. # noqa: E501 - - :return: The fetched_count of this AssistantListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this AssistantListResponse. - - The number of assistants returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this AssistantListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_update_request.py b/taskingai/client/models/rest/assistant_update_request.py deleted file mode 100644 index 34109d9..0000000 --- a/taskingai/client/models/rest/assistant_update_request.py +++ /dev/null @@ -1,304 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'model_id': 'object', - 'name': 'object', - 'description': 'object', - 'system_prompt_template': 'object', - 'memory': 'object', - 'tools': 'object', - 'retrievals': 'object', - 'metadata': 'object' - } - - attribute_map = { - 'model_id': 'model_id', - 'name': 'name', - 'description': 'description', - 'system_prompt_template': 'system_prompt_template', - 'memory': 'memory', - 'tools': 'tools', - 'retrievals': 'retrievals', - 'metadata': 'metadata' - } - - def __init__(self, model_id=None, name=None, description=None, system_prompt_template=None, memory=None, tools=None, retrievals=None, metadata=None): # noqa: E501 - """AssistantUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._model_id = None - self._name = None - self._description = None - self._system_prompt_template = None - self._memory = None - self._tools = None - self._retrievals = None - self._metadata = None - self.discriminator = None - if model_id is not None: - self.model_id = model_id - if name is not None: - self.name = name - if description is not None: - self.description = description - if system_prompt_template is not None: - self.system_prompt_template = system_prompt_template - if memory is not None: - self.memory = memory - if tools is not None: - self.tools = tools - if retrievals is not None: - self.retrievals = retrievals - if metadata is not None: - self.metadata = metadata - - @property - def model_id(self): - """Gets the model_id of this AssistantUpdateRequest. # noqa: E501 - - The ID of an available chat completion model in your project. # noqa: E501 - - :return: The model_id of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._model_id - - @model_id.setter - def model_id(self, model_id): - """Sets the model_id of this AssistantUpdateRequest. - - The ID of an available chat completion model in your project. # noqa: E501 - - :param model_id: The model_id of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._model_id = model_id - - @property - def name(self): - """Gets the name of this AssistantUpdateRequest. # noqa: E501 - - The assistant name # noqa: E501 - - :return: The name of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this AssistantUpdateRequest. - - The assistant name # noqa: E501 - - :param name: The name of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._name = name - - @property - def description(self): - """Gets the description of this AssistantUpdateRequest. # noqa: E501 - - The assistant description # noqa: E501 - - :return: The description of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this AssistantUpdateRequest. - - The assistant description # noqa: E501 - - :param description: The description of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._description = description - - @property - def system_prompt_template(self): - """Gets the system_prompt_template of this AssistantUpdateRequest. # noqa: E501 - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :return: The system_prompt_template of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._system_prompt_template - - @system_prompt_template.setter - def system_prompt_template(self, system_prompt_template): - """Sets the system_prompt_template of this AssistantUpdateRequest. - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :param system_prompt_template: The system_prompt_template of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._system_prompt_template = system_prompt_template - - @property - def memory(self): - """Gets the memory of this AssistantCreateRequest. # noqa: E501 - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :return: The memory of this AssistantCreateRequest. # noqa: E501 - :rtype: object - """ - return self._memory - - @memory.setter - def memory(self, memory): - """Sets the memory of this AssistantCreateRequest. - - A list of system prompt chunks where prompt variables are wrapped by curly brackets, e.g. `{{variable}}`. # noqa: E501 - - :param memory: The memory of this AssistantCreateRequest. # noqa: E501 - :type: object - """ - - self._memory = memory - - @property - def tools(self): - """Gets the tools of this AssistantUpdateRequest. # noqa: E501 - - A list of tools. # noqa: E501 - - :return: The tools of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._tools - - @tools.setter - def tools(self, tools): - """Sets the tools of this AssistantUpdateRequest. - - A list of tools. # noqa: E501 - - :param tools: The tools of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._tools = tools - - @property - def retrievals(self): - """Gets the retrievals of this AssistantUpdateRequest. # noqa: E501 - - A list of retrieval sources. # noqa: E501 - - :return: The retrievals of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._retrievals - - @retrievals.setter - def retrievals(self, retrievals): - """Sets the retrievals of this AssistantUpdateRequest. - - A list of retrieval sources. # noqa: E501 - - :param retrievals: The retrievals of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._retrievals = retrievals - - @property - def metadata(self): - """Gets the metadata of this AssistantUpdateRequest. # noqa: E501 - - The assistant metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this AssistantUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this AssistantUpdateRequest. - - The assistant metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this AssistantUpdateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/assistant_update_response.py b/taskingai/client/models/rest/assistant_update_response.py deleted file mode 100644 index 8db0329..0000000 --- a/taskingai/client/models/rest/assistant_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class AssistantUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """AssistantUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this AssistantUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this AssistantUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this AssistantUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this AssistantUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this AssistantUpdateResponse. # noqa: E501 - - The updated assistant. # noqa: E501 - - :return: The data of this AssistantUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this AssistantUpdateResponse. - - The updated assistant. # noqa: E501 - - :param data: The data of this AssistantUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(AssistantUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, AssistantUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_completion_request.py b/taskingai/client/models/rest/chat_completion_request.py deleted file mode 100644 index 3e65f2a..0000000 --- a/taskingai/client/models/rest/chat_completion_request.py +++ /dev/null @@ -1,248 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatCompletionRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'model_id': 'object', - 'configs': 'object', - 'stream': 'object', - 'messages': 'object', - 'function_call': 'object', - 'functions': 'object' - } - - attribute_map = { - 'model_id': 'model_id', - 'configs': 'configs', - 'stream': 'stream', - 'messages': 'messages', - 'function_call': 'function_call', - 'functions': 'functions' - } - - def __init__(self, model_id=None, configs=None, stream=None, messages=None, function_call=None, functions=None): # noqa: E501 - """ChatCompletionRequest - a model defined in Swagger""" # noqa: E501 - self._model_id = None - self._configs = None - self._stream = None - self._messages = None - self._function_call = None - self._functions = None - self.discriminator = None - self.model_id = model_id - if configs is not None: - self.configs = configs - if stream is not None: - self.stream = stream - self.messages = messages - if function_call is not None: - self.function_call = function_call - if functions is not None: - self.functions = functions - - @property - def model_id(self): - """Gets the model_id of this ChatCompletionRequest. # noqa: E501 - - The chat completion model id. # noqa: E501 - - :return: The model_id of this ChatCompletionRequest. # noqa: E501 - :rtype: object - """ - return self._model_id - - @model_id.setter - def model_id(self, model_id): - """Sets the model_id of this ChatCompletionRequest. - - The chat completion model id. # noqa: E501 - - :param model_id: The model_id of this ChatCompletionRequest. # noqa: E501 - :type: object - """ - if model_id is None: - raise ValueError("Invalid value for `model_id`, must not be `None`") # noqa: E501 - - self._model_id = model_id - - @property - def configs(self): - """Gets the configs of this ChatCompletionRequest. # noqa: E501 - - The model configuration. # noqa: E501 - - :return: The configs of this ChatCompletionRequest. # noqa: E501 - :rtype: object - """ - return self._configs - - @configs.setter - def configs(self, configs): - """Sets the configs of this ChatCompletionRequest. - - The model configuration. # noqa: E501 - - :param configs: The configs of this ChatCompletionRequest. # noqa: E501 - :type: object - """ - - self._configs = configs - - @property - def stream(self): - """Gets the stream of this ChatCompletionRequest. # noqa: E501 - - Indicates whether the response should be streamed. If set to True, the response will be streamed using Server-Sent Events (SSE). # noqa: E501 - - :return: The stream of this ChatCompletionRequest. # noqa: E501 - :rtype: object - """ - return self._stream - - @stream.setter - def stream(self, stream): - """Sets the stream of this ChatCompletionRequest. - - Indicates whether the response should be streamed. If set to True, the response will be streamed using Server-Sent Events (SSE). # noqa: E501 - - :param stream: The stream of this ChatCompletionRequest. # noqa: E501 - :type: object - """ - - self._stream = stream - - @property - def messages(self): - """Gets the messages of this ChatCompletionRequest. # noqa: E501 - - The messages to be sent to the model. # noqa: E501 - - :return: The messages of this ChatCompletionRequest. # noqa: E501 - :rtype: object - """ - return self._messages - - @messages.setter - def messages(self, messages): - """Sets the messages of this ChatCompletionRequest. - - The messages to be sent to the model. # noqa: E501 - - :param messages: The messages of this ChatCompletionRequest. # noqa: E501 - :type: object - """ - if messages is None: - raise ValueError("Invalid value for `messages`, must not be `None`") # noqa: E501 - - self._messages = messages - - @property - def function_call(self): - """Gets the function_call of this ChatCompletionRequest. # noqa: E501 - - Controls whether a specific function is invoked by the model. If set to 'none', the model will generate a message without calling a function. If set to 'auto', the model can choose between generating a message or calling a function. Defining a specific function using {'name': 'my_function'} instructs the model to call that particular function. By default, 'none' is selected when there are no functions available, and 'auto' is selected when one or more functions are present. # noqa: E501 - - :return: The function_call of this ChatCompletionRequest. # noqa: E501 - :rtype: object - """ - return self._function_call - - @function_call.setter - def function_call(self, function_call): - """Sets the function_call of this ChatCompletionRequest. - - Controls whether a specific function is invoked by the model. If set to 'none', the model will generate a message without calling a function. If set to 'auto', the model can choose between generating a message or calling a function. Defining a specific function using {'name': 'my_function'} instructs the model to call that particular function. By default, 'none' is selected when there are no functions available, and 'auto' is selected when one or more functions are present. # noqa: E501 - - :param function_call: The function_call of this ChatCompletionRequest. # noqa: E501 - :type: object - """ - - self._function_call = function_call - - @property - def functions(self): - """Gets the functions of this ChatCompletionRequest. # noqa: E501 - - - :return: The functions of this ChatCompletionRequest. # noqa: E501 - :rtype: object - """ - return self._functions - - @functions.setter - def functions(self, functions): - """Sets the functions of this ChatCompletionRequest. - - - :param functions: The functions of this ChatCompletionRequest. # noqa: E501 - :type: object - """ - - self._functions = functions - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatCompletionRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatCompletionRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_completion_response.py b/taskingai/client/models/rest/chat_completion_response.py deleted file mode 100644 index 85b857e..0000000 --- a/taskingai/client/models/rest/chat_completion_response.py +++ /dev/null @@ -1,142 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 - - OpenAPI spec version: 0.1.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatCompletionResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ChatCompletionResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ChatCompletionResponse. # noqa: E501 - - The status of the response, which is always 'success'. # noqa: E501 - - :return: The status of this ChatCompletionResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChatCompletionResponse. - - The status of the response, which is always 'success'. # noqa: E501 - - :param status: The status of this ChatCompletionResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ChatCompletionResponse. # noqa: E501 - - The chat completion response data. # noqa: E501 - - :return: The data of this ChatCompletionResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ChatCompletionResponse. - - The chat completion response data. # noqa: E501 - - :param data: The data of this ChatCompletionResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatCompletionResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatCompletionResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_create_request.py b/taskingai/client/models/rest/chat_create_request.py deleted file mode 100644 index 8f5868d..0000000 --- a/taskingai/client/models/rest/chat_create_request.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'metadata': 'object' - } - - attribute_map = { - 'metadata': 'metadata' - } - - def __init__(self, metadata=None): # noqa: E501 - """ChatCreateRequest - a model defined in Swagger""" # noqa: E501 - self._metadata = None - self.discriminator = None - if metadata is not None: - self.metadata = metadata - - @property - def metadata(self): - """Gets the metadata of this ChatCreateRequest. # noqa: E501 - - The chat metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this ChatCreateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this ChatCreateRequest. - - The chat metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this ChatCreateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_create_response.py b/taskingai/client/models/rest/chat_create_response.py deleted file mode 100644 index 2c5bcf1..0000000 --- a/taskingai/client/models/rest/chat_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ChatCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ChatCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ChatCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChatCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this ChatCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ChatCreateResponse. # noqa: E501 - - The response chat data. # noqa: E501 - - :return: The data of this ChatCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ChatCreateResponse. - - The response chat data. # noqa: E501 - - :param data: The data of this ChatCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_delete_response.py b/taskingai/client/models/rest/chat_delete_response.py deleted file mode 100644 index a354515..0000000 --- a/taskingai/client/models/rest/chat_delete_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatDeleteResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object' - } - - attribute_map = { - 'status': 'status' - } - - def __init__(self, status=None): # noqa: E501 - """ChatDeleteResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self.discriminator = None - self.status = status - - @property - def status(self): - """Gets the status of this ChatDeleteResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ChatDeleteResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChatDeleteResponse. - - The response status. # noqa: E501 - - :param status: The status of this ChatDeleteResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatDeleteResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatDeleteResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_get_response.py b/taskingai/client/models/rest/chat_get_response.py deleted file mode 100644 index ce7b183..0000000 --- a/taskingai/client/models/rest/chat_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ChatGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ChatGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ChatGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChatGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this ChatGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ChatGetResponse. # noqa: E501 - - The response chat data. # noqa: E501 - - :return: The data of this ChatGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ChatGetResponse. - - The response chat data. # noqa: E501 - - :param data: The data of this ChatGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_list_response.py b/taskingai/client/models/rest/chat_list_response.py deleted file mode 100644 index e137c4a..0000000 --- a/taskingai/client/models/rest/chat_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'has_more': 'object', - 'fetched_count': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'has_more': 'has_more', - 'fetched_count': 'fetched_count' - } - - def __init__(self, status=None, data=None, has_more=None, fetched_count=None): # noqa: E501 - """ChatListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._has_more = None - self._fetched_count = None - self.discriminator = None - self.status = status - self.data = data - self.has_more = has_more - self.fetched_count = fetched_count - - @property - def status(self): - """Gets the status of this ChatListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ChatListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChatListResponse. - - The response status. # noqa: E501 - - :param status: The status of this ChatListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ChatListResponse. # noqa: E501 - - List of chats. # noqa: E501 - - :return: The data of this ChatListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ChatListResponse. - - List of chats. # noqa: E501 - - :param data: The data of this ChatListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def has_more(self): - """Gets the has_more of this ChatListResponse. # noqa: E501 - - Whether there are more chats to fetch. # noqa: E501 - - :return: The has_more of this ChatListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this ChatListResponse. - - Whether there are more chats to fetch. # noqa: E501 - - :param has_more: The has_more of this ChatListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - @property - def fetched_count(self): - """Gets the fetched_count of this ChatListResponse. # noqa: E501 - - The number of chats returned in the response. # noqa: E501 - - :return: The fetched_count of this ChatListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this ChatListResponse. - - The number of chats returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this ChatListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_update_request.py b/taskingai/client/models/rest/chat_update_request.py deleted file mode 100644 index cf0c60a..0000000 --- a/taskingai/client/models/rest/chat_update_request.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'metadata': 'object' - } - - attribute_map = { - 'metadata': 'metadata' - } - - def __init__(self, metadata=None): # noqa: E501 - """ChatUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._metadata = None - self.discriminator = None - if metadata is not None: - self.metadata = metadata - - @property - def metadata(self): - """Gets the metadata of this ChatUpdateRequest. # noqa: E501 - - The chat metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this ChatUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this ChatUpdateRequest. - - The chat metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this ChatUpdateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chat_update_response.py b/taskingai/client/models/rest/chat_update_response.py deleted file mode 100644 index a673611..0000000 --- a/taskingai/client/models/rest/chat_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChatUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """ChatUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this ChatUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ChatUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChatUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this ChatUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ChatUpdateResponse. # noqa: E501 - - The response chat data. # noqa: E501 - - :return: The data of this ChatUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ChatUpdateResponse. - - The response chat data. # noqa: E501 - - :param data: The data of this ChatUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChatUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChatUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chunk_query_request.py b/taskingai/client/models/rest/chunk_query_request.py deleted file mode 100644 index a233890..0000000 --- a/taskingai/client/models/rest/chunk_query_request.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChunkQueryRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'top_k': 'object', - 'query_text': 'object' - } - - attribute_map = { - 'top_k': 'top_k', - 'query_text': 'query_text' - } - - def __init__(self, top_k=None, query_text=None): # noqa: E501 - """ChunkQueryRequest - a model defined in Swagger""" # noqa: E501 - self._top_k = None - self._query_text = None - self.discriminator = None - self.top_k = top_k - self.query_text = query_text - - @property - def top_k(self): - """Gets the top_k of this ChunkQueryRequest. # noqa: E501 - - The number of most relevant chunks to return. # noqa: E501 - - :return: The top_k of this ChunkQueryRequest. # noqa: E501 - :rtype: object - """ - return self._top_k - - @top_k.setter - def top_k(self, top_k): - """Sets the top_k of this ChunkQueryRequest. - - The number of most relevant chunks to return. # noqa: E501 - - :param top_k: The top_k of this ChunkQueryRequest. # noqa: E501 - :type: object - """ - if top_k is None: - raise ValueError("Invalid value for `top_k`, must not be `None`") # noqa: E501 - - self._top_k = top_k - - @property - def query_text(self): - """Gets the query_text of this ChunkQueryRequest. # noqa: E501 - - The query text. Retrieval service will find and return the most relevant chunks to this text. # noqa: E501 - - :return: The query_text of this ChunkQueryRequest. # noqa: E501 - :rtype: object - """ - return self._query_text - - @query_text.setter - def query_text(self, query_text): - """Sets the query_text of this ChunkQueryRequest. - - The query text. Retrieval service will find and return the most relevant chunks to this text. # noqa: E501 - - :param query_text: The query_text of this ChunkQueryRequest. # noqa: E501 - :type: object - """ - if query_text is None: - raise ValueError("Invalid value for `query_text`, must not be `None`") # noqa: E501 - - self._query_text = query_text - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChunkQueryRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChunkQueryRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/chunk_query_response.py b/taskingai/client/models/rest/chunk_query_response.py deleted file mode 100644 index e0340c2..0000000 --- a/taskingai/client/models/rest/chunk_query_response.py +++ /dev/null @@ -1,167 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ChunkQueryResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'fetched_count': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'fetched_count': 'fetched_count' - } - - def __init__(self, status=None, data=None, fetched_count=None): # noqa: E501 - """ChunkQueryResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._fetched_count = None - self.discriminator = None - self.status = status - self.data = data - self.fetched_count = fetched_count - - @property - def status(self): - """Gets the status of this ChunkQueryResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this ChunkQueryResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this ChunkQueryResponse. - - The response status. # noqa: E501 - - :param status: The status of this ChunkQueryResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this ChunkQueryResponse. # noqa: E501 - - The response chunk list data. # noqa: E501 - - :return: The data of this ChunkQueryResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this ChunkQueryResponse. - - The response chunk list data. # noqa: E501 - - :param data: The data of this ChunkQueryResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def fetched_count(self): - """Gets the fetched_count of this ChunkQueryResponse. # noqa: E501 - - The number of chunks returned in the response. # noqa: E501 - - :return: The fetched_count of this ChunkQueryResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this ChunkQueryResponse. - - The number of chunks returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this ChunkQueryResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ChunkQueryResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ChunkQueryResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/collection_create_request.py b/taskingai/client/models/rest/collection_create_request.py deleted file mode 100644 index 3c3d206..0000000 --- a/taskingai/client/models/rest/collection_create_request.py +++ /dev/null @@ -1,223 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - - -class CollectionCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - "capacity": "object", - "embedding_model_id": "object", - "name": "object", - "description": "object", - "metadata": "object", - } - - attribute_map = { - "capacity": "capacity", - "embedding_model_id": "embedding_model_id", - "name": "name", - "description": "description", - "metadata": "metadata", - } - - def __init__( - self, capacity=None, embedding_model_id=None, name=None, description=None, metadata=None - ): # noqa: E501 - """CollectionCreateRequest - a model defined in Swagger""" # noqa: E501 - self._capacity = None - self._embedding_model_id = None - self._name = None - self._description = None - self._metadata = None - self.discriminator = None - if capacity is not None: - self.capacity = capacity - self.embedding_model_id = embedding_model_id - if name is not None: - self.name = name - if description is not None: - self.description = description - if metadata is not None: - self.metadata = metadata - - @property - def capacity(self): - """Gets the capacity of this CollectionCreateRequest. # noqa: E501 - - The collection capacity. Currently only 1000 is supported and we'll provide more options in the future. # noqa: E501 - - :return: The capacity of this CollectionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._capacity - - @capacity.setter - def capacity(self, capacity): - """Sets the capacity of this CollectionCreateRequest. - - The collection capacity. Currently only 1000 is supported and we'll provide more options in the future. # noqa: E501 - - :param capacity: The capacity of this CollectionCreateRequest. # noqa: E501 - :type: object - """ - - self._capacity = capacity - - @property - def embedding_model_id(self): - """Gets the embedding_model_id of this CollectionCreateRequest. # noqa: E501 - - The ID of an available text embedding model in your project. # noqa: E501 - - :return: The embedding_model_id of this CollectionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._embedding_model_id - - @embedding_model_id.setter - def embedding_model_id(self, embedding_model_id): - """Sets the embedding_model_id of this CollectionCreateRequest. - - The ID of an available text embedding model in your project. # noqa: E501 - - :param embedding_model_id: The embedding_model_id of this CollectionCreateRequest. # noqa: E501 - :type: object - """ - if embedding_model_id is None: - raise ValueError("Invalid value for `embedding_model_id`, must not be `None`") # noqa: E501 - - self._embedding_model_id = embedding_model_id - - @property - def name(self): - """Gets the name of this CollectionCreateRequest. # noqa: E501 - - The collection name # noqa: E501 - - :return: The name of this CollectionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this CollectionCreateRequest. - - The collection name # noqa: E501 - - :param name: The name of this CollectionCreateRequest. # noqa: E501 - :type: object - """ - - self._name = name - - @property - def description(self): - """Gets the description of this CollectionCreateRequest. # noqa: E501 - - The collection description # noqa: E501 - - :return: The description of this CollectionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this CollectionCreateRequest. - - The collection description # noqa: E501 - - :param description: The description of this CollectionCreateRequest. # noqa: E501 - :type: object - """ - - self._description = description - - @property - def metadata(self): - """Gets the metadata of this CollectionCreateRequest. # noqa: E501 - - The collection metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this CollectionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this CollectionCreateRequest. - - The collection metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this CollectionCreateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(CollectionCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/collection_create_response.py b/taskingai/client/models/rest/collection_create_response.py deleted file mode 100644 index 2851798..0000000 --- a/taskingai/client/models/rest/collection_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class CollectionCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """CollectionCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this CollectionCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this CollectionCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this CollectionCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this CollectionCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this CollectionCreateResponse. # noqa: E501 - - The created collection. # noqa: E501 - - :return: The data of this CollectionCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this CollectionCreateResponse. - - The created collection. # noqa: E501 - - :param data: The data of this CollectionCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CollectionCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/collection_get_response.py b/taskingai/client/models/rest/collection_get_response.py deleted file mode 100644 index 377907b..0000000 --- a/taskingai/client/models/rest/collection_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class CollectionGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """CollectionGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this CollectionGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this CollectionGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this CollectionGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this CollectionGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this CollectionGetResponse. # noqa: E501 - - The response collection data. # noqa: E501 - - :return: The data of this CollectionGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this CollectionGetResponse. - - The response collection data. # noqa: E501 - - :param data: The data of this CollectionGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CollectionGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/collection_list_response.py b/taskingai/client/models/rest/collection_list_response.py deleted file mode 100644 index 59edc46..0000000 --- a/taskingai/client/models/rest/collection_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class CollectionListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'fetched_count': 'object', - 'has_more': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'fetched_count': 'fetched_count', - 'has_more': 'has_more' - } - - def __init__(self, status=None, data=None, fetched_count=None, has_more=None): # noqa: E501 - """CollectionListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._fetched_count = None - self._has_more = None - self.discriminator = None - self.status = status - self.data = data - self.fetched_count = fetched_count - self.has_more = has_more - - @property - def status(self): - """Gets the status of this CollectionListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this CollectionListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this CollectionListResponse. - - The response status. # noqa: E501 - - :param status: The status of this CollectionListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this CollectionListResponse. # noqa: E501 - - List of collections. # noqa: E501 - - :return: The data of this CollectionListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this CollectionListResponse. - - List of collections. # noqa: E501 - - :param data: The data of this CollectionListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def fetched_count(self): - """Gets the fetched_count of this CollectionListResponse. # noqa: E501 - - The number of collections returned in the response. # noqa: E501 - - :return: The fetched_count of this CollectionListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this CollectionListResponse. - - The number of collections returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this CollectionListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - @property - def has_more(self): - """Gets the has_more of this CollectionListResponse. # noqa: E501 - - Whether there are more collections to fetch. # noqa: E501 - - :return: The has_more of this CollectionListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this CollectionListResponse. - - Whether there are more collections to fetch. # noqa: E501 - - :param has_more: The has_more of this CollectionListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CollectionListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/collection_update_request.py b/taskingai/client/models/rest/collection_update_request.py deleted file mode 100644 index c6307ba..0000000 --- a/taskingai/client/models/rest/collection_update_request.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class CollectionUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'object', - 'description': 'object', - 'metadata': 'object' - } - - attribute_map = { - 'name': 'name', - 'description': 'description', - 'metadata': 'metadata' - } - - def __init__(self, name=None, description=None, metadata=None): # noqa: E501 - """CollectionUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._name = None - self._description = None - self._metadata = None - self.discriminator = None - if name is not None: - self.name = name - if description is not None: - self.description = description - if metadata is not None: - self.metadata = metadata - - @property - def name(self): - """Gets the name of this CollectionUpdateRequest. # noqa: E501 - - The collection name # noqa: E501 - - :return: The name of this CollectionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this CollectionUpdateRequest. - - The collection name # noqa: E501 - - :param name: The name of this CollectionUpdateRequest. # noqa: E501 - :type: object - """ - - self._name = name - - @property - def description(self): - """Gets the description of this CollectionUpdateRequest. # noqa: E501 - - The collection description # noqa: E501 - - :return: The description of this CollectionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this CollectionUpdateRequest. - - The collection description # noqa: E501 - - :param description: The description of this CollectionUpdateRequest. # noqa: E501 - :type: object - """ - - self._description = description - - @property - def metadata(self): - """Gets the metadata of this CollectionUpdateRequest. # noqa: E501 - - The collection metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this CollectionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this CollectionUpdateRequest. - - The collection metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this CollectionUpdateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CollectionUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/collection_update_response.py b/taskingai/client/models/rest/collection_update_response.py deleted file mode 100644 index 054ef72..0000000 --- a/taskingai/client/models/rest/collection_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class CollectionUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """CollectionUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this CollectionUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this CollectionUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this CollectionUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this CollectionUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this CollectionUpdateResponse. # noqa: E501 - - The updated collection. # noqa: E501 - - :return: The data of this CollectionUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this CollectionUpdateResponse. - - The updated collection. # noqa: E501 - - :param data: The data of this CollectionUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(CollectionUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, CollectionUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/delete_collection_response.py b/taskingai/client/models/rest/delete_collection_response.py deleted file mode 100644 index 319762b..0000000 --- a/taskingai/client/models/rest/delete_collection_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class DeleteCollectionResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object' - } - - attribute_map = { - 'status': 'status' - } - - def __init__(self, status=None): # noqa: E501 - """DeleteCollectionResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self.discriminator = None - self.status = status - - @property - def status(self): - """Gets the status of this DeleteCollectionResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this DeleteCollectionResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this DeleteCollectionResponse. - - The response status. # noqa: E501 - - :param status: The status of this DeleteCollectionResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(DeleteCollectionResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, DeleteCollectionResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_create_request.py b/taskingai/client/models/rest/function_create_request.py deleted file mode 100644 index 5c3d0d7..0000000 --- a/taskingai/client/models/rest/function_create_request.py +++ /dev/null @@ -1,167 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'object', - 'description': 'object', - 'parameters': 'object' - } - - attribute_map = { - 'name': 'name', - 'description': 'description', - 'parameters': 'parameters' - } - - def __init__(self, name=None, description=None, parameters=None): # noqa: E501 - """FunctionCreateRequest - a model defined in Swagger""" # noqa: E501 - self._name = None - self._description = None - self._parameters = None - self.discriminator = None - self.name = name - self.description = description - self.parameters = parameters - - @property - def name(self): - """Gets the name of this FunctionCreateRequest. # noqa: E501 - - A meaningful function name, consists of letters, digits and underscore \"_\" and its first character cannot be a digit. # noqa: E501 - - :return: The name of this FunctionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this FunctionCreateRequest. - - A meaningful function name, consists of letters, digits and underscore \"_\" and its first character cannot be a digit. # noqa: E501 - - :param name: The name of this FunctionCreateRequest. # noqa: E501 - :type: object - """ - if name is None: - raise ValueError("Invalid value for `name`, must not be `None`") # noqa: E501 - - self._name = name - - @property - def description(self): - """Gets the description of this FunctionCreateRequest. # noqa: E501 - - The function description. # noqa: E501 - - :return: The description of this FunctionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this FunctionCreateRequest. - - The function description. # noqa: E501 - - :param description: The description of this FunctionCreateRequest. # noqa: E501 - :type: object - """ - if description is None: - raise ValueError("Invalid value for `description`, must not be `None`") # noqa: E501 - - self._description = description - - @property - def parameters(self): - """Gets the parameters of this FunctionCreateRequest. # noqa: E501 - - The action parameter schema. # noqa: E501 - - :return: The parameters of this FunctionCreateRequest. # noqa: E501 - :rtype: object - """ - return self._parameters - - @parameters.setter - def parameters(self, parameters): - """Sets the parameters of this FunctionCreateRequest. - - The action parameter schema. # noqa: E501 - - :param parameters: The parameters of this FunctionCreateRequest. # noqa: E501 - :type: object - """ - if parameters is None: - raise ValueError("Invalid value for `parameters`, must not be `None`") # noqa: E501 - - self._parameters = parameters - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_create_response.py b/taskingai/client/models/rest/function_create_response.py deleted file mode 100644 index 14f3878..0000000 --- a/taskingai/client/models/rest/function_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """FunctionCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this FunctionCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this FunctionCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this FunctionCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this FunctionCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this FunctionCreateResponse. # noqa: E501 - - The created function. # noqa: E501 - - :return: The data of this FunctionCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this FunctionCreateResponse. - - The created function. # noqa: E501 - - :param data: The data of this FunctionCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_delete_response.py b/taskingai/client/models/rest/function_delete_response.py deleted file mode 100644 index cfb3e8a..0000000 --- a/taskingai/client/models/rest/function_delete_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionDeleteResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object' - } - - attribute_map = { - 'status': 'status' - } - - def __init__(self, status=None): # noqa: E501 - """FunctionDeleteResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self.discriminator = None - self.status = status - - @property - def status(self): - """Gets the status of this FunctionDeleteResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this FunctionDeleteResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this FunctionDeleteResponse. - - The response status. # noqa: E501 - - :param status: The status of this FunctionDeleteResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionDeleteResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionDeleteResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_get_response.py b/taskingai/client/models/rest/function_get_response.py deleted file mode 100644 index 7430cda..0000000 --- a/taskingai/client/models/rest/function_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """FunctionGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this FunctionGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this FunctionGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this FunctionGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this FunctionGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this FunctionGetResponse. # noqa: E501 - - The response function data. # noqa: E501 - - :return: The data of this FunctionGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this FunctionGetResponse. - - The response function data. # noqa: E501 - - :param data: The data of this FunctionGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_list_response.py b/taskingai/client/models/rest/function_list_response.py deleted file mode 100644 index c980c39..0000000 --- a/taskingai/client/models/rest/function_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'fetched_count': 'object', - 'has_more': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'fetched_count': 'fetched_count', - 'has_more': 'has_more' - } - - def __init__(self, status=None, data=None, fetched_count=None, has_more=None): # noqa: E501 - """FunctionListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._fetched_count = None - self._has_more = None - self.discriminator = None - self.status = status - self.data = data - self.fetched_count = fetched_count - self.has_more = has_more - - @property - def status(self): - """Gets the status of this FunctionListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this FunctionListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this FunctionListResponse. - - The response status. # noqa: E501 - - :param status: The status of this FunctionListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this FunctionListResponse. # noqa: E501 - - List of functions. # noqa: E501 - - :return: The data of this FunctionListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this FunctionListResponse. - - List of functions. # noqa: E501 - - :param data: The data of this FunctionListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def fetched_count(self): - """Gets the fetched_count of this FunctionListResponse. # noqa: E501 - - The number of functions returned in the response. # noqa: E501 - - :return: The fetched_count of this FunctionListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this FunctionListResponse. - - The number of functions returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this FunctionListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - @property - def has_more(self): - """Gets the has_more of this FunctionListResponse. # noqa: E501 - - Whether there are more functions to fetch. # noqa: E501 - - :return: The has_more of this FunctionListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this FunctionListResponse. - - Whether there are more functions to fetch. # noqa: E501 - - :param has_more: The has_more of this FunctionListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_update_request.py b/taskingai/client/models/rest/function_update_request.py deleted file mode 100644 index c79b180..0000000 --- a/taskingai/client/models/rest/function_update_request.py +++ /dev/null @@ -1,164 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'name': 'object', - 'description': 'object', - 'parameters': 'object' - } - - attribute_map = { - 'name': 'name', - 'description': 'description', - 'parameters': 'parameters' - } - - def __init__(self, name=None, description=None, parameters=None): # noqa: E501 - """FunctionUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._name = None - self._description = None - self._parameters = None - self.discriminator = None - if name is not None: - self.name = name - if description is not None: - self.description = description - if parameters is not None: - self.parameters = parameters - - @property - def name(self): - """Gets the name of this FunctionUpdateRequest. # noqa: E501 - - A meaningful function name, consists of letters, digits and underscore \"_\" and its first character cannot be a digit. # noqa: E501 - - :return: The name of this FunctionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._name - - @name.setter - def name(self, name): - """Sets the name of this FunctionUpdateRequest. - - A meaningful function name, consists of letters, digits and underscore \"_\" and its first character cannot be a digit. # noqa: E501 - - :param name: The name of this FunctionUpdateRequest. # noqa: E501 - :type: object - """ - - self._name = name - - @property - def description(self): - """Gets the description of this FunctionUpdateRequest. # noqa: E501 - - The function description. # noqa: E501 - - :return: The description of this FunctionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._description - - @description.setter - def description(self, description): - """Sets the description of this FunctionUpdateRequest. - - The function description. # noqa: E501 - - :param description: The description of this FunctionUpdateRequest. # noqa: E501 - :type: object - """ - - self._description = description - - @property - def parameters(self): - """Gets the parameters of this FunctionUpdateRequest. # noqa: E501 - - The action parameter schema. # noqa: E501 - - :return: The parameters of this FunctionUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._parameters - - @parameters.setter - def parameters(self, parameters): - """Sets the parameters of this FunctionUpdateRequest. - - The action parameter schema. # noqa: E501 - - :param parameters: The parameters of this FunctionUpdateRequest. # noqa: E501 - :type: object - """ - - self._parameters = parameters - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/function_update_response.py b/taskingai/client/models/rest/function_update_response.py deleted file mode 100644 index 28a0add..0000000 --- a/taskingai/client/models/rest/function_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class FunctionUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """FunctionUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this FunctionUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this FunctionUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this FunctionUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this FunctionUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this FunctionUpdateResponse. # noqa: E501 - - The updated function. # noqa: E501 - - :return: The data of this FunctionUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this FunctionUpdateResponse. - - The updated function. # noqa: E501 - - :param data: The data of this FunctionUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(FunctionUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, FunctionUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/http_validation_error.py b/taskingai/client/models/rest/http_validation_error.py deleted file mode 100644 index e798435..0000000 --- a/taskingai/client/models/rest/http_validation_error.py +++ /dev/null @@ -1,106 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class HTTPValidationError(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'detail': 'object' - } - - attribute_map = { - 'detail': 'detail' - } - - def __init__(self, detail=None): # noqa: E501 - """HTTPValidationError - a model defined in Swagger""" # noqa: E501 - self._detail = None - self.discriminator = None - if detail is not None: - self.detail = detail - - @property - def detail(self): - """Gets the detail of this HTTPValidationError. # noqa: E501 - - - :return: The detail of this HTTPValidationError. # noqa: E501 - :rtype: object - """ - return self._detail - - @detail.setter - def detail(self, detail): - """Sets the detail of this HTTPValidationError. - - - :param detail: The detail of this HTTPValidationError. # noqa: E501 - :type: object - """ - - self._detail = detail - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(HTTPValidationError, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, HTTPValidationError): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_create_request.py b/taskingai/client/models/rest/message_create_request.py deleted file mode 100644 index d7ed608..0000000 --- a/taskingai/client/models/rest/message_create_request.py +++ /dev/null @@ -1,166 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'role': 'object', - 'content': 'object', - 'metadata': 'object' - } - - attribute_map = { - 'role': 'role', - 'content': 'content', - 'metadata': 'metadata' - } - - def __init__(self, role=None, content=None, metadata=None): # noqa: E501 - """MessageCreateRequest - a model defined in Swagger""" # noqa: E501 - self._role = None - self._content = None - self._metadata = None - self.discriminator = None - self.role = role - self.content = content - if metadata is not None: - self.metadata = metadata - - @property - def role(self): - """Gets the role of this MessageCreateRequest. # noqa: E501 - - The role of the message. Currently only `user` is supported. # noqa: E501 - - :return: The role of this MessageCreateRequest. # noqa: E501 - :rtype: object - """ - return self._role - - @role.setter - def role(self, role): - """Sets the role of this MessageCreateRequest. - - The role of the message. Currently only `user` is supported. # noqa: E501 - - :param role: The role of this MessageCreateRequest. # noqa: E501 - :type: object - """ - if role is None: - raise ValueError("Invalid value for `role`, must not be `None`") # noqa: E501 - - self._role = role - - @property - def content(self): - """Gets the content of this MessageCreateRequest. # noqa: E501 - - The message content. # noqa: E501 - - :return: The content of this MessageCreateRequest. # noqa: E501 - :rtype: object - """ - return self._content - - @content.setter - def content(self, content): - """Sets the content of this MessageCreateRequest. - - The message content. # noqa: E501 - - :param content: The content of this MessageCreateRequest. # noqa: E501 - :type: object - """ - if content is None: - raise ValueError("Invalid value for `content`, must not be `None`") # noqa: E501 - - self._content = content - - @property - def metadata(self): - """Gets the metadata of this MessageCreateRequest. # noqa: E501 - - The message metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this MessageCreateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this MessageCreateRequest. - - The message metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this MessageCreateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_create_response.py b/taskingai/client/models/rest/message_create_response.py deleted file mode 100644 index 7415c23..0000000 --- a/taskingai/client/models/rest/message_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """MessageCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this MessageCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this MessageCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this MessageCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this MessageCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this MessageCreateResponse. # noqa: E501 - - The response message data. # noqa: E501 - - :return: The data of this MessageCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MessageCreateResponse. - - The response message data. # noqa: E501 - - :param data: The data of this MessageCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_generate_request.py b/taskingai/client/models/rest/message_generate_request.py deleted file mode 100644 index ea696ef..0000000 --- a/taskingai/client/models/rest/message_generate_request.py +++ /dev/null @@ -1,143 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - - -import pprint -import re # noqa: F401 - -import six - -class MessageGenerateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'system_prompt_variables': 'object', - 'stream': 'object', - } - - attribute_map = { - 'system_prompt_variables': 'system_prompt_variables', - 'stream': 'stream', - } - - def __init__(self, system_prompt_variables=None, stream=None): # noqa: E501 - """MessageGenerateRequest - a model defined in Swagger""" # noqa: E501 - self._system_prompt_variables = None - self._stream = None - self.discriminator = None - if system_prompt_variables is not None: - self.system_prompt_variables = system_prompt_variables - if stream is not None: - self.stream = stream - - @property - def system_prompt_variables(self): - """Gets the system_prompt_variables of this MessageGenerateRequest. # noqa: E501 - - The variables that fit the system prompt template. # noqa: E501 - - :return: The system_prompt_variables of this MessageGenerateRequest. # noqa: E501 - :rtype: object - """ - return self._system_prompt_variables - - @system_prompt_variables.setter - def system_prompt_variables(self, system_prompt_variables): - """Sets the system_prompt_variables of this MessageGenerateRequest. - - The variables that fit the system prompt template. # noqa: E501 - - :param system_prompt_variables: The system_prompt_variables of this MessageGenerateRequest. # noqa: E501 - :type: object - """ - - self._system_prompt_variables = system_prompt_variables - - @property - def stream(self): - """Gets the stream of this MessageGenerateRequest. # noqa: E501 - - Whether to return the assistant message in stream format. When this option is turned on, the response data will be returned in SSE format. # noqa: E501 - - :return: The stream of this MessageGenerateRequest. # noqa: E501 - :rtype: object - """ - return self._stream - - @stream.setter - def stream(self, stream): - """Sets the stream of this MessageGenerateRequest. - - Whether to return the assistant message in stream format. When this option is turned on, the response data will be returned in SSE format. # noqa: E501 - - :param stream: The stream of this MessageGenerateRequest. # noqa: E501 - :type: object - """ - - self._stream = stream - - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageGenerateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageGenerateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_generate_response.py b/taskingai/client/models/rest/message_generate_response.py deleted file mode 100644 index 09d4df8..0000000 --- a/taskingai/client/models/rest/message_generate_response.py +++ /dev/null @@ -1,140 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) # noqa: E501 - - OpenAPI spec version: 0.1.0 - - Generated by: https://github.com/swagger-api/swagger-codegen.git -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageGenerateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'Message' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """MessageGenerateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this MessageGenerateResponse. # noqa: E501 - - Status of the response. # noqa: E501 - - :return: The status of this MessageGenerateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this MessageGenerateResponse. - - Status of the response. # noqa: E501 - - :param status: The status of this MessageGenerateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this MessageGenerateResponse. # noqa: E501 - - - :return: The data of this MessageGenerateResponse. # noqa: E501 - :rtype: Message - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MessageGenerateResponse. - - - :param data: The data of this MessageGenerateResponse. # noqa: E501 - :type: Message - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageGenerateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageGenerateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_get_response.py b/taskingai/client/models/rest/message_get_response.py deleted file mode 100644 index fd95e4b..0000000 --- a/taskingai/client/models/rest/message_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """MessageGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this MessageGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this MessageGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this MessageGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this MessageGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this MessageGetResponse. # noqa: E501 - - The response message data. # noqa: E501 - - :return: The data of this MessageGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MessageGetResponse. - - The response message data. # noqa: E501 - - :param data: The data of this MessageGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_list_response.py b/taskingai/client/models/rest/message_list_response.py deleted file mode 100644 index f54376e..0000000 --- a/taskingai/client/models/rest/message_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'has_more': 'object', - 'fetched_count': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'has_more': 'has_more', - 'fetched_count': 'fetched_count' - } - - def __init__(self, status=None, data=None, has_more=None, fetched_count=None): # noqa: E501 - """MessageListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._has_more = None - self._fetched_count = None - self.discriminator = None - self.status = status - self.data = data - self.has_more = has_more - self.fetched_count = fetched_count - - @property - def status(self): - """Gets the status of this MessageListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this MessageListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this MessageListResponse. - - The response status. # noqa: E501 - - :param status: The status of this MessageListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this MessageListResponse. # noqa: E501 - - List of messages. # noqa: E501 - - :return: The data of this MessageListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MessageListResponse. - - List of messages. # noqa: E501 - - :param data: The data of this MessageListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def has_more(self): - """Gets the has_more of this MessageListResponse. # noqa: E501 - - Whether there are more messages to fetch. # noqa: E501 - - :return: The has_more of this MessageListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this MessageListResponse. - - Whether there are more messages to fetch. # noqa: E501 - - :param has_more: The has_more of this MessageListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - @property - def fetched_count(self): - """Gets the fetched_count of this MessageListResponse. # noqa: E501 - - The number of messages returned in the response. # noqa: E501 - - :return: The fetched_count of this MessageListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this MessageListResponse. - - The number of messages returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this MessageListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_update_request.py b/taskingai/client/models/rest/message_update_request.py deleted file mode 100644 index 5aed354..0000000 --- a/taskingai/client/models/rest/message_update_request.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'metadata': 'object' - } - - attribute_map = { - 'metadata': 'metadata' - } - - def __init__(self, metadata=None): # noqa: E501 - """MessageUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._metadata = None - self.discriminator = None - if metadata is not None: - self.metadata = metadata - - @property - def metadata(self): - """Gets the metadata of this MessageUpdateRequest. # noqa: E501 - - The message metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this MessageUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this MessageUpdateRequest. - - The message metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this MessageUpdateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/message_update_response.py b/taskingai/client/models/rest/message_update_response.py deleted file mode 100644 index ba91a17..0000000 --- a/taskingai/client/models/rest/message_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class MessageUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """MessageUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this MessageUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this MessageUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this MessageUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this MessageUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this MessageUpdateResponse. # noqa: E501 - - The response message data. # noqa: E501 - - :return: The data of this MessageUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this MessageUpdateResponse. - - The response message data. # noqa: E501 - - :param data: The data of this MessageUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(MessageUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, MessageUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_create_request.py b/taskingai/client/models/rest/record_create_request.py deleted file mode 100644 index a0a7477..0000000 --- a/taskingai/client/models/rest/record_create_request.py +++ /dev/null @@ -1,181 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - - -class RecordCreateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = {"type": "object", "content": "object", "text_splitter": "object", "metadata": "object"} - - attribute_map = {"type": "type", "content": "content", "text_splitter": "text_splitter", "metadata": "metadata"} - - def __init__(self, type=None, content=None, text_splitter=None, metadata=None): # noqa: E501 - """RecordCreateRequest - a model defined in Swagger""" # noqa: E501 - self._type = None - self._content = None - self._text_splitter = None - self._metadata = None - self.discriminator = None - self.type = type - self.content = content - self.text_splitter = text_splitter - if metadata is not None: - self.metadata = metadata - - @property - def type(self): - """Gets the type of this RecordCreateRequest. # noqa: E501 - - The record type. - - :return: The type of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this RecordCreateRequest. - - The record type. - - :param type: The type of this RecordCreateRequest. # noqa: E501 - :type: object - """ - if type is None: - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - - self._type = type - - @property - def content(self): - """Gets the content of this RecordCreateRequest. # noqa: E501 - - The record content. - - :return: The content of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._content - - @content.setter - def content(self, content): - """Sets the content of this RecordCreateRequest. - - The record content. - - :param content: The content of this RecordCreateRequest. # noqa: E501 - :type: object - """ - - self._content = content - - @property - def text_splitter(self): - """Gets the text_splitter of this RecordCreateRequest. # noqa: E501 - - The text splitter to split records into chunks. - - :return: The text_splitter of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._text_splitter - - @text_splitter.setter - def text_splitter(self, text_splitter): - """Sets the text_splitter of this RecordCreateRequest. - - The text splitter to split records into chunks. - - :param text_splitter: The text_splitter of this RecordCreateRequest. # noqa: E501 - :type: object - """ - - self._text_splitter = text_splitter - - @property - def metadata(self): - """Gets the metadata of this RecordCreateRequest. # noqa: E501 - - The record metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :return: The metadata of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this RecordCreateRequest. - - The record metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. # noqa: E501 - - :param metadata: The metadata of this RecordCreateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(RecordCreateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordCreateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_create_response.py b/taskingai/client/models/rest/record_create_response.py deleted file mode 100644 index 66772c3..0000000 --- a/taskingai/client/models/rest/record_create_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class RecordCreateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """RecordCreateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this RecordCreateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this RecordCreateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this RecordCreateResponse. - - The response status. # noqa: E501 - - :param status: The status of this RecordCreateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this RecordCreateResponse. # noqa: E501 - - The created record data. # noqa: E501 - - :return: The data of this RecordCreateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this RecordCreateResponse. - - The created record data. # noqa: E501 - - :param data: The data of this RecordCreateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RecordCreateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordCreateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_delete_response.py b/taskingai/client/models/rest/record_delete_response.py deleted file mode 100644 index 303a730..0000000 --- a/taskingai/client/models/rest/record_delete_response.py +++ /dev/null @@ -1,109 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class RecordDeleteResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object' - } - - attribute_map = { - 'status': 'status' - } - - def __init__(self, status=None): # noqa: E501 - """RecordDeleteResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self.discriminator = None - self.status = status - - @property - def status(self): - """Gets the status of this RecordDeleteResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this RecordDeleteResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this RecordDeleteResponse. - - The response status. # noqa: E501 - - :param status: The status of this RecordDeleteResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RecordDeleteResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordDeleteResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_get_response.py b/taskingai/client/models/rest/record_get_response.py deleted file mode 100644 index 8c1941a..0000000 --- a/taskingai/client/models/rest/record_get_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class RecordGetResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """RecordGetResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this RecordGetResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this RecordGetResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this RecordGetResponse. - - The response status. # noqa: E501 - - :param status: The status of this RecordGetResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this RecordGetResponse. # noqa: E501 - - The response record data. # noqa: E501 - - :return: The data of this RecordGetResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this RecordGetResponse. - - The response record data. # noqa: E501 - - :param data: The data of this RecordGetResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RecordGetResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordGetResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_list_response.py b/taskingai/client/models/rest/record_list_response.py deleted file mode 100644 index 559c0f1..0000000 --- a/taskingai/client/models/rest/record_list_response.py +++ /dev/null @@ -1,196 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class RecordListResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object', - 'fetched_count': 'object', - 'has_more': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data', - 'fetched_count': 'fetched_count', - 'has_more': 'has_more' - } - - def __init__(self, status=None, data=None, fetched_count=None, has_more=None): # noqa: E501 - """RecordListResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self._fetched_count = None - self._has_more = None - self.discriminator = None - self.status = status - self.data = data - self.fetched_count = fetched_count - self.has_more = has_more - - @property - def status(self): - """Gets the status of this RecordListResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this RecordListResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this RecordListResponse. - - The response status. # noqa: E501 - - :param status: The status of this RecordListResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this RecordListResponse. # noqa: E501 - - List of records. # noqa: E501 - - :return: The data of this RecordListResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this RecordListResponse. - - List of records. # noqa: E501 - - :param data: The data of this RecordListResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - @property - def fetched_count(self): - """Gets the fetched_count of this RecordListResponse. # noqa: E501 - - The number of records returned in the response. # noqa: E501 - - :return: The fetched_count of this RecordListResponse. # noqa: E501 - :rtype: object - """ - return self._fetched_count - - @fetched_count.setter - def fetched_count(self, fetched_count): - """Sets the fetched_count of this RecordListResponse. - - The number of records returned in the response. # noqa: E501 - - :param fetched_count: The fetched_count of this RecordListResponse. # noqa: E501 - :type: object - """ - if fetched_count is None: - raise ValueError("Invalid value for `fetched_count`, must not be `None`") # noqa: E501 - - self._fetched_count = fetched_count - - @property - def has_more(self): - """Gets the has_more of this RecordListResponse. # noqa: E501 - - Whether there are more records to return. # noqa: E501 - - :return: The has_more of this RecordListResponse. # noqa: E501 - :rtype: object - """ - return self._has_more - - @has_more.setter - def has_more(self, has_more): - """Sets the has_more of this RecordListResponse. - - Whether there are more records to return. # noqa: E501 - - :param has_more: The has_more of this RecordListResponse. # noqa: E501 - :type: object - """ - if has_more is None: - raise ValueError("Invalid value for `has_more`, must not be `None`") # noqa: E501 - - self._has_more = has_more - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RecordListResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordListResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_update_request.py b/taskingai/client/models/rest/record_update_request.py deleted file mode 100644 index 1fa12b7..0000000 --- a/taskingai/client/models/rest/record_update_request.py +++ /dev/null @@ -1,182 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - - -class RecordUpdateRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = {"type": "object", "content": "object", "text_splitter": "object", "metadata": "object"} - - attribute_map = {"type": "type", "content": "content", "text_splitter": "text_splitter", "metadata": "metadata"} - - def __init__(self, type=None, content=None, text_splitter=None, metadata=None): # noqa: E501 - """RecordUpdateRequest - a model defined in Swagger""" # noqa: E501 - self._type = None - self._content = None - self._text_splitter = None - self._metadata = None - self.discriminator = None - if type is not None: - self.type = type - if content is not None: - self.content = content - if text_splitter is not None: - self.text_splitter = text_splitter - if metadata is not None: - self.metadata = metadata - - @property - def type(self): - """Gets the type of this RecordCreateRequest. # noqa: E501 - - The record type. - - :return: The type of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this RecordCreateRequest. - - The record type. - - :param type: The type of this RecordCreateRequest. # noqa: E501 - :type: object - """ - if type is None: - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - - self._type = type - - @property - def content(self): - """Gets the content of this RecordCreateRequest. # noqa: E501 - - The record content. - - :return: The content of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._content - - @content.setter - def content(self, content): - """Sets the content of this RecordCreateRequest. - - The record content. - - :param content: The content of this RecordCreateRequest. # noqa: E501 - :type: object - """ - - self._content = content - - @property - def text_splitter(self): - """Gets the text_splitter of this RecordCreateRequest. # noqa: E501 - - The text splitter to split records into chunks. - - :return: The text_splitter of this RecordCreateRequest. # noqa: E501 - :rtype: object - """ - return self._text_splitter - - @text_splitter.setter - def text_splitter(self, text_splitter): - """Sets the text_splitter of this RecordCreateRequest. - - The text splitter to split records into chunks. - - :param text_splitter: The text_splitter of this RecordCreateRequest. # noqa: E501 - :type: object - """ - - self._text_splitter = text_splitter - - @property - def metadata(self): - """Gets the metadata of this RecordUpdateRequest. # noqa: E501 - - - :return: The metadata of this RecordUpdateRequest. # noqa: E501 - :rtype: object - """ - return self._metadata - - @metadata.setter - def metadata(self, metadata): - """Sets the metadata of this RecordUpdateRequest. - - - :param metadata: The metadata of this RecordUpdateRequest. # noqa: E501 - :type: object - """ - - self._metadata = metadata - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map(lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value)) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict( - map( - lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, - value.items(), - ) - ) - else: - result[attr] = value - if issubclass(RecordUpdateRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordUpdateRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/record_update_response.py b/taskingai/client/models/rest/record_update_response.py deleted file mode 100644 index e920a5e..0000000 --- a/taskingai/client/models/rest/record_update_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class RecordUpdateResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """RecordUpdateResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this RecordUpdateResponse. # noqa: E501 - - The response status. # noqa: E501 - - :return: The status of this RecordUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this RecordUpdateResponse. - - The response status. # noqa: E501 - - :param status: The status of this RecordUpdateResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this RecordUpdateResponse. # noqa: E501 - - The response record data. # noqa: E501 - - :return: The data of this RecordUpdateResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this RecordUpdateResponse. - - The response record data. # noqa: E501 - - :param data: The data of this RecordUpdateResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(RecordUpdateResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, RecordUpdateResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/text_embedding_request.py b/taskingai/client/models/rest/text_embedding_request.py deleted file mode 100644 index 5059a8b..0000000 --- a/taskingai/client/models/rest/text_embedding_request.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class TextEmbeddingRequest(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'model_id': 'object', - 'input': 'object' - } - - attribute_map = { - 'model_id': 'model_id', - 'input': 'input' - } - - def __init__(self, model_id=None, input=None): # noqa: E501 - """TextEmbeddingRequest - a model defined in Swagger""" # noqa: E501 - self._model_id = None - self._input = None - self.discriminator = None - self.model_id = model_id - self.input = input - - @property - def model_id(self): - """Gets the model_id of this TextEmbeddingRequest. # noqa: E501 - - The text embedding model id. # noqa: E501 - - :return: The model_id of this TextEmbeddingRequest. # noqa: E501 - :rtype: object - """ - return self._model_id - - @model_id.setter - def model_id(self, model_id): - """Sets the model_id of this TextEmbeddingRequest. - - The text embedding model id. # noqa: E501 - - :param model_id: The model_id of this TextEmbeddingRequest. # noqa: E501 - :type: object - """ - if model_id is None: - raise ValueError("Invalid value for `model_id`, must not be `None`") # noqa: E501 - - self._model_id = model_id - - @property - def input(self): - """Gets the input of this TextEmbeddingRequest. # noqa: E501 - - The input text or a list of input texts. # noqa: E501 - - :return: The input of this TextEmbeddingRequest. # noqa: E501 - :rtype: object - """ - return self._input - - @input.setter - def input(self, input): - """Sets the input of this TextEmbeddingRequest. - - The input text or a list of input texts. # noqa: E501 - - :param input: The input of this TextEmbeddingRequest. # noqa: E501 - :type: object - """ - if input is None: - raise ValueError("Invalid value for `input`, must not be `None`") # noqa: E501 - - self._input = input - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TextEmbeddingRequest, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TextEmbeddingRequest): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/text_embedding_response.py b/taskingai/client/models/rest/text_embedding_response.py deleted file mode 100644 index 2eedbd2..0000000 --- a/taskingai/client/models/rest/text_embedding_response.py +++ /dev/null @@ -1,138 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class TextEmbeddingResponse(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'status': 'object', - 'data': 'object' - } - - attribute_map = { - 'status': 'status', - 'data': 'data' - } - - def __init__(self, status=None, data=None): # noqa: E501 - """TextEmbeddingResponse - a model defined in Swagger""" # noqa: E501 - self._status = None - self._data = None - self.discriminator = None - self.status = status - self.data = data - - @property - def status(self): - """Gets the status of this TextEmbeddingResponse. # noqa: E501 - - The status of the response, which is always 'success'. # noqa: E501 - - :return: The status of this TextEmbeddingResponse. # noqa: E501 - :rtype: object - """ - return self._status - - @status.setter - def status(self, status): - """Sets the status of this TextEmbeddingResponse. - - The status of the response, which is always 'success'. # noqa: E501 - - :param status: The status of this TextEmbeddingResponse. # noqa: E501 - :type: object - """ - if status is None: - raise ValueError("Invalid value for `status`, must not be `None`") # noqa: E501 - - self._status = status - - @property - def data(self): - """Gets the data of this TextEmbeddingResponse. # noqa: E501 - - The text embedding response data. # noqa: E501 - - :return: The data of this TextEmbeddingResponse. # noqa: E501 - :rtype: object - """ - return self._data - - @data.setter - def data(self, data): - """Sets the data of this TextEmbeddingResponse. - - The text embedding response data. # noqa: E501 - - :param data: The data of this TextEmbeddingResponse. # noqa: E501 - :type: object - """ - if data is None: - raise ValueError("Invalid value for `data`, must not be `None`") # noqa: E501 - - self._data = data - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(TextEmbeddingResponse, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, TextEmbeddingResponse): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/rest/validation_error.py b/taskingai/client/models/rest/validation_error.py deleted file mode 100644 index b983f58..0000000 --- a/taskingai/client/models/rest/validation_error.py +++ /dev/null @@ -1,161 +0,0 @@ -# coding: utf-8 - -""" - TaskingAI API - - OpenAPI spec version: 0.1.0 -""" - -import pprint -import re # noqa: F401 - -import six - -class ValidationError(object): - """NOTE: This class is auto generated by the swagger code generator program. - - Do not edit the class manually. - """ - """ - Attributes: - swagger_types (dict): The key is attribute name - and the value is attribute type. - attribute_map (dict): The key is attribute name - and the value is json key in definition. - """ - swagger_types = { - 'loc': 'object', - 'msg': 'object', - 'type': 'object' - } - - attribute_map = { - 'loc': 'loc', - 'msg': 'msg', - 'type': 'type' - } - - def __init__(self, loc=None, msg=None, type=None): # noqa: E501 - """ValidationError - a model defined in Swagger""" # noqa: E501 - self._loc = None - self._msg = None - self._type = None - self.discriminator = None - self.loc = loc - self.msg = msg - self.type = type - - @property - def loc(self): - """Gets the loc of this ValidationError. # noqa: E501 - - - :return: The loc of this ValidationError. # noqa: E501 - :rtype: object - """ - return self._loc - - @loc.setter - def loc(self, loc): - """Sets the loc of this ValidationError. - - - :param loc: The loc of this ValidationError. # noqa: E501 - :type: object - """ - if loc is None: - raise ValueError("Invalid value for `loc`, must not be `None`") # noqa: E501 - - self._loc = loc - - @property - def msg(self): - """Gets the msg of this ValidationError. # noqa: E501 - - - :return: The msg of this ValidationError. # noqa: E501 - :rtype: object - """ - return self._msg - - @msg.setter - def msg(self, msg): - """Sets the msg of this ValidationError. - - - :param msg: The msg of this ValidationError. # noqa: E501 - :type: object - """ - if msg is None: - raise ValueError("Invalid value for `msg`, must not be `None`") # noqa: E501 - - self._msg = msg - - @property - def type(self): - """Gets the type of this ValidationError. # noqa: E501 - - - :return: The type of this ValidationError. # noqa: E501 - :rtype: object - """ - return self._type - - @type.setter - def type(self, type): - """Sets the type of this ValidationError. - - - :param type: The type of this ValidationError. # noqa: E501 - :type: object - """ - if type is None: - raise ValueError("Invalid value for `type`, must not be `None`") # noqa: E501 - - self._type = type - - def to_dict(self): - """Returns the model properties as a dict""" - result = {} - - for attr, _ in six.iteritems(self.swagger_types): - value = getattr(self, attr) - if isinstance(value, list): - result[attr] = list(map( - lambda x: x.to_dict() if hasattr(x, "to_dict") else x, - value - )) - elif hasattr(value, "to_dict"): - result[attr] = value.to_dict() - elif isinstance(value, dict): - result[attr] = dict(map( - lambda item: (item[0], item[1].to_dict()) - if hasattr(item[1], "to_dict") else item, - value.items() - )) - else: - result[attr] = value - if issubclass(ValidationError, dict): - for key, value in self.items(): - result[key] = value - - return result - - def to_str(self): - """Returns the string representation of the model""" - return pprint.pformat(self.to_dict()) - - def __repr__(self): - """For `print` and `pprint`""" - return self.to_str() - - def __eq__(self, other): - """Returns true if both objects are equal""" - if not isinstance(other, ValidationError): - return False - - return self.__dict__ == other.__dict__ - - def __ne__(self, other): - """Returns true if both objects are not equal""" - return not self == other diff --git a/taskingai/client/models/schemas/__init__.py b/taskingai/client/models/schemas/__init__.py new file mode 100644 index 0000000..e561f9d --- /dev/null +++ b/taskingai/client/models/schemas/__init__.py @@ -0,0 +1,74 @@ +# -*- coding: utf-8 -*- + +# __init__.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from .action_bulk_create_request import * +from .action_bulk_create_response import * +from .action_get_response import * +from .action_list_request import * +from .action_list_response import * +from .action_run_request import * +from .action_run_response import * +from .action_update_request import * +from .action_update_response import * +from .assistant_create_request import * +from .assistant_create_response import * +from .assistant_get_response import * +from .assistant_list_request import * +from .assistant_list_response import * +from .assistant_update_request import * +from .assistant_update_response import * +from .base_empty_response import * +from .chat_completion_request import * +from .chat_completion_response import * +from .chat_create_request import * +from .chat_create_response import * +from .chat_get_response import * +from .chat_list_request import * +from .chat_list_response import * +from .chat_update_request import * +from .chat_update_response import * +from .chunk_create_request import * +from .chunk_create_response import * +from .chunk_get_response import * +from .chunk_list_request import * +from .chunk_list_response import * +from .chunk_query_request import * +from .chunk_query_response import * +from .chunk_update_request import * +from .chunk_update_response import * +from .collection_create_request import * +from .collection_create_response import * +from .collection_get_response import * +from .collection_list_request import * +from .collection_list_response import * +from .collection_update_request import * +from .collection_update_response import * +from .message_create_request import * +from .message_create_response import * +from .message_generate_request import * +from .message_generate_response import * +from .message_get_response import * +from .message_list_request import * +from .message_list_response import * +from .message_update_request import * +from .message_update_response import * +from .record_create_request import * +from .record_create_response import * +from .record_get_response import * +from .record_list_request import * +from .record_list_response import * +from .record_update_request import * +from .record_update_response import * +from .text_embedding_request import * +from .text_embedding_response import * diff --git a/taskingai/client/models/schemas/action_bulk_create_request.py b/taskingai/client/models/schemas/action_bulk_create_request.py new file mode 100644 index 0000000..dc7b778 --- /dev/null +++ b/taskingai/client/models/schemas/action_bulk_create_request.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# action_bulk_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict +from ..entities.action_authentication import ActionAuthentication + +__all__ = ["ActionBulkCreateRequest"] + + +class ActionBulkCreateRequest(BaseModel): + openapi_schema: Dict = Field(...) + authentication: ActionAuthentication = Field(...) diff --git a/taskingai/client/models/schemas/action_bulk_create_response.py b/taskingai/client/models/schemas/action_bulk_create_response.py new file mode 100644 index 0000000..c3a577c --- /dev/null +++ b/taskingai/client/models/schemas/action_bulk_create_response.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# action_bulk_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.action import Action + +__all__ = ["ActionBulkCreateResponse"] + + +class ActionBulkCreateResponse(BaseModel): + status: str = Field("success") + data: List[Action] = Field(...) diff --git a/taskingai/client/models/schemas/action_get_response.py b/taskingai/client/models/schemas/action_get_response.py new file mode 100644 index 0000000..67c49d6 --- /dev/null +++ b/taskingai/client/models/schemas/action_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# action_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.action import Action + +__all__ = ["ActionGetResponse"] + + +class ActionGetResponse(BaseModel): + status: str = Field("success") + data: Action = Field(...) diff --git a/taskingai/client/models/schemas/action_list_request.py b/taskingai/client/models/schemas/action_list_request.py new file mode 100644 index 0000000..1b859fe --- /dev/null +++ b/taskingai/client/models/schemas/action_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# action_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["ActionListRequest"] + + +class ActionListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/action_list_response.py b/taskingai/client/models/schemas/action_list_response.py new file mode 100644 index 0000000..f3cf544 --- /dev/null +++ b/taskingai/client/models/schemas/action_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# action_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.action import Action + +__all__ = ["ActionListResponse"] + + +class ActionListResponse(BaseModel): + status: str = Field("success") + data: List[Action] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/action_run_request.py b/taskingai/client/models/schemas/action_run_request.py new file mode 100644 index 0000000..8261fda --- /dev/null +++ b/taskingai/client/models/schemas/action_run_request.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# action_run_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Any, Dict + + +__all__ = ["ActionRunRequest"] + + +class ActionRunRequest(BaseModel): + parameters: Optional[Dict[str, Any]] = Field(None) diff --git a/taskingai/client/models/schemas/action_run_response.py b/taskingai/client/models/schemas/action_run_response.py new file mode 100644 index 0000000..e89c0e0 --- /dev/null +++ b/taskingai/client/models/schemas/action_run_response.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# action_run_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["ActionRunResponse"] + + +class ActionRunResponse(BaseModel): + status: str = Field("success") + data: Dict = Field(...) diff --git a/taskingai/client/models/schemas/action_update_request.py b/taskingai/client/models/schemas/action_update_request.py new file mode 100644 index 0000000..2f78f5f --- /dev/null +++ b/taskingai/client/models/schemas/action_update_request.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# action_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Any, Dict +from ..entities.action_authentication import ActionAuthentication + +__all__ = ["ActionUpdateRequest"] + + +class ActionUpdateRequest(BaseModel): + openapi_schema: Optional[Dict[str, Any]] = Field(None) + authentication: Optional[ActionAuthentication] = Field(None) diff --git a/taskingai/client/models/schemas/action_update_response.py b/taskingai/client/models/schemas/action_update_response.py new file mode 100644 index 0000000..e72cf40 --- /dev/null +++ b/taskingai/client/models/schemas/action_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# action_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.action import Action + +__all__ = ["ActionUpdateResponse"] + + +class ActionUpdateResponse(BaseModel): + status: str = Field("success") + data: Action = Field(...) diff --git a/taskingai/client/models/schemas/assistant_create_request.py b/taskingai/client/models/schemas/assistant_create_request.py new file mode 100644 index 0000000..775911d --- /dev/null +++ b/taskingai/client/models/schemas/assistant_create_request.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +# assistant_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict, List +from ..entities.assistant_memory import AssistantMemory +from ..entities.tool_ref import ToolRef +from ..entities.retrieval_ref import RetrievalRef +from ..entities.retrieval_config import RetrievalConfig + +__all__ = ["AssistantCreateRequest"] + + +class AssistantCreateRequest(BaseModel): + model_id: str = Field(...) + name: str = Field("") + description: str = Field("") + system_prompt_template: List[str] = Field([]) + memory: AssistantMemory = Field(...) + tools: List[ToolRef] = Field([]) + retrievals: List[RetrievalRef] = Field([]) + retrieval_configs: RetrievalConfig = Field(...) + metadata: Dict[str, str] = Field({}) diff --git a/taskingai/client/models/schemas/assistant_create_response.py b/taskingai/client/models/schemas/assistant_create_response.py new file mode 100644 index 0000000..7d3c008 --- /dev/null +++ b/taskingai/client/models/schemas/assistant_create_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# assistant_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.assistant import Assistant + +__all__ = ["AssistantCreateResponse"] + + +class AssistantCreateResponse(BaseModel): + status: str = Field("success") + data: Assistant = Field(...) diff --git a/taskingai/client/models/schemas/assistant_get_response.py b/taskingai/client/models/schemas/assistant_get_response.py new file mode 100644 index 0000000..32e2067 --- /dev/null +++ b/taskingai/client/models/schemas/assistant_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# assistant_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.assistant import Assistant + +__all__ = ["AssistantGetResponse"] + + +class AssistantGetResponse(BaseModel): + status: str = Field("success") + data: Assistant = Field(...) diff --git a/taskingai/client/models/schemas/assistant_list_request.py b/taskingai/client/models/schemas/assistant_list_request.py new file mode 100644 index 0000000..ddf159e --- /dev/null +++ b/taskingai/client/models/schemas/assistant_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# assistant_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["AssistantListRequest"] + + +class AssistantListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/assistant_list_response.py b/taskingai/client/models/schemas/assistant_list_response.py new file mode 100644 index 0000000..71b40fd --- /dev/null +++ b/taskingai/client/models/schemas/assistant_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# assistant_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.assistant import Assistant + +__all__ = ["AssistantListResponse"] + + +class AssistantListResponse(BaseModel): + status: str = Field("success") + data: List[Assistant] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/assistant_update_request.py b/taskingai/client/models/schemas/assistant_update_request.py new file mode 100644 index 0000000..f49f3f8 --- /dev/null +++ b/taskingai/client/models/schemas/assistant_update_request.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- + +# assistant_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict, List +from ..entities.assistant_memory import AssistantMemory +from ..entities.tool_ref import ToolRef +from ..entities.retrieval_ref import RetrievalRef +from ..entities.retrieval_config import RetrievalConfig + +__all__ = ["AssistantUpdateRequest"] + + +class AssistantUpdateRequest(BaseModel): + model_id: Optional[str] = Field(None) + name: Optional[str] = Field(None) + description: Optional[str] = Field(None) + system_prompt_template: Optional[List[str]] = Field(None) + memory: Optional[AssistantMemory] = Field(None) + tools: Optional[List[ToolRef]] = Field(None) + retrievals: Optional[List[RetrievalRef]] = Field(None) + retrieval_configs: Optional[RetrievalConfig] = Field(None) + metadata: Optional[Dict[str, str]] = Field(None) diff --git a/taskingai/client/models/schemas/assistant_update_response.py b/taskingai/client/models/schemas/assistant_update_response.py new file mode 100644 index 0000000..5ce2142 --- /dev/null +++ b/taskingai/client/models/schemas/assistant_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# assistant_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.assistant import Assistant + +__all__ = ["AssistantUpdateResponse"] + + +class AssistantUpdateResponse(BaseModel): + status: str = Field("success") + data: Assistant = Field(...) diff --git a/taskingai/client/models/schemas/base_empty_response.py b/taskingai/client/models/schemas/base_empty_response.py new file mode 100644 index 0000000..0b87e67 --- /dev/null +++ b/taskingai/client/models/schemas/base_empty_response.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- + +# base_empty_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field + + +__all__ = ["BaseEmptyResponse"] + + +class BaseEmptyResponse(BaseModel): + status: str = Field("success") diff --git a/taskingai/client/models/schemas/chat_completion_request.py b/taskingai/client/models/schemas/chat_completion_request.py new file mode 100644 index 0000000..54862de --- /dev/null +++ b/taskingai/client/models/schemas/chat_completion_request.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- + +# chat_completion_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict, List, Union +from ..entities.chat_completion_user_message import ChatCompletionUserMessage +from ..entities.chat_completion_system_message import ChatCompletionSystemMessage +from ..entities.chat_completion_function_message import ChatCompletionFunctionMessage +from ..entities.chat_completion_assistant_message import ChatCompletionAssistantMessage +from ..entities.chat_completion_function import ChatCompletionFunction + +__all__ = ["ChatCompletionRequest"] + + +class ChatCompletionRequest(BaseModel): + model_id: str = Field(..., min_length=8, max_length=8) + configs: Optional[Dict] = Field(None) + stream: bool = Field(False) + messages: List[ + Union[ + ChatCompletionUserMessage, + ChatCompletionAssistantMessage, + ChatCompletionFunctionMessage, + ChatCompletionSystemMessage, + ] + ] = Field(...) + function_call: Optional[str] = Field(None) + functions: Optional[List[ChatCompletionFunction]] = Field(None) diff --git a/taskingai/client/models/schemas/chat_completion_response.py b/taskingai/client/models/schemas/chat_completion_response.py new file mode 100644 index 0000000..60cc99e --- /dev/null +++ b/taskingai/client/models/schemas/chat_completion_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_completion_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chat_completion import ChatCompletion + +__all__ = ["ChatCompletionResponse"] + + +class ChatCompletionResponse(BaseModel): + status: str = Field("success") + data: ChatCompletion = Field(...) diff --git a/taskingai/client/models/schemas/chat_create_request.py b/taskingai/client/models/schemas/chat_create_request.py new file mode 100644 index 0000000..841dc9c --- /dev/null +++ b/taskingai/client/models/schemas/chat_create_request.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["ChatCreateRequest"] + + +class ChatCreateRequest(BaseModel): + metadata: Dict[str, str] = Field({}) diff --git a/taskingai/client/models/schemas/chat_create_response.py b/taskingai/client/models/schemas/chat_create_response.py new file mode 100644 index 0000000..c42b58c --- /dev/null +++ b/taskingai/client/models/schemas/chat_create_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chat import Chat + +__all__ = ["ChatCreateResponse"] + + +class ChatCreateResponse(BaseModel): + status: str = Field("success") + data: Chat = Field(...) diff --git a/taskingai/client/models/schemas/chat_get_response.py b/taskingai/client/models/schemas/chat_get_response.py new file mode 100644 index 0000000..d82ef4f --- /dev/null +++ b/taskingai/client/models/schemas/chat_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chat import Chat + +__all__ = ["ChatGetResponse"] + + +class ChatGetResponse(BaseModel): + status: str = Field("success") + data: Chat = Field(...) diff --git a/taskingai/client/models/schemas/chat_list_request.py b/taskingai/client/models/schemas/chat_list_request.py new file mode 100644 index 0000000..68f2bc0 --- /dev/null +++ b/taskingai/client/models/schemas/chat_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# chat_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["ChatListRequest"] + + +class ChatListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/chat_list_response.py b/taskingai/client/models/schemas/chat_list_response.py new file mode 100644 index 0000000..84c8b34 --- /dev/null +++ b/taskingai/client/models/schemas/chat_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# chat_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.chat import Chat + +__all__ = ["ChatListResponse"] + + +class ChatListResponse(BaseModel): + status: str = Field("success") + data: List[Chat] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/chat_update_request.py b/taskingai/client/models/schemas/chat_update_request.py new file mode 100644 index 0000000..5dec445 --- /dev/null +++ b/taskingai/client/models/schemas/chat_update_request.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict + + +__all__ = ["ChatUpdateRequest"] + + +class ChatUpdateRequest(BaseModel): + metadata: Optional[Dict[str, str]] = Field(None) diff --git a/taskingai/client/models/schemas/chat_update_response.py b/taskingai/client/models/schemas/chat_update_response.py new file mode 100644 index 0000000..781cece --- /dev/null +++ b/taskingai/client/models/schemas/chat_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chat_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chat import Chat + +__all__ = ["ChatUpdateResponse"] + + +class ChatUpdateResponse(BaseModel): + status: str = Field("success") + data: Chat = Field(...) diff --git a/taskingai/client/models/schemas/chunk_create_request.py b/taskingai/client/models/schemas/chunk_create_request.py new file mode 100644 index 0000000..f9047ca --- /dev/null +++ b/taskingai/client/models/schemas/chunk_create_request.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# chunk_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["ChunkCreateRequest"] + + +class ChunkCreateRequest(BaseModel): + content: str = Field(...) + metadata: Dict = Field({}) diff --git a/taskingai/client/models/schemas/chunk_create_response.py b/taskingai/client/models/schemas/chunk_create_response.py new file mode 100644 index 0000000..4cd8b34 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_create_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chunk_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chunk import Chunk + +__all__ = ["ChunkCreateResponse"] + + +class ChunkCreateResponse(BaseModel): + status: str = Field("success") + data: Chunk = Field(...) diff --git a/taskingai/client/models/schemas/chunk_get_response.py b/taskingai/client/models/schemas/chunk_get_response.py new file mode 100644 index 0000000..26f5bb3 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chunk_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chunk import Chunk + +__all__ = ["ChunkGetResponse"] + + +class ChunkGetResponse(BaseModel): + status: str = Field("success") + data: Chunk = Field(...) diff --git a/taskingai/client/models/schemas/chunk_list_request.py b/taskingai/client/models/schemas/chunk_list_request.py new file mode 100644 index 0000000..30782f3 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# chunk_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["ChunkListRequest"] + + +class ChunkListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/chunk_list_response.py b/taskingai/client/models/schemas/chunk_list_response.py new file mode 100644 index 0000000..0bd00f0 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# chunk_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.chunk import Chunk + +__all__ = ["ChunkListResponse"] + + +class ChunkListResponse(BaseModel): + status: str = Field("success") + data: List[Chunk] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/chunk_query_request.py b/taskingai/client/models/schemas/chunk_query_request.py new file mode 100644 index 0000000..36c8417 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_query_request.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chunk_query_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field + + +__all__ = ["ChunkQueryRequest"] + + +class ChunkQueryRequest(BaseModel): + top_k: int = Field(..., ge=1, le=20) + query_text: str = Field(..., min_length=1, max_length=32768) diff --git a/taskingai/client/models/schemas/chunk_query_response.py b/taskingai/client/models/schemas/chunk_query_response.py new file mode 100644 index 0000000..f7a3ca9 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_query_response.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# chunk_query_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.chunk import Chunk + +__all__ = ["ChunkQueryResponse"] + + +class ChunkQueryResponse(BaseModel): + status: str = Field(...) + data: List[Chunk] = Field(...) + fetched_count: int = Field(..., ge=0) diff --git a/taskingai/client/models/schemas/chunk_update_request.py b/taskingai/client/models/schemas/chunk_update_request.py new file mode 100644 index 0000000..8600cd4 --- /dev/null +++ b/taskingai/client/models/schemas/chunk_update_request.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# chunk_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict + + +__all__ = ["ChunkUpdateRequest"] + + +class ChunkUpdateRequest(BaseModel): + content: Optional[str] = Field(None) + metadata: Optional[Dict] = Field(None) diff --git a/taskingai/client/models/schemas/chunk_update_response.py b/taskingai/client/models/schemas/chunk_update_response.py new file mode 100644 index 0000000..934147d --- /dev/null +++ b/taskingai/client/models/schemas/chunk_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# chunk_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.chunk import Chunk + +__all__ = ["ChunkUpdateResponse"] + + +class ChunkUpdateResponse(BaseModel): + status: str = Field("success") + data: Chunk = Field(...) diff --git a/taskingai/client/models/schemas/collection_create_request.py b/taskingai/client/models/schemas/collection_create_request.py new file mode 100644 index 0000000..1eb5129 --- /dev/null +++ b/taskingai/client/models/schemas/collection_create_request.py @@ -0,0 +1,27 @@ +# -*- coding: utf-8 -*- + +# collection_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["CollectionCreateRequest"] + + +class CollectionCreateRequest(BaseModel): + name: str = Field("") + description: str = Field("") + capacity: int = Field(1000) + embedding_model_id: str = Field(...) + metadata: Dict[str, str] = Field({}) diff --git a/taskingai/client/models/schemas/collection_create_response.py b/taskingai/client/models/schemas/collection_create_response.py new file mode 100644 index 0000000..0859a28 --- /dev/null +++ b/taskingai/client/models/schemas/collection_create_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# collection_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.collection import Collection + +__all__ = ["CollectionCreateResponse"] + + +class CollectionCreateResponse(BaseModel): + status: str = Field("success") + data: Collection = Field(...) diff --git a/taskingai/client/models/schemas/collection_get_response.py b/taskingai/client/models/schemas/collection_get_response.py new file mode 100644 index 0000000..85f33ca --- /dev/null +++ b/taskingai/client/models/schemas/collection_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# collection_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.collection import Collection + +__all__ = ["CollectionGetResponse"] + + +class CollectionGetResponse(BaseModel): + status: str = Field("success") + data: Collection = Field(...) diff --git a/taskingai/client/models/schemas/collection_list_request.py b/taskingai/client/models/schemas/collection_list_request.py new file mode 100644 index 0000000..2506894 --- /dev/null +++ b/taskingai/client/models/schemas/collection_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# collection_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["CollectionListRequest"] + + +class CollectionListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/collection_list_response.py b/taskingai/client/models/schemas/collection_list_response.py new file mode 100644 index 0000000..181ac71 --- /dev/null +++ b/taskingai/client/models/schemas/collection_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# collection_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.collection import Collection + +__all__ = ["CollectionListResponse"] + + +class CollectionListResponse(BaseModel): + status: str = Field("success") + data: List[Collection] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/collection_update_request.py b/taskingai/client/models/schemas/collection_update_request.py new file mode 100644 index 0000000..374ae26 --- /dev/null +++ b/taskingai/client/models/schemas/collection_update_request.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# collection_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict + + +__all__ = ["CollectionUpdateRequest"] + + +class CollectionUpdateRequest(BaseModel): + name: Optional[str] = Field(None) + description: Optional[str] = Field(None) + metadata: Optional[Dict[str, str]] = Field(None) diff --git a/taskingai/client/models/schemas/collection_update_response.py b/taskingai/client/models/schemas/collection_update_response.py new file mode 100644 index 0000000..90a7569 --- /dev/null +++ b/taskingai/client/models/schemas/collection_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# collection_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.collection import Collection + +__all__ = ["CollectionUpdateResponse"] + + +class CollectionUpdateResponse(BaseModel): + status: str = Field("success") + data: Collection = Field(...) diff --git a/taskingai/client/models/schemas/message_create_request.py b/taskingai/client/models/schemas/message_create_request.py new file mode 100644 index 0000000..55cb093 --- /dev/null +++ b/taskingai/client/models/schemas/message_create_request.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# message_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict +from ..entities.message_content import MessageContent + +__all__ = ["MessageCreateRequest"] + + +class MessageCreateRequest(BaseModel): + role: str = Field(...) + content: MessageContent = Field(...) + metadata: Dict[str, str] = Field({}) diff --git a/taskingai/client/models/schemas/message_create_response.py b/taskingai/client/models/schemas/message_create_response.py new file mode 100644 index 0000000..705188a --- /dev/null +++ b/taskingai/client/models/schemas/message_create_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# message_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.message import Message + +__all__ = ["MessageCreateResponse"] + + +class MessageCreateResponse(BaseModel): + status: str = Field("success") + data: Message = Field(...) diff --git a/taskingai/client/models/schemas/message_generate_request.py b/taskingai/client/models/schemas/message_generate_request.py new file mode 100644 index 0000000..fa3bfca --- /dev/null +++ b/taskingai/client/models/schemas/message_generate_request.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# message_generate_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict + + +__all__ = ["MessageGenerateRequest"] + + +class MessageGenerateRequest(BaseModel): + system_prompt_variables: Dict[str, str] = Field({}, min_length=0, max_length=16) + stream: bool = Field(False) + debug: bool = Field(False) diff --git a/taskingai/client/models/schemas/message_generate_response.py b/taskingai/client/models/schemas/message_generate_response.py new file mode 100644 index 0000000..247c044 --- /dev/null +++ b/taskingai/client/models/schemas/message_generate_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# message_generate_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.message import Message + +__all__ = ["MessageGenerateResponse"] + + +class MessageGenerateResponse(BaseModel): + status: str = Field("success") + data: Message = Field(...) diff --git a/taskingai/client/models/schemas/message_get_response.py b/taskingai/client/models/schemas/message_get_response.py new file mode 100644 index 0000000..44a5497 --- /dev/null +++ b/taskingai/client/models/schemas/message_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# message_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.message import Message + +__all__ = ["MessageGetResponse"] + + +class MessageGetResponse(BaseModel): + status: str = Field("success") + data: Message = Field(...) diff --git a/taskingai/client/models/schemas/message_list_request.py b/taskingai/client/models/schemas/message_list_request.py new file mode 100644 index 0000000..8ab0de4 --- /dev/null +++ b/taskingai/client/models/schemas/message_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# message_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["MessageListRequest"] + + +class MessageListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/message_list_response.py b/taskingai/client/models/schemas/message_list_response.py new file mode 100644 index 0000000..8797e78 --- /dev/null +++ b/taskingai/client/models/schemas/message_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# message_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.message import Message + +__all__ = ["MessageListResponse"] + + +class MessageListResponse(BaseModel): + status: str = Field("success") + data: List[Message] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/message_update_request.py b/taskingai/client/models/schemas/message_update_request.py new file mode 100644 index 0000000..6f83588 --- /dev/null +++ b/taskingai/client/models/schemas/message_update_request.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# message_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict + + +__all__ = ["MessageUpdateRequest"] + + +class MessageUpdateRequest(BaseModel): + metadata: Optional[Dict[str, str]] = Field(None) diff --git a/taskingai/client/models/schemas/message_update_response.py b/taskingai/client/models/schemas/message_update_response.py new file mode 100644 index 0000000..63cbfb3 --- /dev/null +++ b/taskingai/client/models/schemas/message_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# message_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.message import Message + +__all__ = ["MessageUpdateResponse"] + + +class MessageUpdateResponse(BaseModel): + status: str = Field("success") + data: Message = Field(...) diff --git a/taskingai/client/models/schemas/record_create_request.py b/taskingai/client/models/schemas/record_create_request.py new file mode 100644 index 0000000..af0f3ff --- /dev/null +++ b/taskingai/client/models/schemas/record_create_request.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# record_create_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Dict +from ..entities.record_type import RecordType +from ..entities.text_splitter import TextSplitter + +__all__ = ["RecordCreateRequest"] + + +class RecordCreateRequest(BaseModel): + type: RecordType = Field("text") + title: str = Field("", min_length=0, max_length=256) + content: str = Field(..., min_length=1, max_length=32768) + text_splitter: TextSplitter = Field(...) + metadata: Dict[str, str] = Field({}, min_length=0, max_length=16) diff --git a/taskingai/client/models/schemas/record_create_response.py b/taskingai/client/models/schemas/record_create_response.py new file mode 100644 index 0000000..af80e2c --- /dev/null +++ b/taskingai/client/models/schemas/record_create_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# record_create_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.record import Record + +__all__ = ["RecordCreateResponse"] + + +class RecordCreateResponse(BaseModel): + status: str = Field("success") + data: Record = Field(...) diff --git a/taskingai/client/models/schemas/record_get_response.py b/taskingai/client/models/schemas/record_get_response.py new file mode 100644 index 0000000..2606644 --- /dev/null +++ b/taskingai/client/models/schemas/record_get_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# record_get_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.record import Record + +__all__ = ["RecordGetResponse"] + + +class RecordGetResponse(BaseModel): + status: str = Field("success") + data: Record = Field(...) diff --git a/taskingai/client/models/schemas/record_list_request.py b/taskingai/client/models/schemas/record_list_request.py new file mode 100644 index 0000000..9c9ff7b --- /dev/null +++ b/taskingai/client/models/schemas/record_list_request.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# record_list_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional +from ..entities.sort_order_enum import SortOrderEnum + +__all__ = ["RecordListRequest"] + + +class RecordListRequest(BaseModel): + limit: int = Field(20) + order: Optional[SortOrderEnum] = Field(None) + after: Optional[str] = Field(None) + before: Optional[str] = Field(None) diff --git a/taskingai/client/models/schemas/record_list_response.py b/taskingai/client/models/schemas/record_list_response.py new file mode 100644 index 0000000..5647be2 --- /dev/null +++ b/taskingai/client/models/schemas/record_list_response.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +# record_list_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.record import Record + +__all__ = ["RecordListResponse"] + + +class RecordListResponse(BaseModel): + status: str = Field("success") + data: List[Record] = Field(...) + fetched_count: int = Field(...) + has_more: bool = Field(...) diff --git a/taskingai/client/models/schemas/record_update_request.py b/taskingai/client/models/schemas/record_update_request.py new file mode 100644 index 0000000..09f19a7 --- /dev/null +++ b/taskingai/client/models/schemas/record_update_request.py @@ -0,0 +1,28 @@ +# -*- coding: utf-8 -*- + +# record_update_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, Dict +from ..entities.record_type import RecordType +from ..entities.text_splitter import TextSplitter + +__all__ = ["RecordUpdateRequest"] + + +class RecordUpdateRequest(BaseModel): + type: Optional[RecordType] = Field(None) + title: Optional[str] = Field(None, min_length=0, max_length=256) + content: Optional[str] = Field(None, min_length=1, max_length=32768) + text_splitter: Optional[TextSplitter] = Field(None) + metadata: Optional[Dict[str, str]] = Field(None, min_length=0, max_length=16) diff --git a/taskingai/client/models/schemas/record_update_response.py b/taskingai/client/models/schemas/record_update_response.py new file mode 100644 index 0000000..fd82ee4 --- /dev/null +++ b/taskingai/client/models/schemas/record_update_response.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- + +# record_update_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from ..entities.record import Record + +__all__ = ["RecordUpdateResponse"] + + +class RecordUpdateResponse(BaseModel): + status: str = Field("success") + data: Record = Field(...) diff --git a/taskingai/client/models/schemas/text_embedding_request.py b/taskingai/client/models/schemas/text_embedding_request.py new file mode 100644 index 0000000..8242bc2 --- /dev/null +++ b/taskingai/client/models/schemas/text_embedding_request.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- + +# text_embedding_request.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import Optional, List, Union +from ..entities.text_embedding_input_type import TextEmbeddingInputType + +__all__ = ["TextEmbeddingRequest"] + + +class TextEmbeddingRequest(BaseModel): + model_id: str = Field(..., min_length=8, max_length=8) + input: Union[str, List[str]] = Field(...) + input_type: Optional[TextEmbeddingInputType] = Field(None) diff --git a/taskingai/client/models/schemas/text_embedding_response.py b/taskingai/client/models/schemas/text_embedding_response.py new file mode 100644 index 0000000..e1c221b --- /dev/null +++ b/taskingai/client/models/schemas/text_embedding_response.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- + +# text_embedding_response.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 03-Mar-2024 +License: Apache 2.0 +""" + +from pydantic import BaseModel, Field +from typing import List +from ..entities.text_embedding_output import TextEmbeddingOutput + +__all__ = ["TextEmbeddingResponse"] + + +class TextEmbeddingResponse(BaseModel): + status: str = Field("success") + data: List[TextEmbeddingOutput] = Field(...) diff --git a/taskingai/client/stream.py b/taskingai/client/stream.py index 3e8f035..c81643b 100644 --- a/taskingai/client/stream.py +++ b/taskingai/client/stream.py @@ -3,14 +3,7 @@ import json from typing import Any, Dict, Iterator, AsyncIterator, Optional -from .models import ( - MessageChunk, - Message, - ChatCompletion, - ChatCompletionChunk -) - -from .models.entity._base import TaskingaiBaseModel +from .models import MessageChunk, Message, ChatCompletion, ChatCompletionChunk from .exceptions import ApiException @@ -28,6 +21,7 @@ def _cast(item: Dict): # cannot cast, keep the original dict return item + class Stream(object): """Provides the core interface to iterate over a synchronous stream response.""" @@ -67,6 +61,7 @@ def __stream__(self) -> Iterator[Dict]: for sse in iterator: ... + class AsyncStream(object): """Provides the core interface to iterate over an asynchronous stream response.""" @@ -105,6 +100,7 @@ async def __stream__(self) -> AsyncIterator[Dict]: async for sse in self._iter_events(): ... + class ServerSentEvent: def __init__( self, @@ -144,6 +140,7 @@ def json(self) -> Any: def __repr__(self) -> str: return f"ServerSentEvent(event={self.event}, data={self.data}, id={self.id}, retry={self.retry})" + class SSEDecoder: _data: list[str] _event: Optional[str] diff --git a/taskingai/client/stream_apis/__init__.py b/taskingai/client/stream_apis/__init__.py new file mode 100644 index 0000000..8231e77 --- /dev/null +++ b/taskingai/client/stream_apis/__init__.py @@ -0,0 +1,16 @@ +# -*- coding: utf-8 -*- + +# __init__.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 02-Mar-2024 +License: Apache 2.0 +""" + +from .stream_api_chat_completion import * +from .stream_api_message_generation import * diff --git a/taskingai/client/stream_apis/stream_api_chat_completion.py b/taskingai/client/stream_apis/stream_api_chat_completion.py new file mode 100644 index 0000000..d685a41 --- /dev/null +++ b/taskingai/client/stream_apis/stream_api_chat_completion.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- + +# stream_api_chat_completion.py + +""" +Stream API for chat completion + +Author: James Yao +Organization: TaskingAI +Created: 02-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from taskingai.client.stream import Stream, AsyncStream +from ..models import ChatCompletionRequest + +__all__ = ["stream_api_chat_completion", "async_stream_api_chat_completion"] + + +def stream_api_chat_completion(payload: ChatCompletionRequest, **kwargs) -> Stream: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/inference/chat_completion", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=None, + auth_settings=[], + _return_http_data_only=None, + _preload_content=None, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + stream=True, + ) + + +async def async_stream_api_chat_completion(payload: ChatCompletionRequest, **kwargs) -> AsyncStream: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = {} + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/inference/chat_completion", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=None, + auth_settings=[], + _return_http_data_only=None, + _preload_content=None, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + stream=True, + ) diff --git a/taskingai/client/stream_apis/stream_api_message_generation.py b/taskingai/client/stream_apis/stream_api_message_generation.py new file mode 100644 index 0000000..eec5820 --- /dev/null +++ b/taskingai/client/stream_apis/stream_api_message_generation.py @@ -0,0 +1,89 @@ +# -*- coding: utf-8 -*- + +# api_generate_message.py + +""" +This script is automatically generated for TaskingAI python client +Do not modify the file manually + +Author: James Yao +Organization: TaskingAI +Created: 02-Mar-2024 +License: Apache 2.0 +""" + +from ..utils import get_api_client +from taskingai.client.stream import Stream, AsyncStream +from ..models import MessageGenerateRequest + +__all__ = ["stream_api_generate_message", "async_stream_api_generate_message"] + + +def stream_api_generate_message(assistant_id: str, chat_id: str, payload: MessageGenerateRequest, **kwargs) -> Stream: + # get api client + sync_api_client = get_api_client(async_client=False) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": sync_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return sync_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/generate", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=None, + auth_settings=[], + _return_http_data_only=None, + _preload_content=None, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + stream=True, + ) + + +async def async_stream_api_generate_message( + assistant_id: str, chat_id: str, payload: MessageGenerateRequest, **kwargs +) -> AsyncStream: + # get api client + async_api_client = get_api_client(async_client=True) + + # request parameters + path_params_dict = { + "assistant_id": assistant_id, + "chat_id": chat_id, + } + query_params_dict = {} + header_params_dict = {"Accept": async_api_client.select_header_accept(["application/json"])} + body_params_dict = payload.model_dump() + files_dict = {} + + # execute the request + return await async_api_client.call_api( + resource_path="/v1/assistants/{assistant_id}/chats/{chat_id}/generate", + method="POST", + path_params=path_params_dict, + query_params=query_params_dict, + header_params=header_params_dict, + body=body_params_dict, + post_params=[], + files=files_dict, + response_type=None, + auth_settings=[], + _return_http_data_only=None, + _preload_content=None, + _request_timeout=kwargs.get("timeout"), + collection_formats={}, + stream=True, + ) diff --git a/taskingai/client/utils.py b/taskingai/client/utils.py index d885c06..d8058f4 100644 --- a/taskingai/client/utils.py +++ b/taskingai/client/utils.py @@ -1,84 +1,66 @@ import inspect import logging -from pathlib import Path import httpx -from taskingai.client.api import * from taskingai.client.api_client import SyncApiClient, AsyncApiClient -from .constants import ModuleType +from enum import Enum + def check_kwargs(caller, given): argspec = inspect.getfullargspec(caller) diff = set(given).difference(argspec.args) if diff: - logging.exception(caller.__name__ + ' had unexpected keyword argument(s): ' + ', '.join(diff), exc_info=False) + logging.exception(caller.__name__ + " had unexpected keyword argument(s): " + ", ".join(diff), exc_info=False) def get_version(): from taskingai import __version__ + return __version__ def get_user_agent(): - client_id = f'python-client-{get_version()}' - user_agent_details = {'httpx': httpx.__version__} - user_agent = '{} ({})'.format(client_id, ', '.join([f'{k}:{v}' for k, v in user_agent_details.items()])) + client_id = f"python-client-{get_version()}" + user_agent_details = {"httpx": httpx.__version__} + user_agent = "{} ({})".format(client_id, ", ".join([f"{k}:{v}" for k, v in user_agent_details.items()])) return user_agent -sync_api_instance_dict = { - ModuleType.ASSISTANT: None, - ModuleType.TOOL: None, - ModuleType.RETRIEVAL: None, - ModuleType.INFERENCE: None -} - -async_api_instance_dict = { - ModuleType.ASSISTANT: None, - ModuleType.TOOL: None, - ModuleType.RETRIEVAL: None, - ModuleType.INFERENCE: None -} - -def get_api_instance(module: ModuleType, async_client=False): - from taskingai.config import Config - client_config = Config.OPENAPI_CONFIG - client_config.api_key = client_config.api_key or {} - api_instance = None +def convert_query_params_dict(query_params_dict): + """ + This helper function will convert the query_params_dict to a format where enum values are converted to their + corresponding string values. + """ + converted_dict = {} + for key, value in query_params_dict.items(): + if isinstance(value, Enum): + converted_dict[key] = value.value + elif isinstance(value, bool): + converted_dict[key] = str(value).lower() + elif value is not None: + converted_dict[key] = value + return converted_dict - if async_client: - api_client = AsyncApiClient(configuration=client_config) - api_client.user_agent = get_user_agent() - if async_api_instance_dict.get(module) is None: - if module == ModuleType.ASSISTANT: - async_api_instance_dict[module] = AsyncAssistantApi(api_client) - elif module == ModuleType.TOOL: - async_api_instance_dict[module] = AsyncToolApi(api_client) - elif module == ModuleType.RETRIEVAL: - async_api_instance_dict[module] = AsyncRetrievalApi(api_client) - elif module == ModuleType.INFERENCE: - async_api_instance_dict[module] = AsyncInferenceApi(api_client) +__sync_api_client = None +__async_api_client = None - api_instance = async_api_instance_dict[module] - else: - api_client = SyncApiClient(configuration=client_config) - api_client.user_agent = get_user_agent() +def get_api_client(async_client: bool): + global __sync_api_client, __async_api_client - if sync_api_instance_dict.get(module) is None: - - if module == ModuleType.ASSISTANT: - sync_api_instance_dict[module] = AssistantApi(api_client) - elif module == ModuleType.TOOL: - sync_api_instance_dict[module] = ToolApi(api_client) - elif module == ModuleType.RETRIEVAL: - sync_api_instance_dict[module] = RetrievalApi(api_client) - elif module == ModuleType.INFERENCE: - sync_api_instance_dict[module] = InferenceApi(api_client) + from taskingai.config import Config - api_instance = sync_api_instance_dict[module] + client_config = Config.OPENAPI_CONFIG + client_config.api_key = client_config.api_key or {} - if api_instance is None: - raise NotImplementedError(f"Cannot find api instance for module {module} with async={async_client}") + if async_client: + if not __async_api_client: + __async_api_client = AsyncApiClient(configuration=client_config) + __async_api_client.user_agent = get_user_agent() + return __async_api_client - return api_instance + else: + if not __sync_api_client: + __sync_api_client = SyncApiClient(configuration=client_config) + __sync_api_client.user_agent = get_user_agent() + return __sync_api_client diff --git a/taskingai/inference/chat_completion.py b/taskingai/inference/chat_completion.py index d1f21f3..3c83d52 100644 --- a/taskingai/inference/chat_completion.py +++ b/taskingai/inference/chat_completion.py @@ -1,26 +1,17 @@ -from typing import Optional, List, Dict, Union, Any +from typing import Optional, List, Dict, Union from ..client.stream import Stream, AsyncStream -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import ( - ChatCompletionRequest, - ChatCompletionResponse, - ChatCompletion, - ChatCompletionChunk, - ChatCompletionFunctionMessage, - ChatCompletionAssistantMessage, - ChatCompletionUserMessage, - ChatCompletionSystemMessage, - ChatCompletionFunctionCall as FunctionCall, - ChatCompletionFunction as Function, - ChatCompletionRole, -) +from taskingai.client.models import * +from taskingai.client.apis import * +from taskingai.client.stream_apis import * __all__ = [ "ChatCompletion", "ChatCompletionChunk", - "FunctionCall", + "ChatCompletionFunctionCall", + "ChatCompletionFunction", "Function", + "FunctionCall", "FunctionMessage", "AssistantMessage", "UserMessage", @@ -29,53 +20,37 @@ "a_chat_completion", ] +Function = ChatCompletionFunction +FunctionCall = ChatCompletionFunctionCall + class SystemMessage(ChatCompletionSystemMessage): def __init__(self, content: str): - super().__init__( - role=ChatCompletionRole.SYSTEM, - content=content - ) + super().__init__(role=ChatCompletionRole.SYSTEM, content=content) class UserMessage(ChatCompletionUserMessage): def __init__(self, content: str): - super().__init__( - role=ChatCompletionRole.USER, - content=content - ) + super().__init__(role=ChatCompletionRole.USER, content=content) class AssistantMessage(ChatCompletionAssistantMessage): def __init__(self, content: str = None, function_calls: Optional[List[FunctionCall]] = None): - super().__init__( - role=ChatCompletionRole.ASSISTANT, - content=content, - function_calls=function_calls - ) + super().__init__(role=ChatCompletionRole.ASSISTANT, content=content, function_calls=function_calls) class FunctionMessage(ChatCompletionFunctionMessage): def __init__(self, id: str, content: str): - super().__init__( - role=ChatCompletionRole.FUNCTION, - id=id, - content=content - ) + super().__init__(role=ChatCompletionRole.FUNCTION, id=id, content=content) def chat_completion( - model_id: str, - messages: List[Union[ - SystemMessage, - UserMessage, - AssistantMessage, - FunctionMessage - ]], - configs: Optional[Dict] = None, - function_call: Optional[str] = None, - functions: Optional[List[Function]] = None, - stream: bool = False + model_id: str, + messages: List[Union[SystemMessage, UserMessage, AssistantMessage, FunctionMessage]], + configs: Optional[Dict] = None, + function_call: Optional[str] = None, + functions: Optional[List[Function]] = None, + stream: bool = False, ) -> Union[ChatCompletion, Stream]: """ Chat completion model inference. @@ -85,9 +60,9 @@ def chat_completion( :param configs: The configurations. :param function_call: The function call. :param functions: The list of functions. + :param stream: Whether to request in stream mode. :return: The list of assistants. """ - api_instance = get_api_instance(ModuleType.INFERENCE) # only add non-None parameters body = ChatCompletionRequest( model_id=model_id, @@ -95,29 +70,23 @@ def chat_completion( configs=configs, function_call=function_call, functions=functions, - stream=stream + stream=stream, ) if not stream: - response: ChatCompletionResponse = api_instance.chat_completion(body=body) - chat_completion_result: ChatCompletion = ChatCompletion(**response["data"]) - return chat_completion_result + response: ChatCompletionResponse = api_chat_completion(payload=body) + return response.data else: - response: Stream = api_instance.chat_completion(body=body, stream=True) + response: Stream = stream_api_chat_completion(payload=body, stream=True) return response async def a_chat_completion( - model_id: str, - messages: List[Union[ - SystemMessage, - UserMessage, - AssistantMessage, - FunctionMessage - ]], - configs: Optional[Dict] = None, - function_call: Optional[str] = None, - functions: Optional[List[Function]] = None, - stream: bool = False + model_id: str, + messages: List[Union[SystemMessage, UserMessage, AssistantMessage, FunctionMessage]], + configs: Optional[Dict] = None, + function_call: Optional[str] = None, + functions: Optional[List[Function]] = None, + stream: bool = False, ) -> Union[ChatCompletion, AsyncStream]: """ Chat completion model inference in async mode. @@ -127,9 +96,9 @@ async def a_chat_completion( :param configs: The configurations. :param function_call: The function call. :param functions: The list of functions. + :param stream: Whether to request in stream mode. :return: The list of assistants. """ - api_instance = get_api_instance(ModuleType.INFERENCE, async_client=True) # only add non-None parameters body = ChatCompletionRequest( model_id=model_id, @@ -137,17 +106,11 @@ async def a_chat_completion( configs=configs, function_call=function_call, functions=functions, - stream=stream + stream=stream, ) if not stream: - response: ChatCompletionResponse = await api_instance.chat_completion(body=body) - chat_completion_result: ChatCompletion = ChatCompletion(**response["data"]) - return chat_completion_result + response: ChatCompletionResponse = await async_api_chat_completion(payload=body) + return response.data else: - response: AsyncStream = await api_instance.chat_completion(body=body, stream=True) + response: AsyncStream = await async_stream_api_chat_completion(payload=body, stream=True) return response - - - - -# todo: chat_completion_stream diff --git a/taskingai/inference/text_embedding.py b/taskingai/inference/text_embedding.py index 8e62cac..175213e 100644 --- a/taskingai/inference/text_embedding.py +++ b/taskingai/inference/text_embedding.py @@ -1,11 +1,7 @@ -from typing import Optional, List, Dict, Union +from typing import List, Union -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import ( - TextEmbeddingOutput, - TextEmbeddingRequest, - TextEmbeddingResponse -) +from taskingai.client.models import * +from taskingai.client.apis import * __all__ = [ "TextEmbeddingOutput", @@ -15,9 +11,9 @@ def text_embedding( - model_id: str, - input: Union[str, List[str]], -) -> Union[List[float] ,List[List[float]]]: + model_id: str, + input: Union[str, List[str]], +) -> Union[List[float], List[List[float]]]: """ Chat completion model inference. @@ -25,17 +21,11 @@ def text_embedding( :param input: The input text or list of input texts. :return: The list of assistants. """ - api_instance = get_api_instance(ModuleType.INFERENCE) + # only add non-None parameters - body = TextEmbeddingRequest( - model_id=model_id, - input=input - ) - response: TextEmbeddingResponse = api_instance.text_embedding(body=body) - results = [] - for data in response.data: - text_embedding_result: TextEmbeddingOutput = TextEmbeddingOutput(**data) - results.append(text_embedding_result.embedding) + body = TextEmbeddingRequest(model_id=model_id, input=input) + response: TextEmbeddingResponse = api_text_embedding(payload=body) + results = [data.embedding for data in response.data] if isinstance(input, str): return results[0] @@ -44,9 +34,9 @@ def text_embedding( async def a_text_embedding( - model_id: str, - input: Union[str, List[str]], -) -> Union[List[float] ,List[List[float]]]: + model_id: str, + input: Union[str, List[str]], +) -> Union[List[float], List[List[float]]]: """ Chat completion model inference in async mode. @@ -54,17 +44,11 @@ async def a_text_embedding( :param input: The input text or list of input texts. :return: The list of assistants. """ - api_instance = get_api_instance(ModuleType.INFERENCE, async_client=True) + # only add non-None parameters - body = TextEmbeddingRequest( - model_id=model_id, - input=input - ) - response: TextEmbeddingResponse = await api_instance.text_embedding(body=body) - results = [] - for data in response.data: - text_embedding_result: TextEmbeddingOutput = TextEmbeddingOutput(**data) - results.append(text_embedding_result.embedding) + body = TextEmbeddingRequest(model_id=model_id, input=input) + response: TextEmbeddingResponse = await async_api_text_embedding(payload=body) + results = [data.embedding for data in response.data] if isinstance(input, str): return results[0] diff --git a/taskingai/retrieval/chunk.py b/taskingai/retrieval/chunk.py index 30a60b2..3305a81 100644 --- a/taskingai/retrieval/chunk.py +++ b/taskingai/retrieval/chunk.py @@ -1,8 +1,7 @@ -from typing import Optional, List, Dict +from typing import List -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import Chunk -from taskingai.client.models import ChunkQueryResponse, ChunkQueryRequest +from taskingai.client.models import * +from taskingai.client.apis import * __all__ = [ "Chunk", @@ -12,9 +11,9 @@ def query_chunks( - collection_id: str, - query_text: str, - top_k: int = 3, + collection_id: str, + query_text: str, + top_k: int = 3, ) -> List[Chunk]: """ List records. @@ -23,24 +22,22 @@ def query_chunks( :param top_k: The number of most relevant chunks to return. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) # only add non-None parameters body = ChunkQueryRequest( top_k=top_k, query_text=query_text, ) - response: ChunkQueryResponse = api_instance.query_chunks( + response: ChunkQueryResponse = api_query_collection_chunks( collection_id=collection_id, - body=body, + payload=body, ) - chunks: List[Chunk] = [Chunk(**item) for item in response.data] - return chunks + return response.data async def a_query_chunks( - collection_id: str, - query_text: str, - top_k: int = 3, + collection_id: str, + query_text: str, + top_k: int = 3, ) -> List[Chunk]: """ List records in async mode. @@ -49,15 +46,13 @@ async def a_query_chunks( :param top_k: The number of most relevant chunks to return. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) # only add non-None parameters body = ChunkQueryRequest( top_k=top_k, query_text=query_text, ) - response: ChunkQueryResponse = await api_instance.query_chunks( + response: ChunkQueryResponse = await async_api_query_collection_chunks( collection_id=collection_id, - body=body, + payload=body, ) - chunks: List[Chunk] = [Chunk(**item) for item in response.data] - return chunks \ No newline at end of file + return response.data diff --git a/taskingai/retrieval/collection.py b/taskingai/retrieval/collection.py index 230cc65..e59f31e 100644 --- a/taskingai/retrieval/collection.py +++ b/taskingai/retrieval/collection.py @@ -1,15 +1,7 @@ from typing import Optional, List, Dict -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import Collection -from taskingai.client.models import ( - CollectionCreateRequest, - CollectionCreateResponse, - CollectionUpdateRequest, - CollectionUpdateResponse, - CollectionGetResponse, - CollectionListResponse, -) +from taskingai.client.models import * +from taskingai.client.apis import * __all__ = [ "Collection", @@ -45,18 +37,15 @@ def list_collections( if after and before: raise ValueError("Only one of after and before can be specified.") - api_instance = get_api_instance(ModuleType.RETRIEVAL) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: CollectionListResponse = api_instance.list_collections(**params) - collections: List[Collection] = [Collection(**item) for item in response.data] - return collections + payload = CollectionListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: CollectionListResponse = api_list_collections(payload=payload) + return response.data async def a_list_collections( @@ -78,18 +67,15 @@ async def a_list_collections( if after and before: raise ValueError("Only one of after and before can be specified.") - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: CollectionListResponse = await api_instance.list_collections(**params) - collections: List[Collection] = [Collection(**item) for item in response.data] - return collections + payload = CollectionListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: CollectionListResponse = await async_api_list_collections(payload=payload) + return response.data def get_collection(collection_id: str) -> Collection: @@ -99,10 +85,8 @@ def get_collection(collection_id: str) -> Collection: :param collection_id: The ID of the collection. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) - response: CollectionGetResponse = api_instance.get_collection(collection_id=collection_id) - collection: Collection = Collection(**response.data) - return collection + response: CollectionGetResponse = api_get_collection(collection_id=collection_id) + return response.data async def a_get_collection(collection_id: str) -> Collection: @@ -112,10 +96,8 @@ async def a_get_collection(collection_id: str) -> Collection: :param collection_id: The ID of the collection. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) - response: CollectionGetResponse = await api_instance.get_collection(collection_id=collection_id) - collection: Collection = Collection(**response.data) - return collection + response: CollectionGetResponse = await async_api_get_collection(collection_id=collection_id) + return response.data def create_collection( @@ -136,18 +118,15 @@ def create_collection( :return: The created collection object. """ - # todo verify parameters - api_instance = get_api_instance(ModuleType.RETRIEVAL) body = CollectionCreateRequest( embedding_model_id=embedding_model_id, capacity=capacity, - name=name, - description=description, - metadata=metadata, + name=name or "", + description=description or "", + metadata=metadata or {}, ) - response: CollectionCreateResponse = api_instance.create_collection(body=body) - collection: Collection = Collection(**response.data) - return collection + response: CollectionCreateResponse = api_create_collection(payload=body) + return response.data async def a_create_collection( @@ -169,17 +148,15 @@ async def a_create_collection( """ # todo verify parameters - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) body = CollectionCreateRequest( embedding_model_id=embedding_model_id, capacity=capacity, - name=name, - description=description, - metadata=metadata, + name=name or "", + description=description or "", + metadata=metadata or {}, ) - response: CollectionCreateResponse = await api_instance.create_collection(body=body) - collection: Collection = Collection(**response.data) - return collection + response: CollectionCreateResponse = await async_api_create_collection(payload=body) + return response.data def update_collection( @@ -197,15 +174,13 @@ def update_collection( :return: The updated collection object. """ # todo: verify at least one parameter is not None - api_instance = get_api_instance(ModuleType.RETRIEVAL) body = CollectionUpdateRequest( name=name, description=description, metadata=metadata, ) - response: CollectionUpdateResponse = api_instance.update_collection(collection_id=collection_id, body=body) - collection: Collection = Collection(**response.data) - return collection + response: CollectionUpdateResponse = api_update_collection(collection_id=collection_id, payload=body) + return response.data async def a_update_collection( @@ -222,15 +197,13 @@ async def a_update_collection( :param authentication: The collection API authentication. :return: The updated collection object. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) body = CollectionUpdateRequest( name=name, description=description, metadata=metadata, ) - response: CollectionUpdateResponse = await api_instance.update_collection(collection_id=collection_id, body=body) - collection: Collection = Collection(**response.data) - return collection + response: CollectionUpdateResponse = await async_api_update_collection(collection_id=collection_id, payload=body) + return response.data def delete_collection(collection_id: str) -> None: @@ -240,8 +213,7 @@ def delete_collection(collection_id: str) -> None: :param collection_id: The ID of the collection. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) - api_instance.delete_collection(collection_id=collection_id) + api_delete_collection(collection_id=collection_id) async def a_delete_collection(collection_id: str) -> None: @@ -251,5 +223,4 @@ async def a_delete_collection(collection_id: str) -> None: :param collection_id: The ID of the collection. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) - await api_instance.delete_collection(collection_id=collection_id) + await async_api_delete_collection(collection_id=collection_id) diff --git a/taskingai/retrieval/record.py b/taskingai/retrieval/record.py index 2982ae7..c3ee7ad 100644 --- a/taskingai/retrieval/record.py +++ b/taskingai/retrieval/record.py @@ -1,15 +1,7 @@ from typing import Optional, List, Dict -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import Record, TextSplitter -from taskingai.client.models import ( - RecordCreateRequest, - RecordCreateResponse, - RecordUpdateRequest, - RecordUpdateResponse, - RecordGetResponse, - RecordListResponse, -) +from taskingai.client.models import * +from taskingai.client.apis import * __all__ = [ "Record", @@ -46,18 +38,15 @@ def list_records( if after and before: raise ValueError("Only one of after and before can be specified.") - api_instance = get_api_instance(ModuleType.RETRIEVAL) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: RecordListResponse = api_instance.list_records(collection_id=collection_id, **params) - records: List[Record] = [Record(**item) for item in response.data] - return records + payload = RecordListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: RecordListResponse = api_list_records(collection_id=collection_id, payload=payload) + return response.data async def a_list_records( @@ -80,18 +69,15 @@ async def a_list_records( if after and before: raise ValueError("Only one of after and before can be specified.") - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: RecordListResponse = await api_instance.list_records(collection_id=collection_id, **params) - records: List[Record] = [Record(**item) for item in response.data] - return records + payload = RecordListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: RecordListResponse = await async_api_list_records(collection_id=collection_id, payload=payload) + return response.data def get_record(collection_id: str, record_id: str) -> Record: @@ -102,13 +88,11 @@ def get_record(collection_id: str, record_id: str) -> Record: :param record_id: The ID of the record. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) - response: RecordGetResponse = api_instance.get_record( + response: RecordGetResponse = api_get_record( collection_id=collection_id, record_id=record_id, ) - record: Record = Record(**response.data) - return record + return response.data async def a_get_record(collection_id: str, record_id: str) -> Record: @@ -119,13 +103,11 @@ async def a_get_record(collection_id: str, record_id: str) -> Record: :param record_id: The ID of the record. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) - response: RecordGetResponse = await api_instance.get_record( + response: RecordGetResponse = await async_api_get_record( collection_id=collection_id, record_id=record_id, ) - record: Record = Record(**response.data) - return record + return response.data def create_record( @@ -144,16 +126,14 @@ def create_record( :return: The created record object. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) body = RecordCreateRequest( type="text", content=content, text_splitter=text_splitter, - metadata=metadata, + metadata=metadata or {}, ) - response: RecordCreateResponse = api_instance.create_record(collection_id=collection_id, body=body) - record: Record = Record(**response.data) - return record + response: RecordCreateResponse = api_create_record(collection_id=collection_id, payload=body) + return response.data async def a_create_record( @@ -172,16 +152,14 @@ async def a_create_record( :return: The created record object. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) body = RecordCreateRequest( type="text", content=content, text_splitter=text_splitter, - metadata=metadata, + metadata=metadata or {}, ) - response: RecordCreateResponse = await api_instance.create_record(collection_id=collection_id, body=body) - record: Record = Record(**response.data) - return record + response: RecordCreateResponse = await async_api_create_record(collection_id=collection_id, payload=body) + return response.data def update_record( @@ -203,7 +181,6 @@ def update_record( :return: The collection object. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) type = None if content and text_splitter: type = "text" @@ -213,11 +190,8 @@ def update_record( text_splitter=text_splitter, metadata=metadata, ) - response: RecordUpdateResponse = api_instance.update_record( - collection_id=collection_id, record_id=record_id, body=body - ) - record: Record = Record(**response.data) - return record + response: RecordUpdateResponse = api_update_record(collection_id=collection_id, record_id=record_id, payload=body) + return response.data async def a_update_record( @@ -239,7 +213,6 @@ async def a_update_record( :return: The collection object. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) type = None if content and text_splitter: type = "text" @@ -249,11 +222,10 @@ async def a_update_record( text_splitter=text_splitter, metadata=metadata, ) - response: RecordUpdateResponse = await api_instance.update_record( - collection_id=collection_id, record_id=record_id, body=body + response: RecordUpdateResponse = await async_api_update_record( + collection_id=collection_id, record_id=record_id, payload=body ) - record: Record = Record(**response.data) - return record + return response.data def delete_record( @@ -267,8 +239,7 @@ def delete_record( :param record_id: The ID of the record. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL) - api_instance.delete_record(collection_id=collection_id, record_id=record_id) + api_delete_record(collection_id=collection_id, record_id=record_id) async def a_delete_record( @@ -282,5 +253,4 @@ async def a_delete_record( :param record_id: The ID of the record. """ - api_instance = get_api_instance(ModuleType.RETRIEVAL, async_client=True) - await api_instance.delete_record(collection_id=collection_id, record_id=record_id) + await async_api_delete_record(collection_id=collection_id, record_id=record_id) diff --git a/taskingai/retrieval/text_splitter.py b/taskingai/retrieval/text_splitter.py index 588c60e..7b9812f 100644 --- a/taskingai/retrieval/text_splitter.py +++ b/taskingai/retrieval/text_splitter.py @@ -1,7 +1,16 @@ -from taskingai.client.models import TextSplitter, TextSplitterType, TokenTextSplitter +from taskingai.client.models import TextSplitter, TextSplitterType __all__ = [ "TextSplitter", "TextSplitterType", "TokenTextSplitter", ] + + +class TokenTextSplitter(TextSplitter): + def __init__(self, chunk_size: int, chunk_overlap: int): + super().__init__( + type=TextSplitterType.TOKEN, + chunk_size=chunk_size, + chunk_overlap=chunk_overlap, + ) diff --git a/taskingai/tool/__init__.py b/taskingai/tool/__init__.py index 62004bb..9625676 100644 --- a/taskingai/tool/__init__.py +++ b/taskingai/tool/__init__.py @@ -1,2 +1 @@ from .action import * -from .function import * diff --git a/taskingai/tool/action.py b/taskingai/tool/action.py index c6b5994..861a281 100644 --- a/taskingai/tool/action.py +++ b/taskingai/tool/action.py @@ -1,17 +1,8 @@ from typing import Optional, List, Dict -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import Action, ActionAuthentication, ActionAuthenticationType -from taskingai.client.models import ( - ActionBulkCreateRequest, - ActionBulkCreateResponse, - ActionUpdateRequest, - ActionUpdateResponse, - ActionGetResponse, - ActionListResponse, - ActionRunRequest, - ActionRunResponse, -) +from taskingai.client.models import * +from taskingai.client.apis import * + __all__ = [ "Action", @@ -50,18 +41,15 @@ def list_actions( if after and before: raise ValueError("Only one of after and before can be specified.") - api_instance = get_api_instance(ModuleType.TOOL) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: ActionListResponse = api_instance.list_actions(**params) - actions: List[Action] = [Action(**item) for item in response.data] - return actions + payload = ActionListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: ActionListResponse = api_list_actions(payload=payload) + return response.data async def a_list_actions( @@ -82,18 +70,15 @@ async def a_list_actions( if after and before: raise ValueError("Only one of after and before can be specified.") - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: ActionListResponse = await api_instance.list_actions(**params) - actions: List[Action] = [Action(**item) for item in response.data] - return actions + payload = ActionListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: ActionListResponse = await async_api_list_actions(payload) + return response.data def get_action(action_id: str) -> Action: @@ -103,10 +88,8 @@ def get_action(action_id: str) -> Action: :param action_id: The ID of the action. """ - api_instance = get_api_instance(ModuleType.TOOL) - response: ActionGetResponse = api_instance.get_action(action_id=action_id) - action: Action = Action(**response.data) - return action + response: ActionGetResponse = api_get_action(action_id=action_id) + return response.data async def a_get_action(action_id: str) -> Action: @@ -116,13 +99,14 @@ async def a_get_action(action_id: str) -> Action: :param action_id: The ID of the action. """ - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - response: ActionGetResponse = await api_instance.get_action(action_id=action_id) - action: Action = Action(**response.data) - return action + response: ActionGetResponse = await async_api_get_action(action_id=action_id) + return response.data -def bulk_create_actions(openapi_schema: Dict, authentication: Optional[ActionAuthentication] = None) -> List[Action]: +def bulk_create_actions( + openapi_schema: Dict, + authentication: Optional[ActionAuthentication] = None, +) -> List[Action]: """ Create actions from an OpenAPI schema. @@ -131,8 +115,6 @@ def bulk_create_actions(openapi_schema: Dict, authentication: Optional[ActionAut :return: The created action object. """ - # todo verify openapi_schema - api_instance = get_api_instance(ModuleType.TOOL) if authentication is None: authentication = ActionAuthentication( type=ActionAuthenticationType.NONE, @@ -141,13 +123,13 @@ def bulk_create_actions(openapi_schema: Dict, authentication: Optional[ActionAut openapi_schema=openapi_schema, authentication=authentication, ) - response: ActionBulkCreateResponse = api_instance.bulk_create_action(body=body) - actions: List[Action] = [Action(**data) for data in response.data] - return actions + response: ActionBulkCreateResponse = api_bulk_create_actions(payload=body) + return response.data async def a_bulk_create_actions( - openapi_schema: Dict, authentication: Optional[ActionAuthentication] = None + openapi_schema: Dict, + authentication: Optional[ActionAuthentication] = None, ) -> List[Action]: """ Create actions from an OpenAPI schema in async mode. @@ -157,8 +139,6 @@ async def a_bulk_create_actions( :return: The created action object. """ - # todo verify openapi_schema - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) if authentication is None: authentication = ActionAuthentication( type=ActionAuthenticationType.NONE, @@ -167,9 +147,8 @@ async def a_bulk_create_actions( openapi_schema=openapi_schema, authentication=authentication, ) - response: ActionBulkCreateResponse = await api_instance.bulk_create_action(body=body) - actions: List[Action] = [Action(**data) for data in response.data] - return actions + response: ActionBulkCreateResponse = await async_api_bulk_create_actions(payload=body) + return response.data def update_action( @@ -185,14 +164,12 @@ def update_action( :param authentication: The action API authentication. :return: The updated action object. """ - api_instance = get_api_instance(ModuleType.TOOL) body = ActionUpdateRequest( openapi_schema=openapi_schema, authentication=authentication, ) - response: ActionUpdateResponse = api_instance.update_action(action_id=action_id, body=body) - action: Action = Action(**response.data) - return action + response: ActionUpdateResponse = api_update_action(action_id=action_id, payload=body) + return response.data async def a_update_action( @@ -208,14 +185,12 @@ async def a_update_action( :param authentication: The action API authentication. :return: The updated action object. """ - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) body = ActionUpdateRequest( openapi_schema=openapi_schema, authentication=authentication, ) - response: ActionUpdateResponse = await api_instance.update_action(action_id=action_id, body=body) - action: Action = Action(**response.data) - return action + response: ActionUpdateResponse = await async_api_update_action(action_id=action_id, payload=body) + return response.data def delete_action(action_id: str) -> None: @@ -225,8 +200,7 @@ def delete_action(action_id: str) -> None: :param action_id: The ID of the action. """ - api_instance = get_api_instance(ModuleType.TOOL) - api_instance.delete_action(action_id=action_id) + api_delete_action(action_id=action_id) async def a_delete_action(action_id: str) -> None: @@ -236,8 +210,7 @@ async def a_delete_action(action_id: str) -> None: :param action_id: The ID of the action. """ - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - await api_instance.delete_action(action_id=action_id) + await async_api_delete_action(action_id=action_id) def run_action( @@ -252,11 +225,10 @@ def run_action( :return: The action response. """ - api_instance = get_api_instance(ModuleType.TOOL) body = ActionRunRequest( parameters=parameters, ) - response: ActionRunResponse = api_instance.run_action(action_id=action_id, body=body) + response: ActionRunResponse = api_run_action(action_id=action_id, payload=body) result = response.data return result @@ -273,10 +245,9 @@ async def a_run_action( :return: The action response. """ - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) body = ActionRunRequest( parameters=parameters, ) - response: ActionRunResponse = await api_instance.run_action(action_id=action_id, body=body) + response: ActionRunResponse = await async_api_run_action(action_id=action_id, payload=body) result = response.data return result diff --git a/taskingai/tool/function.py b/taskingai/tool/function.py deleted file mode 100644 index 9924b0b..0000000 --- a/taskingai/tool/function.py +++ /dev/null @@ -1,245 +0,0 @@ -from typing import Optional, List, Dict, Any - -from taskingai.client.utils import get_api_instance, ModuleType -from taskingai.client.models import Function -from taskingai.client.models import FunctionCreateRequest, FunctionCreateResponse, \ - FunctionUpdateRequest, FunctionUpdateResponse, \ - FunctionGetResponse, FunctionListResponse - -__all__ = [ - "Function", - "get_function", - "list_functions", - "create_function", - "update_function", - "delete_function", - "a_get_function", - "a_list_functions", - "a_create_function", - "a_update_function", - "a_delete_function", -] - - -def list_functions( - order: str = "desc", - limit: int = 20, - after: Optional[str] = None, - before: Optional[str] = None, -) -> List[Function]: - """ - List functions. - - :param order: The order of the functions. It can be "asc" or "desc". - :param limit: The maximum number of functions to return. - :param after: The cursor to get the next page of functions. - :param before: The cursor to get the previous page of functions. - :return: The list of functions. - """ - if after and before: - raise ValueError("Only one of after and before can be specified.") - - api_instance = get_api_instance(ModuleType.TOOL) - # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: FunctionListResponse = api_instance.list_functions(**params) - functions: List[Function] = [Function(**item) for item in response.data] - return functions - - -async def a_list_functions( - order: str = "desc", - limit: int = 20, - after: Optional[str] = None, - before: Optional[str] = None, -) -> List[Function]: - """ - List functions in async mode. - - :param order: The order of the functions. It can be "asc" or "desc". - :param limit: The maximum number of functions to return. - :param after: The cursor to get the next page of functions. - :param before: The cursor to get the previous page of functions. - :return: The list of functions. - """ - if after and before: - raise ValueError("Only one of after and before can be specified.") - - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - # only add non-None parameters - params = { - "order": order, - "limit": limit, - "after": after, - "before": before, - } - params = {k: v for k, v in params.items() if v is not None} - response: FunctionListResponse = await api_instance.list_functions(**params) - functions: List[Function] = [Function(**item) for item in response.data] - return functions - - - -def get_function(function_id: str) -> Function: - """ - Get a function. - - :param function_id: The ID of the function. - """ - - api_instance = get_api_instance(ModuleType.TOOL) - response: FunctionGetResponse = api_instance.get_function(function_id=function_id) - function: Function = Function(**response.data) - return function - - -async def a_get_function(function_id: str) -> Function: - """ - Get a function in async mode. - - :param function_id: The ID of the function. - """ - - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - response: FunctionGetResponse = await api_instance.get_function(function_id=function_id) - function: Function = Function(**response.data) - return function - - -def create_function( - name: str, - description: str, - parameters: Dict, -) -> Function: - """ - Create a function. - - :param name: The name of the function. It shoule be a meaningful function name, consists of letters, digits and underscore "_" and its first character cannot be a digit. - :param description: The description of the function. - :param parameters: The parameters of the function. - :return: The created function object. - """ - - # todo verify parameters - api_instance = get_api_instance(ModuleType.TOOL) - body = FunctionCreateRequest( - name=name, - description=description, - parameters=parameters, - ) - response: FunctionCreateResponse = api_instance.create_function(body=body) - function: Function = Function(**response.data) - return function - - -async def a_create_function( - name: str, - description: str, - parameters: Dict, -) -> Function: - """ - Create a function in async mode. - - :param name: The name of the function. It shoule be a meaningful function name, consists of letters, digits and underscore "_" and its first character cannot be a digit. - :param description: The description of the function. - :param parameters: The parameters of the function. - :return: The created function object. - """ - - # todo verify parameters - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - body = FunctionCreateRequest( - name=name, - description=description, - parameters=parameters, - ) - response: FunctionCreateResponse = await api_instance.create_function(body=body) - function: Function = Function(**response.data) - return function - - -def update_function( - function_id: str, - name: Optional[str] = None, - description: Optional[str] = None, - parameters: Optional[Dict] = None, -) -> Function: - """ - Update a function. - - :param function_id: The ID of the function. - :param schema: The function schema, which is compliant with the OpenAPI Specification. It should only have exactly one path and one method. - :param authentication: The function API authentication. - :return: The updated function object. - """ - #todo: verify schema - api_instance = get_api_instance(ModuleType.TOOL) - body = FunctionUpdateRequest( - name=name, - description=description, - parameters=parameters, - ) - response: FunctionUpdateResponse = api_instance.update_function( - function_id=function_id, - body=body - ) - function: Function = Function(**response.data) - return function - - -async def a_update_function( - function_id: str, - name: Optional[str] = None, - description: Optional[str] = None, - parameters: Optional[Dict] = None, -) -> Function: - """ - Update a function in async mode. - - :param function_id: The ID of the function. - :param schema: The function schema, which is compliant with the OpenAPI Specification. It should only have exactly one path and one method. - :param authentication: The function API authentication. - :return: The updated function object. - """ - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - body = FunctionUpdateRequest( - name=name, - description=description, - parameters=parameters, - ) - response: FunctionUpdateResponse = await api_instance.update_function( - function_id=function_id, - body=body - ) - function: Function = Function(**response.data) - return function - - -def delete_function(function_id: str) -> None: - """ - Delete a function. - - :param function_id: The ID of the function. - """ - - api_instance = get_api_instance(ModuleType.TOOL) - api_instance.delete_function(function_id=function_id) - - -async def a_delete_function(function_id: str) -> None: - """ - Delete a function in async mode. - - :param function_id: The ID of the function. - """ - - api_instance = get_api_instance(ModuleType.TOOL, async_client=True) - await api_instance.delete_function(function_id=function_id) - - From 841e54ccf8e50ab7bd65e62baaacc66f2c2a0513 Mon Sep 17 00:00:00 2001 From: jameszyao Date: Sun, 3 Mar 2024 16:51:21 +0800 Subject: [PATCH 2/4] feat: add chunk CRUD ops --- examples/assistant/chat_with_assistant.ipynb | 16 +- examples/crud/retrieval_crud.ipynb | 173 +++++++++++++- taskingai/retrieval/chunk.py | 233 ++++++++++++++++++- taskingai/retrieval/record.py | 1 + 4 files changed, 412 insertions(+), 11 deletions(-) diff --git a/examples/assistant/chat_with_assistant.ipynb b/examples/assistant/chat_with_assistant.ipynb index 4ab9ff8..bd4b53e 100644 --- a/examples/assistant/chat_with_assistant.ipynb +++ b/examples/assistant/chat_with_assistant.ipynb @@ -127,12 +127,18 @@ " \"You know the meaning of various numbers.\",\n", " \"No matter what the user's language is, you will use the {{langugae}} to explain.\"\n", " ],\n", - " tools=[AssistantTool(\n", - " type=AssistantToolType.ACTION,\n", - " id=action.action_id,\n", - " )],\n", + " tools=[\n", + " AssistantTool(\n", + " type=AssistantToolType.ACTION,\n", + " id=action.action_id,\n", + " ), \n", + " AssistantTool(\n", + " type=AssistantToolType.ACTION,\n", + " id=action.action_id,\n", + " )\n", + " ],\n", " retrievals=[],\n", - " metadata={\"foo\": \"bar\"},\n", + " metadata={\"k\": \"v\"},\n", ")\n", "print(f\"created assistant: {assistant}\\n\")" ], diff --git a/examples/crud/retrieval_crud.ipynb b/examples/crud/retrieval_crud.ipynb index 67f8b7b..8cd13fc 100644 --- a/examples/crud/retrieval_crud.ipynb +++ b/examples/crud/retrieval_crud.ipynb @@ -28,7 +28,7 @@ "execution_count": null, "outputs": [], "source": [ - "from taskingai.retrieval import Collection, Record, TokenTextSplitter\n", + "from taskingai.retrieval import Collection, Record, Chunk, TokenTextSplitter\n", "\n", "# choose an available text_embedding model from your project\n", "embedding_model_id = \"YOUR_EMBEDDING_MODEL_ID\"" @@ -212,11 +212,11 @@ "execution_count": null, "outputs": [], "source": [ - "# update record\n", + "# update record - metadata\n", "record = taskingai.retrieval.update_record(\n", " collection_id=collection.collection_id,\n", " record_id=record.record_id,\n", - " metadata={\"foo\": \"bar\"}, # currently only metadata update is supported\n", + " metadata={\"foo\": \"bar\"},\n", ")\n", "print(f\"updated record: {record}\")" ], @@ -225,6 +225,25 @@ }, "id": "65d833b22e1e657" }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# update record - content\n", + "record = taskingai.retrieval.update_record(\n", + " collection_id=collection.collection_id,\n", + " record_id=record.record_id,\n", + " content=\"New content\",\n", + " text_splitter=TokenTextSplitter(chunk_size=100, chunk_overlap=20),\n", + ")\n", + "print(f\"updated record: {record}\")" + ], + "metadata": { + "collapsed": false + }, + "id": "4369989d2bd1a777" + }, { "cell_type": "code", "execution_count": null, @@ -257,6 +276,154 @@ "collapsed": false }, "id": "accf6d883fcffaa8" + }, + { + "cell_type": "markdown", + "source": [ + "## Chunk Object" + ], + "metadata": { + "collapsed": false + }, + "id": "b0e4c12fb7509fea" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# create a new text record\n", + "chunk: Chunk = taskingai.retrieval.create_chunk(\n", + " collection_id=collection.collection_id,\n", + " content=\"The dog is a domesticated descendant of the wolf. Also called the domestic dog, it is derived from extinct gray wolves, and the gray wolf is the dog's closest living relative. The dog was the first species to be domesticated by humans.\",\n", + ")\n", + "print(f\"created chunk: {chunk.chunk_id} for collection: {collection.collection_id}\\n\")" + ], + "metadata": { + "collapsed": false + }, + "id": "a395337f136500fc" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# update chunk metadata\n", + "chunk = taskingai.retrieval.update_chunk(\n", + " collection_id=collection.collection_id,\n", + " chunk_id=chunk.chunk_id,\n", + " metadata={\"k\": \"v\"},\n", + ")\n", + "print(f\"updated chunk: {chunk}\")" + ], + "metadata": { + "collapsed": false + }, + "id": "309e1771251bb079" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# update chunk content\n", + "chunk = taskingai.retrieval.update_chunk(\n", + " collection_id=collection.collection_id,\n", + " chunk_id=chunk.chunk_id,\n", + " content=\"New content\",\n", + ")\n", + "print(f\"updated chunk: {chunk}\")" + ], + "metadata": { + "collapsed": false + }, + "id": "a9d68db12329b558" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# get chunk\n", + "chunk = taskingai.retrieval.get_chunk(\n", + " collection_id=collection.collection_id,\n", + " chunk_id=chunk.chunk_id\n", + ")\n", + "print(f\"got chunk: {chunk}\\n\")" + ], + "metadata": { + "collapsed": false + }, + "id": "d3899097cd6d0cf2" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# delete chunk\n", + "taskingai.retrieval.delete_chunk(\n", + " collection_id=collection.collection_id,\n", + " chunk_id=chunk.chunk_id,\n", + ")\n", + "print(f\"deleted chunk {chunk.chunk_id} from collection {collection.collection_id}\\n\")" + ], + "metadata": { + "collapsed": false + }, + "id": "27e643ad8e8636ed" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# create a new text record and a new chunk\n", + "taskingai.retrieval.create_record(\n", + " collection_id=collection.collection_id,\n", + " content=\"Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data. The term \\\"machine learning\\\" was coined by Arthur Samuel in 1959. In other words, machine learning enables a system to automatically learn and improve from experience without being explicitly programmed. This is achieved by feeding the system massive amounts of data, which it uses to learn patterns and make inferences. There are three main types of machine learning: 1. Supervised Learning: This is where the model is given labeled training data and the goal of learning is to generalize from the training data to unseen situations in a principled way. 2. Unsupervised Learning: This involves training on a dataset without explicit labels. The goal might be to discover inherent groupings or patterns within the data. 3. Reinforcement Learning: In this type, an agent learns to perform actions based on reward/penalty feedback to achieve a goal. It's commonly used in robotics, gaming, and navigation. Deep learning, a subset of machine learning, uses neural networks with many layers (\\\"deep\\\" structures) and has been responsible for many recent breakthroughs in AI, including speech recognition, image recognition, and natural language processing. It's important to note that machine learning is a rapidly developing field, with new techniques and applications emerging regularly.\",\n", + " text_splitter=TokenTextSplitter(chunk_size=200, chunk_overlap=20)\n", + ")\n", + "\n", + "taskingai.retrieval.create_chunk(\n", + " collection_id=collection.collection_id,\n", + " content=\"The dog is a domesticated descendant of the wolf. Also called the domestic dog, it is derived from extinct gray wolves, and the gray wolf is the dog's closest living relative. The dog was the first species to be domesticated by humans.\",\n", + ")" + ], + "metadata": { + "collapsed": false + }, + "id": "a74dd7615ec28528" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# list chunks\n", + "chunks = taskingai.retrieval.list_chunks(collection_id=collection.collection_id)\n", + "for chunk in chunks:\n", + " print(chunk)\n", + " print(\"-\" * 50)" + ], + "metadata": { + "collapsed": false + }, + "id": "55e9645ac41f8ca" + }, + { + "cell_type": "code", + "execution_count": null, + "outputs": [], + "source": [ + "# delete collection\n", + "taskingai.retrieval.delete_collection(collection_id=collection.collection_id)" + ], + "metadata": { + "collapsed": false + }, + "id": "b97aaa156f586e34" } ], "metadata": { diff --git a/taskingai/retrieval/chunk.py b/taskingai/retrieval/chunk.py index 3305a81..b277678 100644 --- a/taskingai/retrieval/chunk.py +++ b/taskingai/retrieval/chunk.py @@ -1,22 +1,249 @@ -from typing import List +from typing import List, Optional, Dict from taskingai.client.models import * from taskingai.client.apis import * __all__ = [ "Chunk", + "list_chunks", + "a_list_chunks", + "get_chunk", + "a_get_chunk", + "create_chunk", + "a_create_chunk", + "update_chunk", + "a_update_chunk", + "delete_chunk", + "a_delete_chunk", "query_chunks", "a_query_chunks", ] +def list_chunks( + collection_id: str, + order: str = "desc", + limit: int = 20, + after: Optional[str] = None, + before: Optional[str] = None, +) -> List[Chunk]: + """ + List chunks. + + :param collection_id: The ID of the collection. + :param order: The order of the chunks. It can be "asc" or "desc". + :param limit: The maximum number of assistants to return. + :param after: The cursor to get the next page of chunks. + :param before: The cursor to get the previous page of chunks. + :return: The list of chunks. + """ + + if after and before: + raise ValueError("Only one of after and before can be specified.") + + # only add non-None parameters + payload = ChunkListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: ChunkListResponse = api_list_chunks(collection_id=collection_id, payload=payload) + return response.data + + +async def a_list_chunks( + collection_id: str, + order: str = "desc", + limit: int = 20, + after: Optional[str] = None, + before: Optional[str] = None, +) -> List[Chunk]: + """ + List chunks in async mode. + :param collection_id: The ID of the collection. + :param order: The order of the chunks. It can be "asc" or "desc". + :param limit: The maximum number of chunks to return. + :param after: The cursor to get the next page of chunks. + :param before: The cursor to get the previous page of chunks. + :return: The list of chunks. + """ + + if after and before: + raise ValueError("Only one of after and before can be specified.") + + # only add non-None parameters + payload = ChunkListRequest( + order=order, + limit=limit, + after=after, + before=before, + ) + response: ChunkListResponse = await async_api_list_chunks(collection_id=collection_id, payload=payload) + return response.data + + +def get_chunk(collection_id: str, chunk_id: str) -> Chunk: + """ + Get a chunk. + + :param collection_id: The ID of the collection. + :param chunk_id: The ID of the chunk. + """ + + response: ChunkGetResponse = api_get_chunk( + collection_id=collection_id, + chunk_id=chunk_id, + ) + return response.data + + +async def a_get_chunk(collection_id: str, chunk_id: str) -> Chunk: + """ + Get a chunk in async mode. + + :param collection_id: The ID of the collection. + :param chunk_id: The ID of the chunk. + """ + + response: ChunkGetResponse = await async_api_get_chunk( + collection_id=collection_id, + chunk_id=chunk_id, + ) + return response.data + + +def create_chunk( + collection_id: str, + content: str, + metadata: Optional[Dict[str, str]] = None, +) -> Chunk: + """ + Create a chunk. + + :param collection_id: The ID of the collection. + :param content: The content of the chunk. + :param metadata: The collection metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. + :return: The created chunk object. + """ + + body = ChunkCreateRequest( + content=content, + metadata=metadata or {}, + ) + response: ChunkCreateResponse = api_create_chunk(collection_id=collection_id, payload=body) + return response.data + + +async def a_create_chunk( + collection_id: str, + content: str, + metadata: Optional[Dict[str, str]] = None, +) -> Chunk: + """ + Create a chunk in async mode. + + :param collection_id: The ID of the collection. + :param content: The content of the chunk. + :param metadata: The collection metadata. It can store up to 16 key-value pairs where each key's length is less than 64 and value's length is less than 512. + :return: The created chunk object. + """ + + body = ChunkCreateRequest( + content=content, + metadata=metadata or {}, + ) + response: ChunkCreateResponse = await async_api_create_chunk(collection_id=collection_id, payload=body) + return response.data + + +def update_chunk( + collection_id: str, + chunk_id: str, + content: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, +) -> Chunk: + """ + Update a chunk. + + :param collection_id: The ID of the collection. + :param chunk_id: The ID of the chunk. + :param content: The content of the chunk. + :param metadata: The collection metadata. It can store up to 16 key-value pairs where each key's length is less + than 64 and value's length is less than 512. + :return: The collection object. + """ + + body = ChunkUpdateRequest( + content=content, + metadata=metadata, + ) + response: ChunkUpdateResponse = api_update_chunk(collection_id=collection_id, chunk_id=chunk_id, payload=body) + return response.data + + +async def a_update_chunk( + collection_id: str, + chunk_id: str, + content: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, +) -> Chunk: + """ + Update a chunk in async mode. + + :param collection_id: The ID of the collection. + :param chunk_id: The ID of the chunk. + :param content: The content of the chunk. + :param metadata: The collection metadata. It can store up to 16 key-value pairs where each key's length is less + than 64 and value's length is less than 512. + :return: The collection object. + """ + + body = ChunkUpdateRequest( + content=content, + metadata=metadata, + ) + response: ChunkUpdateResponse = await async_api_update_chunk( + collection_id=collection_id, chunk_id=chunk_id, payload=body + ) + return response.data + + +def delete_chunk( + collection_id: str, + chunk_id: str, +) -> None: + """ + Delete a chunk. + + :param collection_id: The ID of the collection. + :param chunk_id: The ID of the chunk. + """ + + api_delete_chunk(collection_id=collection_id, chunk_id=chunk_id) + + +async def a_delete_chunk( + collection_id: str, + chunk_id: str, +) -> None: + """ + Delete a chunk in async mode. + + :param collection_id: The ID of the collection. + :param chunk_id: The ID of the chunk. + """ + + await async_api_delete_chunk(collection_id=collection_id, chunk_id=chunk_id) + + def query_chunks( collection_id: str, query_text: str, top_k: int = 3, ) -> List[Chunk]: """ - List records. + Query chunks in a collection. :param collection_id: The ID of the collection. :param query_text: The query text. :param top_k: The number of most relevant chunks to return. @@ -40,7 +267,7 @@ async def a_query_chunks( top_k: int = 3, ) -> List[Chunk]: """ - List records in async mode. + Query chunks in a collection. :param collection_id: The ID of the collection. :param query_text: The query text. :param top_k: The number of most relevant chunks to return. diff --git a/taskingai/retrieval/record.py b/taskingai/retrieval/record.py index c3ee7ad..86d0a30 100644 --- a/taskingai/retrieval/record.py +++ b/taskingai/retrieval/record.py @@ -28,6 +28,7 @@ def list_records( """ List records. + :param collection_id: The ID of the collection. :param order: The order of the records. It can be "asc" or "desc". :param limit: The maximum number of assistants to return. :param after: The cursor to get the next page of records. From 6a43bc9eeb8d7f6f068e4e6968f1771f7848f494 Mon Sep 17 00:00:00 2001 From: jameszyao Date: Sun, 3 Mar 2024 21:59:55 +0800 Subject: [PATCH 3/4] feat: update async client --- examples/assistant/chat_with_assistant.ipynb | 12 ++++++------ examples/crud/assistant_crud.ipynb | 2 +- taskingai/client/api_client.py | 14 ++------------ taskingai/models.py | 0 4 files changed, 9 insertions(+), 19 deletions(-) create mode 100644 taskingai/models.py diff --git a/examples/assistant/chat_with_assistant.ipynb b/examples/assistant/chat_with_assistant.ipynb index bd4b53e..e66fcd1 100644 --- a/examples/assistant/chat_with_assistant.ipynb +++ b/examples/assistant/chat_with_assistant.ipynb @@ -42,7 +42,7 @@ "execution_count": null, "outputs": [], "source": [ - "from taskingai.tool import Action, ActionAuthentication, ActionAuthenticationType\n", + "from taskingai.models import Action, ActionAuthentication, ActionAuthenticationType\n", "from typing import List\n", "\n", "# create an assistant action\n", @@ -109,7 +109,7 @@ "execution_count": null, "outputs": [], "source": [ - "from taskingai.assistant import Assistant, Chat, AssistantTool, AssistantToolType\n", + "from taskingai.models import Assistant, Chat, ToolRef, ToolType\n", "from taskingai.assistant.memory import AssistantMessageWindowMemory\n", "\n", "# choose an available chat_completion model from your project\n", @@ -128,12 +128,12 @@ " \"No matter what the user's language is, you will use the {{langugae}} to explain.\"\n", " ],\n", " tools=[\n", - " AssistantTool(\n", - " type=AssistantToolType.ACTION,\n", + " ToolRef(\n", + " type=ToolType.ACTION,\n", " id=action.action_id,\n", " ), \n", - " AssistantTool(\n", - " type=AssistantToolType.ACTION,\n", + " ToolRef(\n", + " type=ToolType.ACTION,\n", " id=action.action_id,\n", " )\n", " ],\n", diff --git a/examples/crud/assistant_crud.ipynb b/examples/crud/assistant_crud.ipynb index 411ead3..8a65b90 100644 --- a/examples/crud/assistant_crud.ipynb +++ b/examples/crud/assistant_crud.ipynb @@ -25,7 +25,7 @@ "metadata": {}, "outputs": [], "source": [ - "from taskingai.assistant import Assistant, Chat\n", + "from taskingai.models import Assistant, Chat\n", "from taskingai.assistant.memory import AssistantNaiveMemory\n", "\n", "# choose an available chat_completion model from your project\n", diff --git a/taskingai/client/api_client.py b/taskingai/client/api_client.py index abe9bfc..5619cb8 100644 --- a/taskingai/client/api_client.py +++ b/taskingai/client/api_client.py @@ -485,28 +485,18 @@ async def __call_api( # path parameters if path_params: - path_params = self.parameters_to_tuples(path_params, collection_formats) - for k, v in path_params: + for k, v in path_params.items(): # specified safe chars, encode everything resource_path = resource_path.replace("{%s}" % k, quote(str(v), safe=config.safe_chars_for_path_param)) - # query parameters - if query_params: - query_params = self.sanitize_for_serialization(query_params) - query_params = self.parameters_to_tuples(query_params, collection_formats) - # post parameters if post_params or files: post_params = self.prepare_post_parameters(post_params, files) - post_params = self.sanitize_for_serialization(post_params) - post_params = self.parameters_to_tuples(post_params, collection_formats) # auth setting self.update_params_for_auth(header_params, query_params, auth_settings) # body - if body: - body = self.sanitize_for_serialization(body) # request url url = self.configuration.host + resource_path @@ -515,7 +505,7 @@ async def __call_api( response_data = await self.request( method, url, - stream, + stream=stream, query_params=query_params, headers=header_params, post_params=post_params, diff --git a/taskingai/models.py b/taskingai/models.py new file mode 100644 index 0000000..e69de29 From 811ebdf2cd2cdea3668465b255372c6114c4d966 Mon Sep 17 00:00:00 2001 From: taskingaijc <150663083+taskingaijc@users.noreply.github.com> Date: Mon, 4 Mar 2024 20:04:23 +0800 Subject: [PATCH 4/4] test: add retrieval test --- test/common/utils.py | 50 +++ test/config.py | 17 +- test/data/test_assistant_data.yml | 19 - test/run_test.sh | 10 + test/testcase/test_async/__init__.py | 3 + test/testcase/test_async/base.py | 3 - .../test_async/test_async_assistant.py | 350 +++++++++--------- .../test_async/test_async_inference.py | 68 ++-- .../test_async/test_async_retrieval.py | 338 +++++++++++------ test/testcase/test_async/test_async_tool.py | 291 ++++++++------- test/testcase/test_sync/conftest.py | 9 +- .../testcase/test_sync/test_sync_assistant.py | 315 ++++++++-------- .../testcase/test_sync/test_sync_inference.py | 68 ++-- .../testcase/test_sync/test_sync_retrieval.py | 290 ++++++++++----- test/testcase/test_sync/test_sync_tool.py | 271 +++++++------- 15 files changed, 1233 insertions(+), 869 deletions(-) delete mode 100644 test/data/test_assistant_data.yml create mode 100644 test/run_test.sh delete mode 100644 test/testcase/test_async/base.py diff --git a/test/common/utils.py b/test/common/utils.py index 88be708..5b4815a 100644 --- a/test/common/utils.py +++ b/test/common/utils.py @@ -93,3 +93,53 @@ def get_random(): def get_project_id(i: int): return (get_random() for j in range(i)) + + +def assume_text_embedding_result(result: list): + pytest.assume(len(result) > 0) + pytest.assume(all(isinstance(value, float) for value in result)) + + +def assume_collection_result(create_dict: dict, res_dict: dict): + for key in create_dict: + pytest.assume(res_dict[key] == create_dict[key]) + pytest.assume(res_dict["status"] == "ready") + + +def assume_record_result(create_record_data: dict, res_dict: dict): + for key in create_record_data: + if key == "text_splitter": + continue + pytest.assume(res_dict[key] == create_record_data[key]) + pytest.assume(res_dict["status"] == "ready") + + +def assume_chunk_result(chunk_dict: dict, res: dict): + for key, value in chunk_dict.items(): + pytest.assume(res[key] == chunk_dict[key]) + + +def assume_query_chunk_result(query_text, chunk_dict: dict): + pytest.assume(query_text in chunk_dict["content"]) + pytest.assume(isinstance(chunk_dict["score"], float)) + + +def assume_assistant_result(assistant_dict: dict, res: dict): + for key, value in assistant_dict.items(): + if key == 'system_prompt_template' and isinstance(value, str): + pytest.assume(res[key] == [assistant_dict[key]]) + elif key in ["memory", "tool", "retrievals"]: + continue + else: + pytest.assume(res[key] == assistant_dict[key]) + + +def assume_chat_result(chat_dict: dict, res: dict): + for key, value in chat_dict.items(): + pytest.assume(res[key] == chat_dict[key]) + + +def assume_message_result(message_dict: dict, res: dict): + for key, value in message_dict.items(): + pytest.assume(res[key] == message_dict[key]) + diff --git a/test/config.py b/test/config.py index 408d1a4..d09f5db 100644 --- a/test/config.py +++ b/test/config.py @@ -1,13 +1,16 @@ import os -chat_completion_model_id = os.environ.get("CHAT_COMPLETION_MODEL_ID") -if not chat_completion_model_id: - raise ValueError("chat_completion_model_id is not defined") -embedding_model_id = os.environ.get("EMBEDDING_MODEL_ID") -if not chat_completion_model_id: - raise ValueError("chat_completion_model_id is not defined") +class Config: -sleep_time = 1 + chat_completion_model_id = os.environ.get("CHAT_COMPLETION_MODEL_ID") + if not chat_completion_model_id: + raise ValueError("chat_completion_model_id is not defined") + + text_embedding_model_id = os.environ.get("TEXT_EMBEDDING_MODEL_ID") + if not chat_completion_model_id: + raise ValueError("chat_completion_model_id is not defined") + + sleep_time = 1 diff --git a/test/data/test_assistant_data.yml b/test/data/test_assistant_data.yml deleted file mode 100644 index d3097fd..0000000 --- a/test/data/test_assistant_data.yml +++ /dev/null @@ -1,19 +0,0 @@ -test_success_create_assistant: - # 'name', 'description', 'metadata', ' 'retrievals', 'system_prompt_template', 'tools' - - [ "name": "My Assistant", "description": "This is my assistant","metadata": {"foo": "bar"} , "system_prompt_template":["You are a professional assistant speaking {{language}}."],"tools":[],"retrievals":[] ] - - ["metadata": {} ] - - [ "retrievals": [{"type": "collection"}] ] - - [ "tools": [ { "type": "action" } ] ] - - - - - - - - - - - - - diff --git a/test/run_test.sh b/test/run_test.sh new file mode 100644 index 0000000..43f8608 --- /dev/null +++ b/test/run_test.sh @@ -0,0 +1,10 @@ +set -e +parent_dir="$(dirname "$(pwd)")" +export PYTHONPATH="${PYTHONPATH}:${parent_dir}" + +echo "Starting tests..." + +pytest -q --tb=no + +echo "Tests completed." + diff --git a/test/testcase/test_async/__init__.py b/test/testcase/test_async/__init__.py index e69de29..1f4fd37 100644 --- a/test/testcase/test_async/__init__.py +++ b/test/testcase/test_async/__init__.py @@ -0,0 +1,3 @@ +class Base: + + collection_id, record_id, chunk_id, action_id, assistant_id, chat_id, message_id = None, None, None, None, None, None, None \ No newline at end of file diff --git a/test/testcase/test_async/base.py b/test/testcase/test_async/base.py deleted file mode 100644 index c345ad8..0000000 --- a/test/testcase/test_async/base.py +++ /dev/null @@ -1,3 +0,0 @@ -class Base: - - collection_id, record_id, action_id, assistant_id, chat_id, message_id = None, None, None, None, None, None \ No newline at end of file diff --git a/test/testcase/test_async/test_async_assistant.py b/test/testcase/test_async/test_async_assistant.py index 7557fe4..bd42833 100644 --- a/test/testcase/test_async/test_async_assistant.py +++ b/test/testcase/test_async/test_async_assistant.py @@ -1,68 +1,65 @@ import pytest from taskingai.assistant import * +from taskingai.client.models import ToolRef, ToolType, RetrievalRef, RetrievalType from taskingai.assistant.memory import AssistantNaiveMemory -from test.config import chat_completion_model_id +from test.config import Config from test.common.read_data import data from test.common.logger import logger from test.common.utils import list_to_dict -from test.common.utils import assume_assistant -from test.testcase.test_async.base import Base -from taskingai.tool import * -from taskingai.retrieval import * -import re - -assistant_data = data.load_yaml("test_assistant_data.yml") +from test.common.utils import assume_assistant_result, assume_chat_result, assume_message_result +from test.testcase.test_async import Base @pytest.mark.test_async class TestAssistant(Base): - assistant_list = [ - "assistant_id", - "created_timestamp", - "description", - "metadata", - "model_id", - "name", - "object", - "retrievals", - "system_prompt_template", - "tools", - "memory", - ] + + assistant_list = ['assistant_id', 'updated_timestamp','created_timestamp', 'description', 'metadata', 'model_id', 'name', 'retrievals', 'retrieval_configs', 'system_prompt_template', 'tools',"memory"] assistant_keys = set(assistant_list) - @pytest.mark.parametrize("a_create_assistant_data", assistant_data["test_success_create_assistant"]) - @pytest.mark.run(order=18) + @pytest.mark.run(order=51) @pytest.mark.asyncio - async def test_a_create_assistant(self, a_create_assistant_data): - # Create an assistant. + async def test_a_create_assistant(self): - assistant_dict = list_to_dict(a_create_assistant_data) - assistant_dict.update({"model_id": chat_completion_model_id}) - if ( - "retrievals" in assistant_dict.keys() - and len(assistant_dict["retrievals"]) > 0 - and assistant_dict["retrievals"][0]["type"] == "collection" - ): - assistant_dict["retrievals"][0]["id"] = Base.collection_id - if ( - "tools" in assistant_dict.keys() - and len(assistant_dict["tools"]) > 0 - and assistant_dict["tools"][0]["type"] == "action" - ): - logger.info(f"a_create_assistant_action_id:{Base.action_id}") - assistant_dict["tools"][0]["id"] = Base.action_id - assistant_dict.update({"memory": AssistantNaiveMemory()}) - res = await a_create_assistant(**assistant_dict) - res_dict = res.to_dict() - logger.info(f"response_dict:{res_dict}, except_dict:{assistant_dict}") - pytest.assume(res_dict.keys() == self.assistant_keys) - assume_assistant(res_dict, assistant_dict) + # Create an assistant. - @pytest.mark.run(order=19) + assistant_dict = { + "model_id": Config.chat_completion_model_id, + "name": "test", + "description": "test for assistant", + "memory": AssistantNaiveMemory(), + "system_prompt_template": ["You know the meaning of various numbers.", + "No matter what the user's language is, you will use the {{langugae}} to explain."], + "metadata": {"test": "test"}, + "retrievals": [ + RetrievalRef( + type=RetrievalType.COLLECTION, + id=self.collection_id, + ), + ], + "tools": [ + ToolRef( + type=ToolType.ACTION, + id=self.action_id, + ), + ToolRef( + type=ToolType.PLUGIN, + id="open_weather/get_hourly_forecast", + ) + ] + } + for i in range(4): + res = await a_create_assistant(**assistant_dict) + res_dict = vars(res) + logger.info(f'response_dict:{res_dict}, except_dict:{assistant_dict}') + pytest.assume(res_dict.keys() == self.assistant_keys) + assume_assistant_result(assistant_dict, res_dict) + Base.assistant_id = res.assistant_id + + @pytest.mark.run(order=52) @pytest.mark.asyncio async def test_a_list_assistants(self): + # List assistants. nums_limit = 1 @@ -84,33 +81,34 @@ async def test_a_list_assistants(self): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=20) + @pytest.mark.run(order=53) @pytest.mark.asyncio - async def test_a_get_assistant(self, a_assistant_id): + async def test_a_get_assistant(self): + # Get an assistant. - if not Base.assistant_id: - Base.assistant_id = await a_assistant_id res = await a_get_assistant(assistant_id=self.assistant_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.assistant_keys) - @pytest.mark.run(order=21) + @pytest.mark.run(order=54) @pytest.mark.asyncio async def test_a_update_assistant(self): + # Update an assistant. name = "openai" description = "test for openai" res = await a_update_assistant(assistant_id=self.assistant_id, name=name, description=description) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.assistant_keys) pytest.assume(res_dict["name"] == name) pytest.assume(res_dict["description"] == description) - @pytest.mark.run(order=33) + @pytest.mark.run(order=66) @pytest.mark.asyncio async def test_a_delete_assistant(self): + # List assistants. assistants = await a_list_assistants(limit=100) @@ -133,119 +131,120 @@ async def test_a_delete_assistant(self): @pytest.mark.test_async class TestChat(Base): - chat_list = ["assistant_id", "chat_id", "created_timestamp", "metadata", "object"] - chat_keys = set(chat_list) - @pytest.mark.run(order=22) - @pytest.mark.asyncio - async def test_a_create_chat(self): - for x in range(2): - # Create a chat. + chat_list = ['assistant_id', 'chat_id', 'created_timestamp', 'updated_timestamp', 'metadata'] + chat_keys = set(chat_list) - res = await a_create_chat(assistant_id=self.assistant_id) - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.chat_keys) + @pytest.mark.run(order=55) + @pytest.mark.asyncio + async def test_a_create_chat(self): - @pytest.mark.run(order=23) - @pytest.mark.asyncio - async def test_a_list_chats(self): - # List chats. + for x in range(2): - nums_limit = 1 - res = await a_list_chats(limit=nums_limit, assistant_id=self.assistant_id) - pytest.assume(len(res) == nums_limit) + # Create a chat. - after_id = res[-1].chat_id - after_res = await a_list_chats(limit=nums_limit, after=after_id, assistant_id=self.assistant_id) - pytest.assume(len(after_res) == nums_limit) + res = await a_create_chat(assistant_id=self.assistant_id) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chat_keys) + Base.chat_id = res.chat_id - twice_nums_list = await a_list_chats(limit=nums_limit * 2, assistant_id=self.assistant_id) - pytest.assume(len(twice_nums_list) == nums_limit * 2) - pytest.assume(after_res[-1] == twice_nums_list[-1]) - pytest.assume(after_res[0] == twice_nums_list[nums_limit]) + @pytest.mark.run(order=56) + @pytest.mark.asyncio + async def test_a_list_chats(self): - before_id = after_res[0].chat_id - before_res = await a_list_chats(limit=nums_limit, before=before_id, assistant_id=self.assistant_id) - pytest.assume(len(before_res) == nums_limit) - pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) - pytest.assume(before_res[0] == twice_nums_list[0]) + # List chats. - @pytest.mark.run(order=24) - @pytest.mark.asyncio - async def test_a_get_chat(self, a_chat_id): - # Get a chat. + nums_limit = 1 + res = await a_list_chats(limit=nums_limit, assistant_id=self.assistant_id) + pytest.assume(len(res) == nums_limit) - if not Base.chat_id: - Base.assistant_id, Base.chat_id = await a_chat_id - res = await a_get_chat(assistant_id=self.assistant_id, chat_id=self.chat_id) - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.chat_keys) + after_id = res[-1].chat_id + after_res = await a_list_chats(limit=nums_limit, after=after_id, assistant_id=self.assistant_id) + pytest.assume(len(after_res) == nums_limit) - @pytest.mark.run(order=25) - @pytest.mark.asyncio - async def test_a_update_chat(self): - # Update a chat. + twice_nums_list = await a_list_chats(limit=nums_limit * 2, assistant_id=self.assistant_id) + pytest.assume(len(twice_nums_list) == nums_limit * 2) + pytest.assume(after_res[-1] == twice_nums_list[-1]) + pytest.assume(after_res[0] == twice_nums_list[nums_limit]) - metadata = {"test": "test"} - res = await a_update_chat(assistant_id=self.assistant_id, chat_id=self.chat_id, metadata=metadata) - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.chat_keys) - pytest.assume(res_dict["metadata"] == metadata) + before_id = after_res[0].chat_id + before_res = await a_list_chats(limit=nums_limit, before=before_id, assistant_id=self.assistant_id) + pytest.assume(len(before_res) == nums_limit) + pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) + pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=32) - @pytest.mark.asyncio - async def test_a_delete_chat(self): - # List chats. + @pytest.mark.run(order=57) + @pytest.mark.asyncio + async def test_a_get_chat(self): - chats = await a_list_chats(assistant_id=self.assistant_id) - old_nums = len(chats) - for index, chat in enumerate(chats): - chat_id = chat.chat_id + # Get a chat. + res = await a_get_chat(assistant_id=self.assistant_id, chat_id=self.chat_id) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chat_keys) - # Delete a chat. + @pytest.mark.run(order=58) + @pytest.mark.asyncio + async def test_a_update_chat(self): + + # Update a chat. + + metadata = {"test": "test"} + res = await a_update_chat(assistant_id=self.assistant_id, chat_id=self.chat_id, metadata=metadata) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chat_keys) + pytest.assume(res_dict["metadata"] == metadata) - await a_delete_chat(assistant_id=self.assistant_id, chat_id=str(chat_id)) + @pytest.mark.run(order=65) + @pytest.mark.asyncio + async def test_a_delete_chat(self): # List chats. - new_chats = await a_list_chats(assistant_id=self.assistant_id) - chat_ids = [i.chat_id for i in new_chats] - pytest.assume(chat_id not in chat_ids) - new_nums = len(new_chats) - pytest.assume(new_nums == old_nums - 1 - index) + chats = await a_list_chats(assistant_id=self.assistant_id) + old_nums = len(chats) + for index, chat in enumerate(chats): + chat_id = chat.chat_id + + # Delete a chat. + + await a_delete_chat(assistant_id=self.assistant_id, chat_id=str(chat_id)) + + # List chats. + + new_chats = await a_list_chats(assistant_id=self.assistant_id) + chat_ids = [i.chat_id for i in new_chats] + pytest.assume(chat_id not in chat_ids) + new_nums = len(new_chats) + pytest.assume(new_nums == old_nums - 1 - index) @pytest.mark.test_async class TestMessage(Base): - message_list = [ - "object", - "assistant_id", - "chat_id", - "message_id", - "role", - "content", - "metadata", - "created_timestamp", - ] + + message_list = ['assistant_id', 'chat_id', 'message_id', 'role', 'content', 'metadata', 'created_timestamp','updated_timestamp'] message_keys = set(message_list) - @pytest.mark.run(order=26) + @pytest.mark.run(order=59) @pytest.mark.asyncio async def test_a_create_message(self): + for x in range(2): + # Create a user message. - text = f"hello test{x}" + text = "hello, what is the weather like in HongKong?" res = await a_create_message(assistant_id=self.assistant_id, chat_id=self.chat_id, text=text) - res_dict = res.to_dict() + res_dict = vars(res) logger.info(res_dict) pytest.assume(res_dict.keys() == self.message_keys) - pytest.assume(res_dict["content"]["text"] == text) + pytest.assume(vars(res_dict["content"])["text"] == text) pytest.assume(res_dict["role"] == "user") + Base.message_id = res.message_id - @pytest.mark.run(order=27) + @pytest.mark.run(order=60) @pytest.mark.asyncio async def test_a_list_messages(self): + # List messages. nums_limit = 1 @@ -253,94 +252,105 @@ async def test_a_list_messages(self): pytest.assume(len(res) == nums_limit) after_id = res[-1].message_id - after_res = await a_list_messages( - limit=nums_limit, after=after_id, assistant_id=self.assistant_id, chat_id=self.chat_id - ) + after_res = await a_list_messages(limit=nums_limit, after=after_id, assistant_id=self.assistant_id, + chat_id=self.chat_id) pytest.assume(len(after_res) == nums_limit) - twice_nums_list = await a_list_messages( - limit=nums_limit * 2, assistant_id=self.assistant_id, chat_id=self.chat_id - ) + twice_nums_list = await a_list_messages(limit=nums_limit * 2, assistant_id=self.assistant_id, + chat_id=self.chat_id) pytest.assume(len(twice_nums_list) == nums_limit * 2) pytest.assume(after_res[-1] == twice_nums_list[-1]) pytest.assume(after_res[0] == twice_nums_list[nums_limit]) before_id = after_res[0].message_id - before_res = await a_list_messages( - limit=nums_limit, before=before_id, assistant_id=self.assistant_id, chat_id=self.chat_id - ) + before_res = await a_list_messages(limit=nums_limit, before=before_id, assistant_id=self.assistant_id, + chat_id=self.chat_id) pytest.assume(len(before_res) == nums_limit) pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=28) + @pytest.mark.run(order=61) @pytest.mark.asyncio - async def test_a_get_message(self, a_message_id): + async def test_a_get_message(self): + # Get a message. - if not Base.message_id: - Base.message_id = await a_message_id res = await a_get_message(assistant_id=self.assistant_id, chat_id=self.chat_id, message_id=self.message_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.message_keys) - @pytest.mark.run(order=29) + @pytest.mark.run(order=62) @pytest.mark.asyncio async def test_a_update_message(self): + # Update a message. metadata = {"test": "test"} - res = await a_update_message( - assistant_id=self.assistant_id, chat_id=self.chat_id, message_id=self.message_id, metadata=metadata - ) - res_dict = res.to_dict() + res = await a_update_message(assistant_id=self.assistant_id, chat_id=self.chat_id, message_id=self.message_id, + metadata=metadata) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.message_keys) pytest.assume(res_dict["metadata"] == metadata) - @pytest.mark.run(order=30) + @pytest.mark.run(order=63) @pytest.mark.asyncio async def test_a_generate_message(self): + # Generate an assistant message. - res = await a_generate_message(assistant_id=self.assistant_id, chat_id=self.chat_id, system_prompt_variables={}) - res_dict = res.to_dict() + res = await a_generate_message(assistant_id=self.assistant_id, chat_id=self.chat_id, + system_prompt_variables={}) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.message_keys) pytest.assume(res_dict["role"] == "assistant") + pytest.assume(res_dict["content"] is not None) + pytest.assume(res_dict["assistant_id"] == self.assistant_id) + pytest.assume(res_dict["chat_id"] == self.chat_id) + pytest.assume(vars(res_dict["content"])["text"] is not None) - @pytest.mark.run(order=30) + @pytest.mark.run(order=64) @pytest.mark.asyncio async def test_a_generate_message_by_stream(self): + + assistant_dict = { + "model_id": Config.chat_completion_model_id, + "name": "test", + "description": "test for assistant", + "memory": AssistantNaiveMemory(), + } + assistant_res = await a_create_assistant(**assistant_dict) + assistant_id = assistant_res.assistant_id # create chat - chat_res = await a_create_chat(assistant_id=self.assistant_id) + chat_res = await a_create_chat(assistant_id=assistant_id) chat_id = chat_res.chat_id - logger.info(f"chat_id:{chat_id}") + logger.info(f'chat_id:{chat_id}') # create user message user_message = await a_create_message( - assistant_id=self.assistant_id, + assistant_id=assistant_id, chat_id=chat_id, - text="count from 1 to 10 and separate numbers by comma.", + text="count from 1 to 100 and separate numbers by comma.", ) # Generate an assistant message by stream. - stream_res = await a_generate_message( - assistant_id=self.assistant_id, chat_id=chat_id, system_prompt_variables={}, stream=True - ) - except_list = [i + 1 for i in range(10)] - real_str = "" + stream_res = await a_generate_message(assistant_id=assistant_id, chat_id=chat_id, + system_prompt_variables={}, stream=True) + except_list = [i + 1 for i in range(100)] + real_list = [] + real_str = '' async for item in stream_res: if isinstance(item, MessageChunk): - logger.debug(f"MessageChunk: {item.delta}") + logger.info(f"MessageChunk: {item.delta}") + if item.delta.isdigit(): + real_list.append(int(item.delta)) real_str += item.delta elif isinstance(item, Message): - logger.debug(f"Message: {item.message_id}") + logger.info(f"Message: {item.message_id}") pytest.assume(item.content is not None) - - real_list = [int(num) for num in re.findall(r"\b\d+\b", real_str)] - logger.debug(f"Message: {real_str}") - logger.debug(f"except_list: {except_list} real_list: {real_list}") + logger.info(f"Message: {real_str}") + logger.info(f"except_list: {except_list} real_list: {real_list}") pytest.assume(set(except_list) == set(real_list)) diff --git a/test/testcase/test_async/test_async_inference.py b/test/testcase/test_async/test_async_inference.py index 249c4fd..7faeb31 100644 --- a/test/testcase/test_async/test_async_inference.py +++ b/test/testcase/test_async/test_async_inference.py @@ -1,24 +1,25 @@ import pytest from taskingai.inference import * -from test.config import embedding_model_id, chat_completion_model_id +from test.config import Config from test.common.logger import logger -import re - +from test.common.utils import assume_text_embedding_result @pytest.mark.test_async class TestChatCompletion: + @pytest.mark.run(order=4) @pytest.mark.asyncio async def test_a_chat_completion(self): + # normal chat completion. normal_res = await a_chat_completion( - model_id=chat_completion_model_id, + model_id=Config.chat_completion_model_id, messages=[ SystemMessage("You are a professional assistant."), UserMessage("Hi"), - ], + ] ) pytest.assume(normal_res.finish_reason == "stop") pytest.assume(normal_res.message.content) @@ -28,13 +29,16 @@ async def test_a_chat_completion(self): # multi round chat completion. multi_round_res = await a_chat_completion( - model_id=chat_completion_model_id, + model_id=Config.chat_completion_model_id, messages=[ SystemMessage("You are a professional assistant."), UserMessage("Hi"), AssistantMessage("Hello! How can I assist you today?"), UserMessage("Can you tell me a joke?"), - ], + AssistantMessage( + "Sure, here is a joke for you: Why don't scientists trust atoms? Because they make up everything!"), + UserMessage("That's funny. Can you tell me another one?"), + ] ) pytest.assume(multi_round_res.finish_reason == "stop") @@ -45,14 +49,19 @@ async def test_a_chat_completion(self): # config max tokens chat completion. max_tokens_res = await a_chat_completion( - model_id=chat_completion_model_id, + model_id=Config.chat_completion_model_id, messages=[ SystemMessage("You are a professional assistant."), UserMessage("Hi"), AssistantMessage("Hello! How can I assist you today?"), UserMessage("Can you tell me a joke?"), + AssistantMessage( + "Sure, here is a joke for you: Why don't scientists trust atoms? Because they make up everything!"), + UserMessage("That's funny. Can you tell me another one?"), ], - configs={"max_tokens": 10}, + configs={ + "max_tokens": 10 + } ) pytest.assume(max_tokens_res.finish_reason == "length") pytest.assume(max_tokens_res.message.content) @@ -61,49 +70,44 @@ async def test_a_chat_completion(self): # chat completion with stream. - stream_res = await a_chat_completion( - model_id=chat_completion_model_id, - messages=[ - SystemMessage("You are a professional assistant."), - UserMessage("count from 1 to 10 and separate numbers by comma."), - ], - stream=True, - ) - except_list = [i + 1 for i in range(10)] - real_str = "" + stream_res = await a_chat_completion(model_id=Config.chat_completion_model_id, + messages=[ + SystemMessage("You are a professional assistant."), + UserMessage("count from 1 to 50 and separate numbers by comma."), + ], + stream=True + ) + except_list = [i + 1 for i in range(50)] + real_list = [] async for item in stream_res: if isinstance(item, ChatCompletionChunk): logger.info(f"Message: {item.delta}") - real_str += item.delta - + if item.delta.isdigit(): + real_list.append(int(item.delta)) elif isinstance(item, ChatCompletion): logger.info(f"Message: {item.finish_reason}") pytest.assume(item.finish_reason == "stop") - - real_list = [int(num) for num in re.findall(r"\b\d+\b", real_str)] pytest.assume(set(except_list) == set(real_list)) @pytest.mark.test_async class TestTextEmbedding: + @pytest.mark.run(order=0) @pytest.mark.asyncio async def test_a_text_embedding(self): + # Text embedding with str. input_str = "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data." - str_res = await a_text_embedding(model_id=embedding_model_id, input=input_str) - pytest.assume(len(str_res) > 0) - for score in str_res: - pytest.assume(float(-1) <= score <= float(1)) + str_res = await a_text_embedding(model_id=Config.text_embedding_model_id, input=input_str) + assume_text_embedding_result(str_res) # Text embedding with str_list. input_list = ["hello", "world"] input_list_length = len(input_list) - list_res = await a_text_embedding(model_id=embedding_model_id, input=input_list) + list_res = await a_text_embedding(model_id=Config.text_embedding_model_id, input=input_list) pytest.assume(len(list_res) == input_list_length) - for str_res in list_res: - pytest.assume(len(str_res) > 0) - for score in str_res: - pytest.assume(float(-1) <= score <= float(1)) + for res in list_res: + assume_text_embedding_result(res) diff --git a/test/testcase/test_async/test_async_retrieval.py b/test/testcase/test_async/test_async_retrieval.py index 045b0d0..6ab4dae 100644 --- a/test/testcase/test_async/test_async_retrieval.py +++ b/test/testcase/test_async/test_async_retrieval.py @@ -1,51 +1,57 @@ import pytest +from taskingai.retrieval import Record, TokenTextSplitter from taskingai.retrieval import * -from test.config import embedding_model_id +from test.config import Config from test.common.logger import logger -from test.testcase.test_async.base import Base +from test.testcase.test_async import Base +from test.common.utils import assume_collection_result, assume_record_result, assume_chunk_result, assume_query_chunk_result @pytest.mark.test_async class TestCollection(Base): - collection_list = [ - "object", - "collection_id", - "name", - "description", - "num_records", - "num_chunks", - "capacity", - "embedding_model_id", - "metadata", - "created_timestamp", - "status", - ] + + collection_list = ["collection_id", + "name", + "description", + "num_records", + "num_chunks", + "capacity", + "embedding_model_id", + "metadata", + "updated_timestamp", + "created_timestamp", + "status"] collection_keys = set(collection_list) - @pytest.mark.run(order=9) + @pytest.mark.run(order=21) @pytest.mark.asyncio async def test_a_create_collection(self): + + # Create a collection. + + create_dict = { + "capacity": 1000, + "embedding_model_id": Config.text_embedding_model_id, + "name": "test", + "description": "description", + "metadata": { + "key1": "value1", + "key2": "value2" + } + } for x in range(2): - # Create a collection. - - name = f"test{x}" - description = "just for test" - res = await a_create_collection( - name=name, description=description, embedding_model_id=embedding_model_id, capacity=1000 - ) - res_dict = res.to_dict() + res = await a_create_collection(**create_dict) + res_dict = vars(res) logger.info(res_dict) pytest.assume(res_dict.keys() == self.collection_keys) - pytest.assume(res_dict["name"] == name) - pytest.assume(res_dict["description"] == description) - pytest.assume(res_dict["embedding_model_id"] == embedding_model_id) - pytest.assume(res_dict["capacity"] == 1000) - pytest.assume((res_dict["status"] == "ready") or (res_dict["status"] == "creating")) + assume_collection_result(create_dict, res_dict) + Base.collection_id = res_dict["collection_id"] - @pytest.mark.run(order=10) + @pytest.mark.run(order=22) @pytest.mark.asyncio async def test_a_list_collections(self): + # List collections. nums_limit = 1 @@ -64,93 +70,101 @@ async def test_a_list_collections(self): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=11) + @pytest.mark.run(order=23) @pytest.mark.asyncio - async def test_a_get_collection(self, a_collection_id): - # Get a collection. + async def test_a_get_collection(self): - if not Base.collection_id: - Base.collection_id = await a_collection_id + # Get a collection. res = await a_get_collection(collection_id=self.collection_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.collection_keys) - pytest.assume(res_dict["status"] == "ready" or res_dict["status"] == "creating") + pytest.assume(res_dict["status"] == "ready") + pytest.assume(res_dict["collection_id"] == self.collection_id) - @pytest.mark.run(order=12) + @pytest.mark.run(order=24) @pytest.mark.asyncio async def test_a_update_collection(self): + # Update a collection. - name = "openai" - description = "test for openai" - res = await a_update_collection(collection_id=self.collection_id, name=name, description=description) - res_dict = res.to_dict() + update_collection_data = { + "collection_id": self.collection_id, + "name": "test_update", + "description": "description_update", + "metadata": { + "key1": "value1", + "key2": "value2" + } + } + res = await a_update_collection(**update_collection_data) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.collection_keys) - pytest.assume(res_dict["name"] == name) - pytest.assume(res_dict["description"] == description) - pytest.assume(res_dict["status"] == "ready") + assume_collection_result(update_collection_data, res_dict) - @pytest.mark.run(order=35) + @pytest.mark.run(order=80) @pytest.mark.asyncio async def test_a_delete_collection(self): # List collections. - old_res = await a_list_collections(order="desc", limit=100, after=None, before=None) - old_nums = len(old_res) + old_res = await a_list_collections(order="desc", limit=100, after=None, before=None) for index, collection in enumerate(old_res): collection_id = collection.collection_id - # Delete a collection + # Delete a collection. await a_delete_collection(collection_id=collection_id) - new_collections = await a_list_collections(order="desc", limit=100, after=None, before=None) - - # List collections + new_collections = await a_list_collections(order="desc", limit=100, after=None, before=None) + # List collections. collection_ids = [c.collection_id for c in new_collections] pytest.assume(collection_id not in collection_ids) - new_nums = len(new_collections) - pytest.assume(new_nums == old_nums - 1 - index) - @pytest.mark.test_async class TestRecord(Base): - record_list = [ - "record_id", - "collection_id", - "num_chunks", - "content", - "metadata", - "type", - "object", - "created_timestamp", - "status", - ] - record_keys = set(record_list) - @pytest.mark.run(order=13) + record_list = ["record_id", + "collection_id", + "num_chunks", + "content", + "metadata", + "type", + "title", + "updated_timestamp", + "created_timestamp", + "status"] + record_keys = set(record_list) + + @pytest.mark.run(order=31) @pytest.mark.asyncio async def test_a_create_record(self): + + text_splitter = TokenTextSplitter(chunk_size=200, chunk_overlap=100) + text = "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data." + create_record_data = { + "collection_id": self.collection_id, + "content": text, + "text_splitter": text_splitter, + "metadata": { + "key1": "value1", + "key2": "value2" + } + } + for x in range(2): - # Create a text record. - - text = f"{x}Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data." - res = await a_create_record( - collection_id=self.collection_id, - content=text, - text_splitter=TokenTextSplitter(chunk_size=200, chunk_overlap=20), - ) - res_dict = res.to_dict() + + # Create a record. + + res = await a_create_record(**create_record_data) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.record_keys) - pytest.assume(res_dict["content"] == text) - pytest.assume((res_dict["status"] == "creating") or (res_dict["status"] == "ready")) + assume_record_result(create_record_data, res_dict) + Base.record_id = res_dict["record_id"] - @pytest.mark.run(order=14) + @pytest.mark.run(order=32) @pytest.mark.asyncio - async def test_a_list_records(self, a_record_id): + async def test_a_list_records(self): + # List records. - if not Base.record_id: - Base.record_id = await a_record_id nums_limit = 1 res = await a_list_records(limit=nums_limit, collection_id=self.collection_id) pytest.assume(len(res) == nums_limit) @@ -170,40 +184,47 @@ async def test_a_list_records(self, a_record_id): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=15) + @pytest.mark.run(order=33) @pytest.mark.asyncio async def test_a_get_record(self): + # Get a record. - records = await a_list_records(collection_id=self.collection_id) - for record in records: - record_id = record.record_id - res = await a_get_record(collection_id=self.collection_id, record_id=record_id) - logger.info(f"a_get_record:{res}") - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.record_keys) - pytest.assume(res_dict["status"] == "ready" or res_dict["status"] == "creating") + res = await a_get_record(collection_id=self.collection_id, record_id=self.record_id) + logger.info(f'a_get_record:{res}') + res_dict = vars(res) + pytest.assume(res_dict["collection_id"] == self.collection_id) + pytest.assume(res_dict["record_id"] == self.record_id) + pytest.assume(res_dict.keys() == self.record_keys) + pytest.assume(res_dict["status"] == "ready") - @pytest.mark.run(order=16) + @pytest.mark.run(order=34) @pytest.mark.asyncio async def test_a_update_record(self): + # Update a record. - metadata = {"test": "test"} - res = await a_update_record(collection_id=self.collection_id, record_id=self.record_id, metadata=metadata) - logger.info(f"a_update_record:{res}") - res_dict = res.to_dict() + update_record_data = { + "collection_id": self.collection_id, + "record_id": self.record_id, + "content": "TaskingAI is an AI-native application development platform that unifies modules like Model, Retrieval, Assistant, and Tool into one seamless ecosystem, streamlining the creation and deployment of applications for developers.", + "text_splitter": TokenTextSplitter(chunk_size=200, chunk_overlap=20), + "metadata": {"test": "test"} + } + res = await a_update_record(**update_record_data) + logger.info(f'a_update_record:{res}') + res_dict = vars(res) pytest.assume(res_dict.keys() == self.record_keys) - pytest.assume(res_dict["metadata"] == metadata) + assume_record_result(update_record_data, res_dict) - @pytest.mark.run(order=34) + @pytest.mark.run(order=79) @pytest.mark.asyncio async def test_a_delete_record(self): + # List records. - records = await a_list_records( - collection_id=self.collection_id, order="desc", limit=20, after=None, before=None - ) + records = await a_list_records(collection_id=self.collection_id, order="desc", limit=20, after=None, + before=None) old_nums = len(records) for index, record in enumerate(records): record_id = record.record_id @@ -214,9 +235,8 @@ async def test_a_delete_record(self): # List records. - new_records = await a_list_records( - collection_id=self.collection_id, order="desc", limit=20, after=None, before=None - ) + new_records = await a_list_records(collection_id=self.collection_id, order="desc", limit=20, after=None, + before=None) record_ids = [record.record_id for record in new_records] pytest.assume(record_id not in record_ids) new_nums = len(new_records) @@ -225,20 +245,116 @@ async def test_a_delete_record(self): @pytest.mark.test_async class TestChunk(Base): - chunk_list = ["chunk_id", "collection_id", "record_id", "object", "content", "score"] + + chunk_list = ["chunk_id", "record_id", "collection_id", "content", "metadata", "num_tokens", "score", "updated_timestamp","created_timestamp"] chunk_keys = set(chunk_list) - @pytest.mark.run(order=17) + @pytest.mark.run(order=41) @pytest.mark.asyncio async def test_a_query_chunks(self): + # Query chunks. query_text = "Machine learning" - top_k = 2 + top_k = 1 res = await a_query_chunks(collection_id=self.collection_id, query_text=query_text, top_k=top_k) pytest.assume(len(res) == top_k) for chunk in res: - chunk_dict = chunk.to_dict() + chunk_dict = vars(chunk) + assume_query_chunk_result(query_text, chunk_dict) pytest.assume(chunk_dict.keys() == self.chunk_keys) - pytest.assume(query_text in chunk_dict["content"]) - pytest.assume(chunk_dict["score"] >= 0) + + @pytest.mark.run(order=42) + @pytest.mark.asyncio + async def test_create_chunk(self): + + # Create a chunk. + create_chunk_data = { + "collection_id": self.collection_id, + "content": "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data."} + res = await a_create_chunk(**create_chunk_data) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chunk_keys) + assume_chunk_result(create_chunk_data, res_dict) + Base.chunk_id = res_dict["chunk_id"] + + @pytest.mark.run(order=43) + @pytest.mark.asyncio + async def test_list_chunks(self): + + # List chunks. + + nums_limit = 1 + res = await a_list_chunks(limit=nums_limit, collection_id=self.collection_id) + pytest.assume(len(res) == nums_limit) + + after_id = res[-1].chunk_id + after_res = await a_list_chunks(limit=nums_limit, after=after_id, collection_id=self.collection_id) + pytest.assume(len(after_res) == nums_limit) + + twice_nums_list = await a_list_chunks(limit=nums_limit * 2, collection_id=self.collection_id) + pytest.assume(len(twice_nums_list) == nums_limit * 2) + pytest.assume(after_res[-1] == twice_nums_list[-1]) + pytest.assume(after_res[0] == twice_nums_list[nums_limit]) + + before_id = after_res[0].chunk_id + before_res = await a_list_chunks(limit=nums_limit, before=before_id, collection_id=self.collection_id) + pytest.assume(len(before_res) == nums_limit) + pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) + pytest.assume(before_res[0] == twice_nums_list[0]) + + @pytest.mark.run(order=44) + @pytest.mark.asyncio + async def test_get_chunk(self): + + # list chunks + + chunks = list_chunks(collection_id=self.collection_id) + for chunk in chunks: + chunk_id = chunk.chunk_id + res = get_chunk(collection_id=self.collection_id, chunk_id=chunk_id) + logger.info(f'get chunk response: {res}') + res_dict = vars(res) + pytest.assume(res_dict["collection_id"] == self.collection_id) + pytest.assume(res_dict["chunk_id"] == chunk_id) + pytest.assume(res_dict.keys() == self.chunk_keys) + + @pytest.mark.run(order=45) + @pytest.mark.asyncio + async def test_update_chunk(self): + + # Update a chunk. + + update_chunk_data = { + "collection_id": self.collection_id, + "chunk_id": self.chunk_id, + "content": "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data.", + "metadata": {"test": "test"} + } + res = await a_update_chunk(**update_chunk_data) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chunk_keys) + assume_chunk_result(update_chunk_data, res_dict) + + @pytest.mark.run(order=46) + @pytest.mark.asyncio + async def test_delete_chunk(self): + + # List chunks. + + chunks = await a_list_chunks(collection_id=self.collection_id) + old_nums = len(chunks) + for index, chunk in enumerate(chunks): + chunk_id = chunk.chunk_id + + # Delete a chunk. + + delete_chunk(collection_id=self.collection_id, chunk_id=chunk_id) + + # List chunks. + + new_chunks = list_chunks(collection_id=self.collection_id) + chunk_ids = [chunk.chunk_id for chunk in new_chunks] + pytest.assume(chunk_id not in chunk_ids) + new_nums = len(new_chunks) + pytest.assume(new_nums == old_nums - 1 - index) diff --git a/test/testcase/test_async/test_async_tool.py b/test/testcase/test_async/test_async_tool.py index 604d428..7428d97 100644 --- a/test/testcase/test_async/test_async_tool.py +++ b/test/testcase/test_async/test_async_tool.py @@ -1,115 +1,85 @@ import pytest -from taskingai.tool import ( - a_bulk_create_actions, - a_get_action, - a_update_action, - a_delete_action, - a_run_action, - a_list_actions, -) +from taskingai.tool import a_bulk_create_actions, a_get_action, a_update_action, a_delete_action, a_run_action, a_list_actions from test.common.logger import logger -from test.testcase.test_async.base import Base +from test.testcase.test_async import Base +from test.config import * @pytest.mark.test_async class TestAction(Base): - action_list = [ - "object", - "action_id", - "name", - "description", - "authentication", - "openapi_schema", - "created_timestamp", - ] + + action_list = ['action_id', "operation_id", 'name', 'description', "url", "method", "path_param_schema", + "query_param_schema", "body_param_schema", "body_type", "function_def", 'authentication', + 'openapi_schema', 'created_timestamp', 'updated_timestamp'] action_keys = set(action_list) - action_schema = ["openapi", "info", "servers", "paths", "components", "security"] - action_schema_keys = set(action_schema) - openapi_schema = { - "openapi": "3.1.0", - "info": { - "title": "Get weather data", - "description": "Retrieves current weather data for a location.", - "version": "v1.0.0", - }, - "servers": [{"url": "https://weather.example.com"}], - "paths": { - "/location": { - "get": { - "description": "Get temperature for a specific location", - "operationId": "GetCurrentWeather", - "parameters": [ - { - "name": "location", - "in": "query", - "description": "The city and state to retrieve the weather for", - "required": True, - "schema": {"type": "string"}, - } - ], - "deprecated": False, - }, - "post": { - "description": "UPDATE temperature for a specific location", - "operationId": "UpdateCurrentWeather", - "requestBody": { - "required": True, - "content": { - "application/json": {"schema": {"$ref": "#/componeents/schemas/ActionCreateRequest"}} - }, - }, - "deprecated": False, - }, - } - }, - "components": {"schemas": {}}, - "security": [], - } - - @pytest.mark.run(order=4) - @pytest.mark.asyncio - async def test_a_bulk_create_actions(self): - # Create an action. + action_authentication = ['type', 'secret', 'content'] + action_authentication_keys = set(action_authentication) + action_openapi_schema = ['openapi', 'info', 'servers', 'paths', 'components', 'security'] + action_openapi_schema_keys = set(action_openapi_schema) + schema = { + "openapi_schema": { + "openapi": "3.1.0", + "info": { + "title": "Get weather data", + "description": "Retrieves current weather data for a location.", + "version": "v1.0.0" + }, + "servers": [ + { + "url": "https://weather.example.com" + } + ], + "paths": { + "/location": { + "get": { + "description": "Get temperature for a specific location 123", + "operationId": "GetCurrentWeather123", + "parameters": [ + { + "name": "location", + "in": "query", + "description": "The city and state to retrieve the weather for", + "required": True, + "schema": { + "type": "string" + } + } + ], + "deprecated": False + } + } + } + + }, + "authentication": { + "type": "bearer", + "secret": "ASD213dfslkfa12" + } + } - res = await a_bulk_create_actions(openapi_schema=self.openapi_schema) - for action in res: - action_dict = action.to_dict() - logger.info(action_dict) - pytest.assume(action_dict.keys() == self.action_keys) - pytest.assume(action_dict["openapi_schema"].keys() == self.action_schema_keys) - - for key in action_dict["openapi_schema"].keys(): - if key == "paths": - if action_dict["openapi_schema"][key]["/location"] == "get": - pytest.assume( - action_dict["openapi_schema"][key]["/location"]["get"] - == self.openapi_schema["paths"]["/location"]["get"] - ) - elif action_dict["openapi_schema"][key]["/location"] == "post": - pytest.assume( - action_dict["openapi_schema"][key]["/location"]["post"] - == self.openapi_schema["paths"]["/location"]["post"] - ) - else: - pytest.assume(action_dict["openapi_schema"][key] == self.openapi_schema[key]) - - @pytest.mark.run(order=5) + @pytest.mark.run(order=11) @pytest.mark.asyncio - async def test_a_run_action(self, a_action_id): - # Run an action. - - if not Base.action_id: - Base.action_id = await a_action_id - parameters = {"location": "tokyo"} - res = await a_run_action(action_id=self.action_id, parameters=parameters) - logger.info(f"async run action{res}") - pytest.assume(res["status"] != 200) - pytest.assume(res["error"]) + async def test_a_bulk_create_actions(self): - @pytest.mark.run(order=6) + # Create an action. + for i in range(2): + res = await a_bulk_create_actions(**self.schema) + for action in res: + action_dict = vars(action) + logger.info(action_dict) + pytest.assume(action_dict.keys() == self.action_keys) + pytest.assume(action_dict["openapi_schema"].keys() == self.action_openapi_schema_keys) + for key in self.schema["openapi_schema"].keys(): + pytest.assume(action_dict["openapi_schema"][key] == self.schema["openapi_schema"][key]) + assert set(vars(action_dict.get("authentication")).keys()).issubset( + TestAction.action_authentication_keys) + Base.action_id = res[0].action_id + + @pytest.mark.run(order=12) @pytest.mark.asyncio async def test_a_list_actions(self): + # List actions. nums_limit = 1 @@ -128,64 +98,111 @@ async def test_a_list_actions(self): before_id = after_res[0].action_id before_res = await a_list_actions(limit=nums_limit, before=before_id) pytest.assume(len(before_res) == nums_limit) - pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) + pytest.assume(before_res[-1] == twice_nums_list[nums_limit-1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=7) + @pytest.mark.run(order=13) @pytest.mark.asyncio async def test_a_get_action(self): + # Get an action. res = await a_get_action(action_id=self.action_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.action_keys) - pytest.assume(res_dict["openapi_schema"].keys() == self.action_schema_keys) + logger.info(res_dict["openapi_schema"].keys()) + pytest.assume(res_dict["openapi_schema"].keys() == self.action_openapi_schema_keys) + pytest.assume(res_dict["action_id"] == self.action_id) + pytest.assume(vars(res_dict["authentication"]).keys() == self.action_authentication_keys) - @pytest.mark.run(order=39) + @pytest.mark.run(order=14) @pytest.mark.asyncio async def test_a_update_action(self): + # Update an action. update_schema = { - "openapi": "3.1.0", - "info": { - "title": "Get weather data", - "description": "Retrieves current weather data for a location.", - "version": "v1.0.0", - }, - "servers": [{"url": "https://weather.example.com"}], - "paths": { - "/location": { - "get": { - "description": "Get temperature for a specific location by get method", - "operationId": "GetCurrentWeather", - "parameters": [ - { - "name": "location", - "in": "query", - "description": "The city and state to retrieve the weather for", - "required": True, - "schema": {"type": "string"}, + "openapi_schema": { + "openapi": "3.0.0", + "info": { + "title": "Numbers API", + "version": "1.0.0", + "description": "API for fetching interesting number facts" + }, + "servers": [ + { + "url": "http://numbersapi.com" + } + ], + "paths": { + "/{number}": { + "get": { + "description": "Get fact about a number", + "operationId": "get_number_fact", + "parameters": [ + { + "name": "number", + "in": "path", + "required": True, + "description": "The number to get the fact for", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "A fact about the number", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + } + } + } + } + } } - ], - "deprecated": False, } - } - }, - "components": {"schemas": {}}, - "security": [], - } - res = await a_update_action(action_id=self.action_id, openapi_schema=update_schema) - res_dict = res.to_dict() + res = await a_update_action(action_id=self.action_id, **update_schema) + res_dict = vars(res) logger.info(res_dict) pytest.assume(res_dict.keys() == self.action_keys) - pytest.assume(res_dict["openapi_schema"].keys() == self.action_schema_keys) - pytest.assume(res_dict["openapi_schema"] == update_schema) + for key in update_schema.keys(): + if key != "authentication": + for k, v in update_schema[key].items(): + pytest.assume(res_dict[key][k] == v) + assert set(res_dict.get(key).keys()).issubset(getattr(TestAction, f"action_{key}_keys")) + else: + assert set(vars(res_dict.get(key)).keys()).issubset(getattr(TestAction, f"action_{key}_keys")) + for k, v in update_schema[key].items(): + if k == "type": + pytest.assume(vars(res_dict[key])[k] == v) + else: + pytest.assume("*" in vars(res_dict[key])[k]) + + @pytest.mark.run(order=15) + @pytest.mark.asyncio + async def test_a_run_action(self): - @pytest.mark.run(order=40) + # Run an action. + + parameters = { + "number": 42 + } + res = await a_run_action(action_id=self.action_id, parameters=parameters) + logger.info(f'async run action{res}') + pytest.assume(res['status'] == 200) + pytest.assume(res["data"]) + + @pytest.mark.run(order=80) @pytest.mark.asyncio async def test_a_delete_action(self): + # List actions. actions = await a_list_actions(limit=100) @@ -203,3 +220,7 @@ async def test_a_delete_action(self): pytest.assume(action_id not in action_ids) new_nums = len(new_actions) pytest.assume(new_nums == old_nums - 1 - index) + + + + diff --git a/test/testcase/test_sync/conftest.py b/test/testcase/test_sync/conftest.py index f8d1d69..dbaa555 100644 --- a/test/testcase/test_sync/conftest.py +++ b/test/testcase/test_sync/conftest.py @@ -1,6 +1,6 @@ import pytest -from taskingai.retrieval import list_collections, list_records +from taskingai.retrieval import list_collections, list_records, list_chunks from taskingai.assistant import list_assistants, list_chats, list_messages from taskingai.tool import list_actions @@ -40,6 +40,13 @@ def record_id(collection_id): return record_id +@pytest.fixture(scope="session") +def chunk_id(collection_id): + res = list_chunks(str(collection_id)) + chunk_id = res[0].chunk_id + return chunk_id + + @pytest.fixture(scope="session") def action_id(): res = list_actions() diff --git a/test/testcase/test_sync/test_sync_assistant.py b/test/testcase/test_sync/test_sync_assistant.py index 854617a..dde7382 100644 --- a/test/testcase/test_sync/test_sync_assistant.py +++ b/test/testcase/test_sync/test_sync_assistant.py @@ -1,65 +1,58 @@ import pytest from taskingai.assistant import * -from taskingai.retrieval import * -from taskingai.tool import * +from taskingai.client.models import ToolRef, ToolType, RetrievalRef, RetrievalType from taskingai.assistant.memory import AssistantNaiveMemory -from test.config import chat_completion_model_id -from test.common.read_data import data +from test.config import Config from test.common.logger import logger -from test.common.utils import list_to_dict -from test.common.utils import assume_assistant -import re - - -assistant_data = data.load_yaml("test_assistant_data.yml") +from test.common.utils import assume_assistant_result, assume_chat_result, assume_message_result @pytest.mark.test_sync class TestAssistant: - assistant_list = [ - "assistant_id", - "created_timestamp", - "description", - "metadata", - "model_id", - "name", - "object", - "retrievals", - "system_prompt_template", - "tools", - "memory", - ] + + assistant_list = ['assistant_id', 'updated_timestamp','created_timestamp', 'description', 'metadata', 'model_id', 'name', 'retrievals', 'retrieval_configs', 'system_prompt_template', 'tools',"memory"] assistant_keys = set(assistant_list) - @pytest.mark.parametrize("create_assistant_data", assistant_data["test_success_create_assistant"]) - @pytest.mark.run(order=18) - def test_create_assistant(self, collection_id, action_id, create_assistant_data): - # Create an assistant. + @pytest.mark.run(order=51) + def test_create_assistant(self, collection_id, action_id): - assistant_dict = list_to_dict(create_assistant_data) - assistant_dict.update({"model_id": chat_completion_model_id}) - if ( - "retrievals" in assistant_dict.keys() - and len(assistant_dict["retrievals"]) > 0 - and assistant_dict["retrievals"][0]["type"] == "collection" - ): - assistant_dict["retrievals"][0]["id"] = collection_id - if ( - "tools" in assistant_dict.keys() - and len(assistant_dict["tools"]) > 0 - and assistant_dict["tools"][0]["type"] == "action" - ): - assistant_dict["tools"][0]["id"] = action_id - assistant_dict.update({"memory": AssistantNaiveMemory()}) - res = create_assistant(**assistant_dict) - res_dict = res.to_dict() - logger.info(f"response_dict:{res_dict}, except_dict:{assistant_dict}") - pytest.assume(res_dict.keys() == self.assistant_keys) - assume_assistant(res_dict, assistant_dict) + # Create an assistant. - @pytest.mark.run(order=19) + assistant_dict = { + "model_id": Config.chat_completion_model_id, + "name": "test", + "description": "test for assistant", + "memory": AssistantNaiveMemory(), + "system_prompt_template": ["You know the meaning of various numbers.","No matter what the user's language is, you will use the {{langugae}} to explain."], + "metadata": {"test": "test"}, + "retrievals": [ + RetrievalRef( + type=RetrievalType.COLLECTION, + id=collection_id, + ), + ], + "tools": [ + ToolRef( + type=ToolType.ACTION, + id=action_id, + ), + ToolRef( + type=ToolType.PLUGIN, + id="open_weather/get_hourly_forecast", + ) + ] + } + for i in range(4): + res = create_assistant(**assistant_dict) + res_dict = vars(res) + logger.info(f'response_dict:{res_dict}, except_dict:{assistant_dict}') + pytest.assume(res_dict.keys() == self.assistant_keys) + assume_assistant_result(assistant_dict, res_dict) + + @pytest.mark.run(order=52) def test_list_assistants(self): + # List assistants. nums_limit = 1 @@ -81,28 +74,31 @@ def test_list_assistants(self): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=20) + @pytest.mark.run(order=53) def test_get_assistant(self, assistant_id): + # Get an assistant. res = get_assistant(assistant_id=assistant_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.assistant_keys) - @pytest.mark.run(order=21) + @pytest.mark.run(order=54) def test_update_assistant(self, assistant_id): + # Update an assistant. name = "openai" description = "test for openai" res = update_assistant(assistant_id=assistant_id, name=name, description=description) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.assistant_keys) pytest.assume(res_dict["name"] == name) pytest.assume(res_dict["description"] == description) - @pytest.mark.run(order=33) + @pytest.mark.run(order=66) def test_delete_assistant(self): + # List assistants. assistants = list_assistants(limit=100) @@ -125,163 +121,179 @@ def test_delete_assistant(self): @pytest.mark.test_sync class TestChat: - chat_list = ["assistant_id", "chat_id", "created_timestamp", "metadata", "object"] - chat_keys = set(chat_list) - @pytest.mark.run(order=22) - def test_create_chat(self, assistant_id): - for x in range(2): - # Create a chat. + chat_list = ['assistant_id', 'chat_id', 'created_timestamp', 'updated_timestamp', 'metadata'] + chat_keys = set(chat_list) - res = create_chat(assistant_id=assistant_id) - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.chat_keys) + @pytest.mark.run(order=55) + def test_create_chat(self, assistant_id): - @pytest.mark.run(order=23) - def test_list_chats(self, assistant_id): - # List chats. + for x in range(2): - nums_limit = 1 - res = list_chats(limit=nums_limit, assistant_id=assistant_id) - pytest.assume(len(res) == nums_limit) + # Create a chat. - after_id = res[-1].chat_id - after_res = list_chats(limit=nums_limit, after=after_id, assistant_id=assistant_id) - pytest.assume(len(after_res) == nums_limit) + res = create_chat(assistant_id=assistant_id) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chat_keys) - twice_nums_list = list_chats(limit=nums_limit * 2, assistant_id=assistant_id) - pytest.assume(len(twice_nums_list) == nums_limit * 2) - pytest.assume(after_res[-1] == twice_nums_list[-1]) - pytest.assume(after_res[0] == twice_nums_list[nums_limit]) + @pytest.mark.run(order=56) + def test_list_chats(self, assistant_id): - before_id = after_res[0].chat_id - before_res = list_chats(limit=nums_limit, before=before_id, assistant_id=assistant_id) - pytest.assume(len(before_res) == nums_limit) - pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) - pytest.assume(before_res[0] == twice_nums_list[0]) + # List chats. - @pytest.mark.run(order=24) - def test_get_chat(self, assistant_id, chat_id): - # Get a chat. + nums_limit = 1 + res = list_chats(limit=nums_limit, assistant_id=assistant_id) + pytest.assume(len(res) == nums_limit) - res = get_chat(assistant_id=assistant_id, chat_id=chat_id) - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.chat_keys) + after_id = res[-1].chat_id + after_res = list_chats(limit=nums_limit, after=after_id, assistant_id=assistant_id) + pytest.assume(len(after_res) == nums_limit) - @pytest.mark.run(order=25) - def test_update_chat(self, assistant_id, chat_id): - # Update a chat. + twice_nums_list = list_chats(limit=nums_limit * 2, assistant_id=assistant_id) + pytest.assume(len(twice_nums_list) == nums_limit * 2) + pytest.assume(after_res[-1] == twice_nums_list[-1]) + pytest.assume(after_res[0] == twice_nums_list[nums_limit]) - metadata = {"test": "test"} - res = update_chat(assistant_id=assistant_id, chat_id=chat_id, metadata=metadata) - res_dict = res.to_dict() - pytest.assume(res_dict.keys() == self.chat_keys) - pytest.assume(res_dict["metadata"] == metadata) + before_id = after_res[0].chat_id + before_res = list_chats(limit=nums_limit, before=before_id, assistant_id=assistant_id) + pytest.assume(len(before_res) == nums_limit) + pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) + pytest.assume(before_res[0] == twice_nums_list[0]) + + @pytest.mark.run(order=57) + def test_get_chat(self, assistant_id, chat_id): + + # Get a chat. - @pytest.mark.run(order=32) - def test_delete_chat(self, assistant_id): - # List chats. + res = get_chat(assistant_id=assistant_id, chat_id=chat_id) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chat_keys) + + @pytest.mark.run(order=58) + def test_update_chat(self, assistant_id, chat_id): - chats = list_chats(assistant_id=assistant_id) - old_nums = len(chats) - for index, chat in enumerate(chats): - chat_id = chat.chat_id + # Update a chat. - # Delete a chat. + metadata = {"test": "test"} + res = update_chat(assistant_id=assistant_id, chat_id=chat_id, metadata=metadata) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chat_keys) + pytest.assume(res_dict["metadata"] == metadata) - delete_chat(assistant_id=assistant_id, chat_id=str(chat_id)) + @pytest.mark.run(order=65) + def test_delete_chat(self, assistant_id): # List chats. - new_chats = list_chats(assistant_id=assistant_id) - chat_ids = [i.chat_id for i in new_chats] - pytest.assume(chat_id not in chat_ids) - new_nums = len(new_chats) - pytest.assume(new_nums == old_nums - 1 - index) + chats = list_chats(assistant_id=assistant_id) + old_nums = len(chats) + for index, chat in enumerate(chats): + chat_id = chat.chat_id + + # Delete a chat. + + delete_chat(assistant_id=assistant_id, chat_id=str(chat_id)) + + # List chats. + + new_chats = list_chats(assistant_id=assistant_id) + chat_ids = [i.chat_id for i in new_chats] + pytest.assume(chat_id not in chat_ids) + new_nums = len(new_chats) + pytest.assume(new_nums == old_nums - 1 - index) @pytest.mark.test_sync class TestMessage: - message_list = [ - "object", - "assistant_id", - "chat_id", - "message_id", - "role", - "content", - "metadata", - "created_timestamp", - ] + + message_list = ['assistant_id', 'chat_id', 'message_id', 'role', 'content', 'metadata', 'created_timestamp','updated_timestamp'] message_keys = set(message_list) - @pytest.mark.run(order=26) + @pytest.mark.run(order=59) def test_create_message(self, assistant_id, chat_id): + for x in range(2): + # Create a user message. - text = "hello" + text = "hello, what is the weather like in HongKong?" res = create_message(assistant_id=assistant_id, chat_id=chat_id, text=text) - res_dict = res.to_dict() + res_dict = vars(res) logger.info(res_dict) pytest.assume(res_dict.keys() == self.message_keys) - pytest.assume(res_dict["content"]["text"] == text) + pytest.assume(vars(res_dict["content"])["text"] == text) pytest.assume(res_dict["role"] == "user") - @pytest.mark.run(order=27) + @pytest.mark.run(order=60) def test_list_messages(self, assistant_id, chat_id): + # List messages. nums_limit = 1 res = list_messages(limit=nums_limit, assistant_id=assistant_id, chat_id=chat_id) pytest.assume(len(res) == nums_limit) after_id = res[-1].message_id - after_res = list_messages(limit=nums_limit, after=after_id, assistant_id=assistant_id, chat_id=chat_id) + after_res = list_messages(limit=nums_limit, after=after_id, assistant_id=assistant_id, + chat_id=chat_id) pytest.assume(len(after_res) == nums_limit) - twice_nums_list = list_messages(limit=nums_limit * 2, assistant_id=assistant_id, chat_id=chat_id) + twice_nums_list = list_messages(limit=nums_limit * 2, assistant_id=assistant_id, + chat_id=chat_id) pytest.assume(len(twice_nums_list) == nums_limit * 2) pytest.assume(after_res[-1] == twice_nums_list[-1]) pytest.assume(after_res[0] == twice_nums_list[nums_limit]) before_id = after_res[0].message_id - before_res = list_messages(limit=nums_limit, before=before_id, assistant_id=assistant_id, chat_id=chat_id) + before_res = list_messages(limit=nums_limit, before=before_id, assistant_id=assistant_id, + chat_id=chat_id) pytest.assume(len(before_res) == nums_limit) pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=28) + @pytest.mark.run(order=61) def test_get_message(self, assistant_id, chat_id, message_id): + # Get a message. res = get_message(assistant_id=assistant_id, chat_id=chat_id, message_id=message_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.message_keys) - @pytest.mark.run(order=29) + @pytest.mark.run(order=62) def test_update_message(self, assistant_id, chat_id, message_id): + # Update a message. metadata = {"test": "test"} res = update_message(assistant_id=assistant_id, chat_id=chat_id, message_id=message_id, metadata=metadata) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.message_keys) pytest.assume(res_dict["metadata"] == metadata) - @pytest.mark.run(order=30) + @pytest.mark.run(order=63) def test_generate_message(self, assistant_id, chat_id): + # Generate an assistant message by no stream. res = generate_message(assistant_id=assistant_id, chat_id=chat_id, system_prompt_variables={}) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.message_keys) pytest.assume(res_dict["role"] == "assistant") + pytest.assume(res_dict["content"] is not None) + pytest.assume(res_dict["assistant_id"] == assistant_id) + pytest.assume(res_dict["chat_id"] == chat_id) + pytest.assume(vars(res_dict["content"])["text"] is not None) - @pytest.mark.run(order=30) + @pytest.mark.run(order=64) def test_generate_message_by_stream(self): - # List assistants. - - assistants = list_assistants() - assistant_id = assistants[-1].assistant_id - logger.info(f"assistant_id: {assistant_id}") + # Create an assistant. + assistant_dict = { + "model_id": Config.chat_completion_model_id, + "name": "test", + "description": "test for assistant", + "memory": AssistantNaiveMemory(), + } + assistant_res = create_assistant(**assistant_dict) + assistant_id = assistant_res.assistant_id # create chat chat_res = create_chat(assistant_id=assistant_id) @@ -291,26 +303,23 @@ def test_generate_message_by_stream(self): # create user message user_message: Message = create_message( - assistant_id=assistant_id, chat_id=chat_id, text="count from 1 to 10 and separate numbers by comma." - ) + assistant_id=assistant_id, + chat_id=chat_id, + text="count from 1 to 100 and separate numbers by comma.") # Generate an assistant message by stream. - stream_res = generate_message( - assistant_id=assistant_id, chat_id=chat_id, system_prompt_variables={}, stream=True - ) - except_list = [i + 1 for i in range(10)] - real_str = "" + stream_res = generate_message(assistant_id=assistant_id, chat_id=chat_id, system_prompt_variables={}, stream=True) + except_list = [i + 1 for i in range(100)] + real_list = [] for item in stream_res: if isinstance(item, MessageChunk): - logger.debug(f"MessageChunk: {item.delta}") - real_str += item.delta - + logger.info(f"MessageChunk: {item.delta}") + if item.delta.isdigit(): + real_list.append(int(item.delta)) elif isinstance(item, Message): - logger.debug(f"Message: {item.message_id}") + logger.info(f"Message: {item.message_id}") pytest.assume(item.content is not None) - - real_list = [int(num) for num in re.findall(r"\b\d+\b", real_str)] - logger.debug(f"Message: {real_str}") - logger.debug(f"except_list: {except_list} real_list: {real_list}") + logger.info(f"except_list: {except_list} real_list: {real_list}") pytest.assume(set(except_list) == set(real_list)) + diff --git a/test/testcase/test_sync/test_sync_inference.py b/test/testcase/test_sync/test_sync_inference.py index 55e42be..09374be 100644 --- a/test/testcase/test_sync/test_sync_inference.py +++ b/test/testcase/test_sync/test_sync_inference.py @@ -1,23 +1,24 @@ import pytest - from taskingai.inference import * -from test.config import embedding_model_id, chat_completion_model_id +from test.config import Config from test.common.logger import logger -import re +from test.common.utils import assume_text_embedding_result @pytest.mark.test_sync class TestChatCompletion: + @pytest.mark.run(order=1) def test_chat_completion(self): + # normal chat completion. normal_res = chat_completion( - model_id=chat_completion_model_id, + model_id=Config.chat_completion_model_id, messages=[ SystemMessage("You are a professional assistant."), UserMessage("Hi"), - ], + ] ) pytest.assume(normal_res.finish_reason == "stop") pytest.assume(normal_res.message.content) @@ -27,13 +28,16 @@ def test_chat_completion(self): # multi round chat completion. multi_round_res = chat_completion( - model_id=chat_completion_model_id, + model_id=Config.chat_completion_model_id, messages=[ SystemMessage("You are a professional assistant."), UserMessage("Hi"), AssistantMessage("Hello! How can I assist you today?"), UserMessage("Can you tell me a joke?"), - ], + AssistantMessage( + "Sure, here is a joke for you: Why don't scientists trust atoms? Because they make up everything!"), + UserMessage("That's funny. Can you tell me another one?"), + ] ) pytest.assume(multi_round_res.finish_reason == "stop") @@ -44,14 +48,19 @@ def test_chat_completion(self): # config max tokens chat completion. max_tokens_res = chat_completion( - model_id=chat_completion_model_id, + model_id=Config.chat_completion_model_id, messages=[ SystemMessage("You are a professional assistant."), UserMessage("Hi"), AssistantMessage("Hello! How can I assist you today?"), UserMessage("Can you tell me a joke?"), + AssistantMessage( + "Sure, here is a joke for you: Why don't scientists trust atoms? Because they make up everything!"), + UserMessage("That's funny. Can you tell me another one?"), ], - configs={"max_tokens": 10}, + configs={ + "max_tokens": 10 + } ) pytest.assume(max_tokens_res.finish_reason == "length") pytest.assume(max_tokens_res.message.content) @@ -60,47 +69,44 @@ def test_chat_completion(self): # chat completion with stream. - stream_res = chat_completion( - model_id=chat_completion_model_id, - messages=[ - SystemMessage("You are a professional assistant."), - UserMessage("count from 1 to 10 and separate numbers by comma."), - ], - stream=True, - ) - except_list = [i + 1 for i in range(10)] - real_str = "" + stream_res = chat_completion(model_id=Config.chat_completion_model_id, + messages=[ + SystemMessage("You are a professional assistant."), + UserMessage("count from 1 to 50 and separate numbers by comma."), + ], + stream=True + ) + except_list = [i+1 for i in range(50)] + real_list = [] for item in stream_res: if isinstance(item, ChatCompletionChunk): logger.info(f"Message: {item.delta}") - real_str += item.delta + if item.delta.isdigit(): + real_list.append(int(item.delta)) elif isinstance(item, ChatCompletion): logger.info(f"Message: {item.finish_reason}") pytest.assume(item.finish_reason == "stop") - - real_list = [int(num) for num in re.findall(r"\b\d+\b", real_str)] + logger.info(f"except_list: {except_list} real_list: {real_list}") pytest.assume(set(except_list) == set(real_list)) @pytest.mark.test_sync class TestTextEmbedding: + @pytest.mark.run(order=0) def test_text_embedding(self): + # Text embedding with str. input_str = "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data." - str_res = text_embedding(model_id=embedding_model_id, input=input_str) - pytest.assume(len(str_res) > 0) - for score in str_res: - pytest.assume(float(-1) <= score <= float(1)) + str_res = text_embedding(model_id=Config.text_embedding_model_id, input=input_str) + assume_text_embedding_result(str_res) # Text embedding with str_list. input_list = ["hello", "world"] input_list_length = len(input_list) - list_res = text_embedding(model_id=embedding_model_id, input=input_list) + list_res = text_embedding(model_id=Config.text_embedding_model_id, input=input_list) pytest.assume(len(list_res) == input_list_length) - for str_res in list_res: - pytest.assume(len(str_res) > 0) - for score in str_res: - pytest.assume(float(-1) <= score <= float(1)) + for res in list_res: + assume_text_embedding_result(res) diff --git a/test/testcase/test_sync/test_sync_retrieval.py b/test/testcase/test_sync/test_sync_retrieval.py index 34fd3f6..d2e4b81 100644 --- a/test/testcase/test_sync/test_sync_retrieval.py +++ b/test/testcase/test_sync/test_sync_retrieval.py @@ -1,47 +1,52 @@ import pytest -from taskingai.retrieval import * -from test.config import embedding_model_id +from taskingai.retrieval import Record, TokenTextSplitter +from taskingai.retrieval import list_collections, create_collection, get_collection, update_collection, delete_collection, list_records, create_record, get_record, update_record, delete_record, query_chunks, create_chunk, update_chunk, get_chunk, delete_chunk, list_chunks +from test.config import Config from test.common.logger import logger +from test.common.utils import assume_collection_result, assume_record_result, assume_chunk_result, assume_query_chunk_result @pytest.mark.test_sync class TestCollection: - collection_list = [ - "object", - "collection_id", - "name", - "description", - "num_records", - "num_chunks", - "capacity", - "embedding_model_id", - "metadata", - "created_timestamp", - "status", - ] + + collection_list = ["collection_id", + "name", + "description", + "num_records", + "num_chunks", + "capacity", + "embedding_model_id", + "metadata", + "updated_timestamp", + "created_timestamp", + "status"] collection_keys = set(collection_list) - @pytest.mark.run(order=9) + @pytest.mark.run(order=21) def test_create_collection(self): + # Create a collection. - name = "test" - description = "just for test" + create_dict = { + "capacity": 1000, + "embedding_model_id": Config.text_embedding_model_id, + "name": "test", + "description": "description", + "metadata": { + "key1": "value1", + "key2": "value2" + } + } for x in range(2): - res = create_collection( - name=name, description=description, embedding_model_id=embedding_model_id, capacity=1000 - ) - res_dict = res.to_dict() + res = create_collection(**create_dict) + res_dict = vars(res) logger.info(res_dict) pytest.assume(res_dict.keys() == self.collection_keys) - pytest.assume(res_dict["name"] == name) - pytest.assume(res_dict["description"] == description) - pytest.assume(res_dict["embedding_model_id"] == embedding_model_id) - pytest.assume(res_dict["capacity"] == 1000) - pytest.assume((res_dict["status"] == "ready") or (res_dict["status"] == "creating")) + assume_collection_result(create_dict, res_dict) - @pytest.mark.run(order=10) + @pytest.mark.run(order=22) def test_list_collections(self): + # List collections. nums_limit = 1 @@ -60,42 +65,52 @@ def test_list_collections(self): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=11) + @pytest.mark.run(order=23) def test_get_collection(self, collection_id): + # Get a collection. res = get_collection(collection_id=collection_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.collection_keys) - pytest.assume(res_dict["status"] == "ready" or res_dict["status"] == "creating") + pytest.assume(res_dict["status"] == "ready") + pytest.assume(res_dict["collection_id"] == collection_id) - @pytest.mark.run(order=12) + @pytest.mark.run(order=24) def test_update_collection(self, collection_id): + # Update a collection. - name = "openai" - description = "test for openai" - res = update_collection(collection_id=collection_id, name=name, description=description) - res_dict = res.to_dict() + update_collection_data = { + "collection_id": collection_id, + "name": "test_update", + "description": "description_update", + "metadata": { + "key1": "value1", + "key2": "value2" + } + } + res = update_collection(**update_collection_data) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.collection_keys) - pytest.assume(res_dict["name"] == name) - pytest.assume(res_dict["description"] == description) - pytest.assume(res_dict["status"] == "ready") + assume_collection_result(update_collection_data, res_dict) - @pytest.mark.run(order=35) + @pytest.mark.run(order=80) def test_delete_collection(self): + # List collections. - old_res = list_collections(order="desc", limit=100, after=None, before=None) + old_res = list_collections(order="desc", limit=100, after=None, before=None) old_nums = len(old_res) for index, collection in enumerate(old_res): collection_id = collection.collection_id # Delete a collection. + delete_collection(collection_id=collection_id) - new_collections = list_collections(order="desc", limit=100, after=None, before=None) + new_collections = list_collections(order="desc", limit=100, after=None, before=None) # List collections. @@ -107,37 +122,43 @@ def test_delete_collection(self): @pytest.mark.test_sync class TestRecord: - record_list = [ - "record_id", - "collection_id", - "num_chunks", - "content", - "metadata", - "type", - "object", - "created_timestamp", - "status", - ] - record_keys = set(record_list) - @pytest.mark.run(order=13) + record_list = ["record_id", + "collection_id", + "num_chunks", + "content", + "metadata", + "type", + "title", + "updated_timestamp", + "created_timestamp", + "status"] + record_keys = set(record_list) + + @pytest.mark.run(order=31) def test_create_record(self, collection_id): - # Create a text record. + # Create a text record. + text_splitter = TokenTextSplitter(chunk_size=200, chunk_overlap=20) text = "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data." + create_record_data = { + "collection_id": collection_id, + "content": text, + "text_splitter": text_splitter, + "metadata": { + "key1": "value1", + "key2": "value2" + } + } for x in range(2): - res = create_record( - collection_id=collection_id, - content=text, - text_splitter=TokenTextSplitter(chunk_size=200, chunk_overlap=20), - ) - res_dict = res.to_dict() + res = create_record(**create_record_data) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.record_keys) - pytest.assume(res_dict["content"] == text) - pytest.assume((res_dict["status"] == "creating") or (res_dict["status"] == "ready")) + assume_record_result(create_record_data, res_dict) - @pytest.mark.run(order=14) + @pytest.mark.run(order=32) def test_list_records(self, collection_id): + # List records. nums_limit = 1 @@ -159,34 +180,46 @@ def test_list_records(self, collection_id): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=15) + @pytest.mark.run(order=33) def test_get_record(self, collection_id): + # list records records = list_records(collection_id=collection_id) for record in records: record_id = record.record_id res = get_record(collection_id=collection_id, record_id=record_id) - logger.info(f"get record response: {res}") - res_dict = res.to_dict() + logger.info(f'get record response: {res}') + res_dict = vars(res) + pytest.assume(res_dict["collection_id"] == collection_id) + pytest.assume(res_dict["record_id"] == record_id) pytest.assume(res_dict.keys() == self.record_keys) - pytest.assume(res_dict["status"] == "ready" or res_dict["status"] == "creating") + pytest.assume(res_dict["status"] == "ready") - @pytest.mark.run(order=16) + @pytest.mark.run(order=34) def test_update_record(self, collection_id, record_id): + # Update a record. - metadata = {"test": "test"} - res = update_record(collection_id=collection_id, record_id=record_id, metadata=metadata) - res_dict = res.to_dict() + update_record_data = { + "collection_id": collection_id, + "record_id": record_id, + "content": "TaskingAI is an AI-native application development platform that unifies modules like Model, Retrieval, Assistant, and Tool into one seamless ecosystem, streamlining the creation and deployment of applications for developers.", + "text_splitter": TokenTextSplitter(chunk_size=200, chunk_overlap=20), + "metadata": {"test": "test"} + } + res = update_record(**update_record_data) + res_dict = vars(res) pytest.assume(res_dict.keys() == self.record_keys) - pytest.assume(res_dict["metadata"] == metadata) + assume_record_result(update_record_data, res_dict) - @pytest.mark.run(order=34) + @pytest.mark.run(order=79) def test_delete_record(self, collection_id): + # List records. - records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None) + records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, + before=None) old_nums = len(records) for index, record in enumerate(records): record_id = record.record_id @@ -197,7 +230,8 @@ def test_delete_record(self, collection_id): # List records. - new_records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, before=None) + new_records = list_records(collection_id=collection_id, order="desc", limit=20, after=None, + before=None) record_ids = [record.record_id for record in new_records] pytest.assume(record_id not in record_ids) new_nums = len(new_records) @@ -206,19 +240,109 @@ def test_delete_record(self, collection_id): @pytest.mark.test_sync class TestChunk: - chunk_list = ["chunk_id", "collection_id", "record_id", "object", "content", "score"] + + chunk_list = ["chunk_id", "record_id", "collection_id", "content", "metadata", "num_tokens", "score", "updated_timestamp","created_timestamp"] chunk_keys = set(chunk_list) - @pytest.mark.run(order=17) + @pytest.mark.run(order=41) def test_query_chunks(self, collection_id): + # Query chunks. query_text = "Machine learning" - top_k = 2 + top_k = 1 res = query_chunks(collection_id=collection_id, query_text=query_text, top_k=top_k) pytest.assume(len(res) == top_k) for chunk in res: - chunk_dict = chunk.to_dict() + chunk_dict = vars(chunk) + assume_query_chunk_result(query_text, chunk_dict) pytest.assume(chunk_dict.keys() == self.chunk_keys) - pytest.assume(query_text in chunk_dict["content"]) - pytest.assume(chunk_dict["score"] >= 0) + + @pytest.mark.run(order=42) + def test_create_chunk(self, collection_id): + + # Create a chunk. + create_chunk_data = { + "collection_id": collection_id, + "content": "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data."} + res = create_chunk(**create_chunk_data) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chunk_keys) + assume_chunk_result(create_chunk_data, res_dict) + + @pytest.mark.run(order=43) + def test_list_chunks(self, collection_id): + + # List chunks. + + nums_limit = 1 + res = list_chunks(limit=nums_limit, collection_id=collection_id) + pytest.assume(len(res) == nums_limit) + + after_id = res[-1].chunk_id + after_res = list_chunks(limit=nums_limit, after=after_id, collection_id=collection_id) + pytest.assume(len(after_res) == nums_limit) + + twice_nums_list = list_chunks(limit=nums_limit * 2, collection_id=collection_id) + pytest.assume(len(twice_nums_list) == nums_limit * 2) + pytest.assume(after_res[-1] == twice_nums_list[-1]) + pytest.assume(after_res[0] == twice_nums_list[nums_limit]) + + before_id = after_res[0].chunk_id + before_res = list_chunks(limit=nums_limit, before=before_id, collection_id=collection_id) + pytest.assume(len(before_res) == nums_limit) + pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) + pytest.assume(before_res[0] == twice_nums_list[0]) + + @pytest.mark.run(order=44) + def test_get_chunk(self, collection_id): + + # list chunks + + chunks = list_chunks(collection_id=collection_id) + for chunk in chunks: + chunk_id = chunk.chunk_id + res = get_chunk(collection_id=collection_id, chunk_id=chunk_id) + logger.info(f'get chunk response: {res}') + res_dict = vars(res) + pytest.assume(res_dict["collection_id"] == collection_id) + pytest.assume(res_dict["chunk_id"] == chunk_id) + pytest.assume(res_dict.keys() == self.chunk_keys) + + @pytest.mark.run(order=45) + def test_update_chunk(self, collection_id, chunk_id): + + # Update a chunk. + + update_chunk_data = { + "collection_id": collection_id, + "chunk_id": chunk_id, + "content": "Machine learning is a subfield of artificial intelligence (AI) that involves the development of algorithms that allow computers to learn from and make decisions or predictions based on data.", + "metadata": {"test": "test"} + } + res = update_chunk(**update_chunk_data) + res_dict = vars(res) + pytest.assume(res_dict.keys() == self.chunk_keys) + assume_chunk_result(update_chunk_data, res_dict) + + @pytest.mark.run(order=46) + def test_delete_chunk(self, collection_id): + + # List chunks. + + chunks = list_chunks(collection_id=collection_id) + old_nums = len(chunks) + for index, chunk in enumerate(chunks): + chunk_id = chunk.chunk_id + + # Delete a chunk. + + delete_chunk(collection_id=collection_id, chunk_id=chunk_id) + + # List chunks. + + new_chunks = list_chunks(collection_id=collection_id) + chunk_ids = [chunk.chunk_id for chunk in new_chunks] + pytest.assume(chunk_id not in chunk_ids) + new_nums = len(new_chunks) + pytest.assume(new_nums == old_nums - 1 - index) diff --git a/test/testcase/test_sync/test_sync_tool.py b/test/testcase/test_sync/test_sync_tool.py index 6550631..936b34a 100644 --- a/test/testcase/test_sync/test_sync_tool.py +++ b/test/testcase/test_sync/test_sync_tool.py @@ -1,102 +1,79 @@ import pytest - -from taskingai.tool import bulk_create_actions, get_action, update_action, delete_action, run_action, list_actions +import taskingai +from taskingai.tool import bulk_create_actions, get_action, update_action, delete_action, run_action, list_actions, ActionAuthentication, ActionAuthenticationType from test.common.logger import logger +from test.config import * @pytest.mark.test_sync class TestAction: - action_list = [ - "object", - "action_id", - "name", - "description", - "authentication", - "openapi_schema", - "created_timestamp", - ] + action_list = ['action_id', "operation_id", 'name', 'description', "url", "method", "path_param_schema", + "query_param_schema", "body_param_schema", "body_type", "function_def", 'authentication', + 'openapi_schema', 'created_timestamp', 'updated_timestamp'] action_keys = set(action_list) - action_schema = ["openapi", "info", "servers", "paths", "components", "security"] - action_schema_keys = set(action_schema) - openapi_schema = { - "openapi": "3.1.0", - "info": { - "title": "Get weather data", - "description": "Retrieves current weather data for a location.", - "version": "v1.0.0", - }, - "servers": [{"url": "https://weather.example.com"}], - "paths": { - "/location": { - "get": { - "description": "Get temperature for a specific location", - "operationId": "GetCurrentWeather", - "parameters": [ - { - "name": "location", - "in": "query", - "description": "The city and state to retrieve the weather for", - "required": True, - "schema": {"type": "string"}, - } - ], - "deprecated": False, - }, - "post": { - "description": "UPDATE temperature for a specific location", - "operationId": "UpdateCurrentWeather", - "requestBody": { - "required": True, - "content": { - "application/json": {"schema": {"$ref": "#/componeents/schemas/ActionCreateRequest"}} - }, - }, - "deprecated": False, - }, - } - }, - "components": {"schemas": {}}, - "security": [], - } - - @pytest.mark.run(order=4) - def test_bulk_create_actions(self): - # Create an action. - - res = bulk_create_actions(openapi_schema=self.openapi_schema) - for action in res: - action_dict = action.to_dict() - logger.info(action_dict) - pytest.assume(action_dict.keys() == self.action_keys) - pytest.assume(action_dict["openapi_schema"].keys() == self.action_schema_keys) - - for key in action_dict["openapi_schema"].keys(): - if key == "paths": - if action_dict["openapi_schema"][key]["/location"] == "get": - pytest.assume( - action_dict["openapi_schema"][key]["/location"]["get"] - == self.openapi_schema["paths"]["/location"]["get"] - ) - elif action_dict["openapi_schema"][key]["/location"] == "post": - pytest.assume( - action_dict["openapi_schema"][key]["/location"]["post"] - == self.openapi_schema["paths"]["/location"]["post"] - ) - else: - pytest.assume(action_dict["openapi_schema"][key] == self.openapi_schema[key]) - - @pytest.mark.run(order=5) - def test_run_action(self, action_id): - # Run an action. + action_authentication = ['type', 'secret', 'content'] + action_authentication_keys = set(action_authentication) + action_openapi_schema = ['openapi', 'info', 'servers', 'paths', 'components', 'security'] + action_openapi_schema_keys = set(action_openapi_schema) + schema = { + "openapi_schema": { + "openapi": "3.1.0", + "info": { + "title": "Get weather data", + "description": "Retrieves current weather data for a location.", + "version": "v1.0.0" + }, + "servers": [ + { + "url": "https://weather.example.com" + } + ], + "paths": { + "/location": { + "get": { + "description": "Get temperature for a specific location 123", + "operationId": "GetCurrentWeather123", + "parameters": [ + { + "name": "location", + "in": "query", + "description": "The city and state to retrieve the weather for", + "required": True, + "schema": { + "type": "string" + } + } + ], + "deprecated": False + } + } + } + + }, + "authentication": { + "type": "bearer", + "secret": "ASD213dfslkfa12" + } + } - parameters = {"location": "tokyo"} - res = run_action(action_id=action_id, parameters=parameters) - logger.info(f"async run action{res}") - pytest.assume(res["status"] != 200) - pytest.assume(res["error"]) + @pytest.mark.run(order=11) + def test_bulk_create_actions(self): - @pytest.mark.run(order=6) + # Create an action. + for i in range(2): + res = bulk_create_actions(**self.schema) + for action in res: + action_dict = vars(action) + logger.info(action_dict) + pytest.assume(action_dict.keys() == self.action_keys) + pytest.assume(action_dict["openapi_schema"].keys() == self.action_openapi_schema_keys) + for key in self.schema["openapi_schema"].keys(): + pytest.assume(action_dict["openapi_schema"][key] == self.schema["openapi_schema"][key]) + assert set(vars(action_dict.get("authentication")).keys()).issubset(TestAction.action_authentication_keys) + + @pytest.mark.run(order=12) def test_list_actions(self): + # List actions. nums_limit = 1 @@ -122,57 +99,103 @@ def test_list_actions(self): pytest.assume(before_res[-1] == twice_nums_list[nums_limit - 1]) pytest.assume(before_res[0] == twice_nums_list[0]) - @pytest.mark.run(order=7) + @pytest.mark.run(order=13) def test_get_action(self, action_id): + # Get an action. res = get_action(action_id=action_id) - res_dict = res.to_dict() + res_dict = vars(res) pytest.assume(res_dict.keys() == self.action_keys) - pytest.assume(res_dict["openapi_schema"].keys() == self.action_schema_keys) + logger.info(res_dict["openapi_schema"].keys()) + pytest.assume(res_dict["openapi_schema"].keys() == self.action_openapi_schema_keys) + pytest.assume(res_dict["action_id"] == action_id) + pytest.assume(vars(res_dict["authentication"]).keys() == self.action_authentication_keys) - @pytest.mark.run(order=39) + @pytest.mark.run(order=14) def test_update_action(self, action_id): + # Update an action. update_schema = { - "openapi": "3.1.0", - "info": { - "title": "Get weather data", - "description": "Retrieves current weather data for a location.", - "version": "v1.0.0", - }, - "servers": [{"url": "https://weather.example.com"}], - "paths": { - "/location": { - "get": { - "description": "Get temperature for a specific location by get method", - "operationId": "GetCurrentWeather", - "parameters": [ - { - "name": "location", - "in": "query", - "description": "The city and state to retrieve the weather for", - "required": True, - "schema": {"type": "string"}, + "openapi_schema": { + "openapi": "3.0.0", + "info": { + "title": "Numbers API", + "version": "1.0.0", + "description": "API for fetching interesting number facts" + }, + "servers": [ + { + "url": "http://numbersapi.com" + } + ], + "paths": { + "/{number}": { + "get": { + "description": "Get fact about a number", + "operationId": "get_number_fact", + "parameters": [ + { + "name": "number", + "in": "path", + "required": True, + "description": "The number to get the fact for", + "schema": { + "type": "integer" + } + } + ], + "responses": { + "200": { + "description": "A fact about the number", + "content": { + "text/plain": { + "schema": { + "type": "string" + } + } + } + } + } + } + } + } } - ], - "deprecated": False, } - } - }, - "components": {"schemas": {}}, - "security": [], - } - res = update_action(action_id=action_id, openapi_schema=update_schema) - res_dict = res.to_dict() + res = update_action(action_id=action_id, **update_schema) + res_dict = vars(res) logger.info(res_dict) pytest.assume(res_dict.keys() == self.action_keys) - pytest.assume(res_dict["openapi_schema"].keys() == self.action_schema_keys) - pytest.assume(res_dict["openapi_schema"] == update_schema) + for key in update_schema.keys(): + if key != "authentication": + for k, v in update_schema[key].items(): + pytest.assume(res_dict[key][k] == v) + assert set(res_dict.get(key).keys()).issubset(getattr(TestAction, f"action_{key}_keys")) + else: + assert set(vars(res_dict.get(key)).keys()).issubset(getattr(TestAction, f"action_{key}_keys")) + for k, v in update_schema[key].items(): + if k == "type": + pytest.assume(vars(res_dict[key])[k] == v) + else: + pytest.assume("*" in vars(res_dict[key])[k]) + + @pytest.mark.run(order=15) + def test_run_action(self, action_id): - @pytest.mark.run(order=40) + # Run an action. + + parameters = { + "number": 42 + } + res = run_action(action_id=action_id, parameters=parameters) + logger.info(f'async run action{res}') + pytest.assume(res['status'] == 200) + pytest.assume(res["data"]) + + @pytest.mark.run(order=80) def test_delete_action(self): + # List actions. actions = list_actions(limit=100)