diff --git a/automata/core/code_handling/py/writer.py b/automata/core/code_handling/py/writer.py index 2cf63ae1..f5005541 100644 --- a/automata/core/code_handling/py/writer.py +++ b/automata/core/code_handling/py/writer.py @@ -398,22 +398,45 @@ def generate_index_files(self, docs_dir: str) -> None: doc_directory_manager.root, root_relative_to_base ) + index_path = os.path.join(root, "index.rst") if rst_files or dirs: - with open(os.path.join(root, "index.rst"), "w") as index_file: - index_file.write(PyDocWriter.get_payload(root)) - - index_file.write(".. toctree::\n") - index_file.write( - " :maxdepth: 2\n\n" - if not root_dir_node or root_dir_node.is_root_dir() # type: ignore - else " :maxdepth: 1\n\n" - ) - - for sub_dir_ in sorted(dirs): - index_file.write(f" {sub_dir_}/index\n") - for file in sorted(rst_files): - if file != "index.rst": - index_file.write(f" {file[:-4]}\n") # Remove .rst extension + if os.path.exists(index_path): + with open(index_path, "r") as index_file: + existing_content = index_file.read() + else: + existing_content = "" + + # Identify start and end of the auto-generated content + auto_start_marker = "\n.. AUTO-GENERATED CONTENT START\n..\n\n" + auto_end_marker = "\n.. AUTO-GENERATED CONTENT END\n..\n\n" + + # Remove the auto-generated part if it already exists + if auto_start_marker in existing_content and auto_end_marker in existing_content: + start_idx = existing_content.index(auto_start_marker) + end_idx = existing_content.index(auto_end_marker) + len(auto_end_marker) + existing_content = existing_content[:start_idx] + existing_content[end_idx:] + + # Add new auto-generated content + auto_content = auto_start_marker + auto_content += " .. toctree::\n" + auto_content += ( + " :maxdepth: 2\n\n" + if not root_dir_node or root_dir_node.is_root_dir() # type: ignore + else " :maxdepth: 1\n\n" + ) + for file in sorted(rst_files): + if file != "index.rst": + auto_content += f" {file[:-4]}\n" # Remove .rst extension + for sub_dir_ in sorted(dirs): + auto_content += f" {sub_dir_}/index\n" + auto_content += auto_end_marker + + # Write everything back to the file + with open(index_path, "w") as index_file: + if existing_content.strip() == "": + index_file.write(PyDocWriter.get_payload(root) + auto_content) + else: + index_file.write(existing_content + auto_content) self.generate_module_summary(root) @@ -442,7 +465,6 @@ def get_payload(directory: str) -> str: Check out the :doc:`usage` section for further information, including how to :ref:`installation` the project. -.. note:: """ @@ -450,7 +472,7 @@ def get_payload(directory: str) -> str: def generate_summary(content: str) -> str: """This method should implement the logic to generate summary from the content.""" # TODO: Implement summary generation function. - return "Summary of content" + return "" @staticmethod def camel_to_snake(name: str) -> str: diff --git a/automata/docs/config/base/index.rst b/automata/docs/config/base/index.rst index 0681a54e..a05941a9 100644 --- a/automata/docs/config/base/index.rst +++ b/automata/docs/config/base/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - config -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + config + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/config/index.rst b/automata/docs/config/index.rst index 34864f4b..2631919c 100644 --- a/automata/docs/config/index.rst +++ b/automata/docs/config/index.rst @@ -1,26 +1,30 @@ -config -====== +Config Modules +============== **Automata** is a Python library for autonomous providers. Check out the :doc:`usage` section for further information, including how to :ref:`installation` the project. -.. note:: +.. AUTO-GENERATED CONTENT START +.. -.. toctree:: - :maxdepth: 1 + .. toctree:: + :maxdepth: 1 + + agent_config + agent_config_builder + agent_config_name + config_category + instruction_config_version + llm_provider + open_ai_automata_agent_config + open_ai_automata_agent_config_builder + base/index + openai_agent/index + +.. AUTO-GENERATED CONTENT END +.. - base/index - openai_agent/index - agent_config - agent_config_builder - agent_config_name - config_category - instruction_config_version - llm_provider - open_ai_automata_agent_config - open_ai_automata_agent_config_builder -Summary of content \ No newline at end of file diff --git a/automata/docs/config/openai_agent/index.rst b/automata/docs/config/openai_agent/index.rst index 23a1c45d..08f92bfb 100644 --- a/automata/docs/config/openai_agent/index.rst +++ b/automata/docs/config/openai_agent/index.rst @@ -8,11 +8,26 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - config - template_formatter -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + config + template_formatter + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/agent/agent/index.rst b/automata/docs/core/agent/agent/index.rst index be4775e1..482de648 100644 --- a/automata/docs/core/agent/agent/index.rst +++ b/automata/docs/core/agent/agent/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - config -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + config + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/agent/index.rst b/automata/docs/core/agent/index.rst index 3832e4df..06ebf467 100644 --- a/automata/docs/core/agent/index.rst +++ b/automata/docs/core/agent/index.rst @@ -8,28 +8,43 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - - agent/index - instances/index - agent - agent_database_error - agent_general_error - agent_instance - agent_max_iter_error - agent_result_error - agent_stop_iteration - agent_task_general_error - agent_task_git_error - agent_task_instructions - agent_task_state_error - agent_toolkit_builder - agent_toolkit_names - open_ai_agent_toolkit_builder - open_ai_automata_agent - open_ai_automata_agent_instance - unknown_tool_error - - -Summary of content \ No newline at end of file + + + + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + agent + agent_database_error + agent_general_error + agent_instance + agent_max_iter_error + agent_result_error + agent_stop_iteration + agent_task_general_error + agent_task_git_error + agent_task_instructions + agent_task_state_error + agent_toolkit_builder + agent_toolkit_names + open_ai_agent_toolkit_builder + open_ai_automata_agent + open_ai_automata_agent_instance + unknown_tool_error + agent/index + instances/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/agent/instances/index.rst b/automata/docs/core/agent/instances/index.rst index 285f9e50..515ad37a 100644 --- a/automata/docs/core/agent/instances/index.rst +++ b/automata/docs/core/agent/instances/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - config -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + config + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/base/database/index.rst b/automata/docs/core/base/database/index.rst index abab284f..4835beff 100644 --- a/automata/docs/core/base/database/index.rst +++ b/automata/docs/core/base/database/index.rst @@ -8,13 +8,28 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - json_vector_database - relational_database - sql_database - vector_database_provider -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + json_vector_database + relational_database + sql_database + vector_database_provider + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/base/index.rst b/automata/docs/core/base/index.rst index fe59341e..136b862d 100644 --- a/automata/docs/core/base/index.rst +++ b/automata/docs/core/base/index.rst @@ -8,11 +8,26 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - database/index - patterns/index -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + database/index + patterns/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/base/patterns/index.rst b/automata/docs/core/base/patterns/index.rst index e2e58e55..1414df77 100644 --- a/automata/docs/core/base/patterns/index.rst +++ b/automata/docs/core/base/patterns/index.rst @@ -8,11 +8,26 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - observer - singleton -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + observer + singleton + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/code_handling/index.rst b/automata/docs/core/code_handling/index.rst index cbf57b68..d5d79a76 100644 --- a/automata/docs/core/code_handling/index.rst +++ b/automata/docs/core/code_handling/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - py/index -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + py/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/code_handling/py/index.rst b/automata/docs/core/code_handling/py/index.rst index bef747ef..4bff81e2 100644 --- a/automata/docs/core/code_handling/py/index.rst +++ b/automata/docs/core/code_handling/py/index.rst @@ -8,13 +8,28 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - writer/index - py_doc_writer - py_reader - py_writer -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + py_doc_writer + py_reader + py_writer + writer/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/code_handling/py/writer/index.rst b/automata/docs/core/code_handling/py/writer/index.rst index c340dee7..e362b26b 100644 --- a/automata/docs/core/code_handling/py/writer/index.rst +++ b/automata/docs/core/code_handling/py/writer/index.rst @@ -8,12 +8,27 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - class_or_function_not_found - invalid_arguments - module_not_found -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + class_or_function_not_found + invalid_arguments + module_not_found + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/context_providers/index.rst b/automata/docs/core/context_providers/index.rst index a7a941ca..1a064f59 100644 --- a/automata/docs/core/context_providers/index.rst +++ b/automata/docs/core/context_providers/index.rst @@ -8,11 +8,26 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - symbol_provider_registry - symbol_provider_synchronization_context -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + symbol_provider_registry + symbol_provider_synchronization_context + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/embedding/index.rst b/automata/docs/core/embedding/index.rst index c9fcb488..a6ea5b67 100644 --- a/automata/docs/core/embedding/index.rst +++ b/automata/docs/core/embedding/index.rst @@ -8,15 +8,30 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - embedding - embedding_builder - embedding_handler - embedding_norm_type - embedding_similarity_calculator - embedding_vector_provider -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + embedding + embedding_builder + embedding_handler + embedding_norm_type + embedding_similarity_calculator + embedding_vector_provider + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/experimental/index.rst b/automata/docs/core/experimental/index.rst index eea36d31..58ac843c 100644 --- a/automata/docs/core/experimental/index.rst +++ b/automata/docs/core/experimental/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - search/index -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + search/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/experimental/search/index.rst b/automata/docs/core/experimental/search/index.rst index 2b313e79..b9de6765 100644 --- a/automata/docs/core/experimental/search/index.rst +++ b/automata/docs/core/experimental/search/index.rst @@ -8,12 +8,27 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - symbol_rank - symbol_rank_config - symbol_search -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + symbol_rank + symbol_rank_config + symbol_search + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/github_management/index.rst b/automata/docs/core/github_management/index.rst index f1c367aa..6030c163 100644 --- a/automata/docs/core/github_management/index.rst +++ b/automata/docs/core/github_management/index.rst @@ -8,11 +8,26 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - git_hub_client - repository_client -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + git_hub_client + repository_client + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/index.rst b/automata/docs/core/index.rst index c7395a8e..55aa3efb 100644 --- a/automata/docs/core/index.rst +++ b/automata/docs/core/index.rst @@ -1,5 +1,5 @@ -core -==== +Core Modules +============ **Automata** is a Python library for autonomous providers. @@ -8,28 +8,43 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - - agent/index - base/index - code_handling/index - context_providers/index - embedding/index - experimental/index - github_management/index - llm/index - memory_store/index - navigation/index - retrievers/index - singletons/index - symbol/index - symbol_embedding/index - tasks/index - tools/index - handler_dict - logging_config - root_dict - - -Summary of content \ No newline at end of file + + + + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + handler_dict + logging_config + root_dict + agent/index + base/index + code_handling/index + context_providers/index + embedding/index + experimental/index + github_management/index + llm/index + memory_store/index + navigation/index + retrievers/index + singletons/index + symbol/index + symbol_embedding/index + tasks/index + tools/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/llm/foundation/index.rst b/automata/docs/core/llm/foundation/index.rst index 285230e1..713a2c19 100644 --- a/automata/docs/core/llm/foundation/index.rst +++ b/automata/docs/core/llm/foundation/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - llm_empty_conversation_error -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + llm_empty_conversation_error + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/llm/index.rst b/automata/docs/core/llm/index.rst index 16b28e98..31172a33 100644 --- a/automata/docs/core/llm/index.rst +++ b/automata/docs/core/llm/index.rst @@ -8,16 +8,31 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - foundation/index - providers/index - llm_chat_completion_provider - llm_chat_message - llm_completion_result - llm_conversation - llm_conversation_database_provider -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + llm_chat_completion_provider + llm_chat_message + llm_completion_result + llm_conversation + llm_conversation_database_provider + foundation/index + providers/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/llm/providers/index.rst b/automata/docs/core/llm/providers/index.rst index 30b7be9e..33b42e24 100644 --- a/automata/docs/core/llm/providers/index.rst +++ b/automata/docs/core/llm/providers/index.rst @@ -8,18 +8,33 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - function_call - open_ai_chat_completion_provider - open_ai_chat_completion_result - open_ai_chat_message - open_ai_conversation - open_ai_embedding_provider - open_ai_function - open_ai_incorrect_message_type_error - open_ai_tool -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + function_call + open_ai_chat_completion_provider + open_ai_chat_completion_result + open_ai_chat_message + open_ai_conversation + open_ai_embedding_provider + open_ai_function + open_ai_incorrect_message_type_error + open_ai_tool + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/memory_store/index.rst b/automata/docs/core/memory_store/index.rst index da177fe5..d431d3fd 100644 --- a/automata/docs/core/memory_store/index.rst +++ b/automata/docs/core/memory_store/index.rst @@ -8,12 +8,27 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - agent_conversation_database - symbol_code_embedding_handler - symbol_doc_embedding_handler -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + agent_conversation_database + symbol_code_embedding_handler + symbol_doc_embedding_handler + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/navigation/index.rst b/automata/docs/core/navigation/index.rst index 81ef6fc8..d802dff9 100644 --- a/automata/docs/core/navigation/index.rst +++ b/automata/docs/core/navigation/index.rst @@ -8,14 +8,29 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - py/index - directory - directory_manager - file - node -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + directory + directory_manager + file + node + py/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/navigation/py/index.rst b/automata/docs/core/navigation/py/index.rst index 5c2ea325..3eeda477 100644 --- a/automata/docs/core/navigation/py/index.rst +++ b/automata/docs/core/navigation/py/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - dot_path_map -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + dot_path_map + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/retrievers/index.rst b/automata/docs/core/retrievers/index.rst index 56649a96..0ab37d72 100644 --- a/automata/docs/core/retrievers/index.rst +++ b/automata/docs/core/retrievers/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - py/index -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + py/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/retrievers/py/context/index.rst b/automata/docs/core/retrievers/py/context/index.rst index 344ff3c1..998e0e9a 100644 --- a/automata/docs/core/retrievers/py/context/index.rst +++ b/automata/docs/core/retrievers/py/context/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - indent_manager -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + indent_manager + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/retrievers/py/index.rst b/automata/docs/core/retrievers/py/index.rst index 13b70913..06fd7d1e 100644 --- a/automata/docs/core/retrievers/py/index.rst +++ b/automata/docs/core/retrievers/py/index.rst @@ -8,12 +8,27 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - context/index - py_context_retriever - py_context_retriever_config -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + py_context_retriever + py_context_retriever_config + context/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/singletons/index.rst b/automata/docs/core/singletons/index.rst index 4bdb6d31..e70a9be3 100644 --- a/automata/docs/core/singletons/index.rst +++ b/automata/docs/core/singletons/index.rst @@ -8,12 +8,27 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - dependency_factory - open_ai_automata_agent_toolkit_registry - py_module_loader -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + dependency_factory + open_ai_automata_agent_toolkit_registry + py_module_loader + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/symbol/base/index.rst b/automata/docs/core/symbol/base/index.rst index 47742016..59c290da 100644 --- a/automata/docs/core/symbol/base/index.rst +++ b/automata/docs/core/symbol/base/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - py_kind -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + py_kind + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/symbol/index.rst b/automata/docs/core/symbol/index.rst index 31e690e4..55d6ca13 100644 --- a/automata/docs/core/symbol/index.rst +++ b/automata/docs/core/symbol/index.rst @@ -8,18 +8,33 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - base/index - graph_builder - graph_processor - i_symbol_provider - symbol - symbol_descriptor - symbol_graph - symbol_package - symbol_reference -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + graph_builder + graph_processor + i_symbol_provider + symbol + symbol_descriptor + symbol_graph + symbol_package + symbol_reference + base/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/symbol_embedding/index.rst b/automata/docs/core/symbol_embedding/index.rst index d2a6681b..0603d09b 100644 --- a/automata/docs/core/symbol_embedding/index.rst +++ b/automata/docs/core/symbol_embedding/index.rst @@ -8,16 +8,31 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - json_symbol_embedding_vector_database - symbol_code_embedding - symbol_code_embedding_builder - symbol_doc_embedding - symbol_doc_embedding_builder - symbol_embedding - symbol_embedding_handler -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + json_symbol_embedding_vector_database + symbol_code_embedding + symbol_code_embedding_builder + symbol_doc_embedding + symbol_doc_embedding_builder + symbol_embedding + symbol_embedding_handler + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/tools/base/index.rst b/automata/docs/core/tools/base/index.rst index 0681a54e..a05941a9 100644 --- a/automata/docs/core/tools/base/index.rst +++ b/automata/docs/core/tools/base/index.rst @@ -8,10 +8,25 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - config -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + config + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/tools/builders/index.rst b/automata/docs/core/tools/builders/index.rst index eb2beabc..841c6272 100644 --- a/automata/docs/core/tools/builders/index.rst +++ b/automata/docs/core/tools/builders/index.rst @@ -8,18 +8,33 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - context_oracle_open_ai_toolkit_builder - context_oracle_toolkit_builder - py_reader_open_ai_toolkit - py_reader_toolkit_builder - py_writer_open_ai_toolkit_builder - py_writer_toolkit_builder - search_tool - symbol_search_open_ai_toolkit_builder - symbol_search_toolkit_builder -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + context_oracle_open_ai_toolkit_builder + context_oracle_toolkit_builder + py_reader_open_ai_toolkit + py_reader_toolkit_builder + py_writer_open_ai_toolkit_builder + py_writer_toolkit_builder + search_tool + symbol_search_open_ai_toolkit_builder + symbol_search_toolkit_builder + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/core/tools/index.rst b/automata/docs/core/tools/index.rst index fecb75f3..a5be6a17 100644 --- a/automata/docs/core/tools/index.rst +++ b/automata/docs/core/tools/index.rst @@ -8,13 +8,28 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - base/index - builders/index - agent_tool_factory - tool -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + agent_tool_factory + tool + base/index + builders/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/index.rst b/automata/docs/index.rst index 35810edb..abdcd5e7 100644 --- a/automata/docs/index.rst +++ b/automata/docs/index.rst @@ -1,19 +1,65 @@ -docs -==== +Automata: The Future is Self-Written +==================================== -**Automata** is a Python library for autonomous providers. +`Automata `_ is an evolving, fully autonomous, self-programming Artificial Intelligence system. It utilizes Large Language Models like GPT-4 and a vector database to document, search, and write code, paving the path for the creation of AGI. -Check out the :doc:`usage` section for further information, including -how to :ref:`installation` the project. +.. image:: https://github.com/emrgnt-cmplxty/Automata/assets/68796651/61fe3c33-9b7a-4c1b-9726-a77140476b83 + :alt: Automata Banner + +**Getting Started** + +For setup instructions, refer to our detailed :doc:`setup guide `. It covers creating a local Python environment, setting up necessary environment variables, fetching the Git submodules, and initializing Git LFS. It's designed to get you up and running with Automata in no time. + +**Live Status** + +.. image:: https://codecov.io/github/emrgnt-cmplxty/Automata/branch/main/graph/badge.svg?token=ZNE7RDUJQD + :alt: codecov + :target: https://codecov.io/github/emrgnt-cmplxty/Automata + +.. image:: https://readthedocs.org/projects/automata/badge/?version=latest + :alt: Documentation Status + :target: https://automata.readthedocs.io/en/latest/?badge=latest + +.. image:: https://github.com/emrgnt-cmplxty/Automata/actions/workflows/check-mypy.yml/badge.svg + :alt: Type Checking + :target: https://github.com/emrgnt-cmplxty/Automata/actions/workflows/check-mypy.yml + +**Stay Connected** + +.. image:: https://img.shields.io/discord/1120774652915105934?logo=discord + :alt: Discord + :target: https://discord.gg/j9GxfbxqAe + +.. image:: https://img.shields.io/twitter/follow/ocolegro?style=social + :alt: Twitter Follow + :target: https://twitter.com/ocolegro + +You can find a `demo `_ and a rough schematic diagram of the system on our GitHub page. For further information, including installation, usage and how to contribute, refer to the respective sections below. .. note:: -.. toctree:: - :maxdepth: 2 + Please ensure you read our `contribution guidelines `_ and adhere to the `code of conduct `_. + + +The following module documents are auto-generated via the run-doc-embedding pipeline. Please bear with us as the documentation is still a work in progress. + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 2 + + setup + config/index + core/index + tests/index + +.. AUTO-GENERATED CONTENT END +.. - config/index - core/index - tests/index -Summary of content \ No newline at end of file diff --git a/automata/docs/setup.rst b/automata/docs/setup.rst new file mode 100644 index 00000000..4621bc24 --- /dev/null +++ b/automata/docs/setup.rst @@ -0,0 +1,97 @@ +Setup +===== + +To set up the project, follow the instructions detailed below: + +Create Local Environment +------------------------ + +Create a Python virtual environment and activate it: + +.. code-block:: bash + + python3 -m venv local_env + source local_env/bin/activate + +Install the Project +------------------- + +Install the project in editable mode: + +.. code-block:: bash + + pip3 install -e . + +Setup Pre-commit Hooks +---------------------- + +.. code-block:: bash + + pre-commit install + +Configure Environment Variables +------------------------------- + +Copy the `.env.example` file to a `.env` file: + +.. code-block:: bash + + cp .env.example .env + +The `.env` file contains several environment variables which need to be set: + +.. code-block:: bash + + OPENAI_API_KEY=your_openai_api_key_here + GITHUB_API_KEY=your_github_api_key + CONVERSATION_DB_PATH="$PWD/conversation_db.sqlite3" + TASK_DB_PATH="$PWD/task_db.sqlite3" + TASKS_OUTPUT_PATH="$PWD/tasks" + REPOSITORY_NAME="emrgnt-cmplxty/Automata" + MAX_WORKERS=8 + +Replace the placeholders with your own values. The `OPENAI_API_KEY` and `GITHUB_API_KEY` should be your personal API keys for OpenAI and GitHub respectively. + +Detect Operating System +---------------------- + +.. code-block:: bash + + if [[ "$OSTYPE" == "darwin"* ]]; then + # Mac OSX + # Replace placeholders in .env with actual values using `sed` + else + # Linux and others + # Replace placeholders in .env with actual values using `sed` + fi + +Fetch Submodules +---------------- + +.. code-block:: bash + + git submodule update --init --recursive + +Install and Initialize Git LFS +------------------------------ + +You must install `git-lfs` if you have not done so already: + +For Ubuntu, run the following: + +.. code-block:: bash + + sudo apt-get install git-lfs + +For Mac, run the following: + +.. code-block:: bash + + brew install git-lfs + +Then, initialize by running the following: + +.. code-block:: bash + + git lfs install + git lfs pull diff --git a/automata/docs/tests/index.rst b/automata/docs/tests/index.rst index f20dc387..cfa5104f 100644 --- a/automata/docs/tests/index.rst +++ b/automata/docs/tests/index.rst @@ -1,19 +1,23 @@ -tests -===== +Test Modules +============ **Automata** is a Python library for autonomous providers. Check out the :doc:`usage` section for further information, including how to :ref:`installation` the project. -.. note:: -.. toctree:: - :maxdepth: 1 +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + mock_repository_client + unit/index + +.. AUTO-GENERATED CONTENT END +.. - unit/index - mock_repository_client - mock_repository_manager -Summary of content \ No newline at end of file diff --git a/automata/docs/tests/mock_repository_manager.rst b/automata/docs/tests/mock_repository_manager.rst deleted file mode 100644 index 8af6bbe5..00000000 --- a/automata/docs/tests/mock_repository_manager.rst +++ /dev/null @@ -1,69 +0,0 @@ -MockRepositoryClient -===================== - -``MockRepositoryClient`` is a mock implementation of the -``RepositoryClient`` class used for testing purposes. It derives from -the ``RepositoryClient`` class and provides empty implementations for -the various methods. This allows for simplified testing of classes and -methods that rely on a ``RepositoryClient`` without needing an actual -working implementation. - -Related Symbols ---------------- - -- ``automata.core.base.github_management.client.RepositoryClient`` -- ``automata.core.base.github_management.client.GitHubClient`` - -Overview --------- - -``MockRepositoryClient`` provides empty implementations for the -following methods: - -- ``clone_repository(local_path: str)`` -- ``create_branch(branch_name: str)`` -- ``checkout_branch(repo_local_path: str, branch_name: str)`` -- ``stage_all_changes(repo_local_path: str)`` -- ``commit_and_push_changes(repo_local_path: str, branch_name: str, commit_message: str)`` -- ``create_pull_request(branch_name: str, title: str, body: str)`` -- ``branch_exists(branch_name: str) -> bool`` -- ``fetch_issue(issue_number: int) -> Any`` - -Example -------- - -The following example demonstrates how to use the -``MockRepositoryClient`` in a test case. - -.. code:: python - - from automata.tests.conftest import MockRepositoryClient - from automata.core.tasks.tasks import AutomataTask - from config.config_enums import AgentConfigName - - # Create a MockRepositoryClient instance - repo_manager = MockRepositoryClient() - - # Instantiate an AutomataTask using the MockRepositoryClient - task = AutomataTask( - repo_manager, - main_config_name=AgentConfigName.TEST.value, - generate_deterministic_id=False, - instructions="This is a test.", - ) - -Limitations ------------ - -``MockRepositoryClient`` is designed to be used in test cases and not -in actual production code. As a result, providing it as -``RepositoryClient`` in production code will not provide any actual -functionality. - -Follow-up Questions: --------------------- - -- Are there any methods in ``MockRepositoryClient`` that need - additional mock implementations for better testing coverage? -- Can the ``MockRepositoryClient`` class be further improved to - provide better support for test cases? diff --git a/automata/docs/tests/unit/index.rst b/automata/docs/tests/unit/index.rst index ceb36158..31f21c1c 100644 --- a/automata/docs/tests/unit/index.rst +++ b/automata/docs/tests/unit/index.rst @@ -8,16 +8,29 @@ how to :ref:`installation` the project. .. note:: -.. toctree:: - :maxdepth: 1 - sample_modules/index - mock_automata_instance - mock_code_generator - mock_tool - test_execute_behavior - test_tool - test_url -Summary of content \ No newline at end of file + + + + + + +.. AUTO-GENERATED CONTENT START +.. + + .. toctree:: + :maxdepth: 1 + + mock_code_generator + test_execute_behavior + test_tool + test_url + sample_modules/index + +.. AUTO-GENERATED CONTENT END +.. + + + diff --git a/automata/docs/tests/unit/mock_automata_instance.rst b/automata/docs/tests/unit/mock_automata_instance.rst deleted file mode 100644 index 95ba7b16..00000000 --- a/automata/docs/tests/unit/mock_automata_instance.rst +++ /dev/null @@ -1,65 +0,0 @@ -MockAutomataInstance -==================== - -``MockAutomataInstance`` is a mock implementation of the -``AutomataInstance`` class. It provides a test-friendly representation -of a working ``AutomataInstance`` object, mainly for use with unit -tests. This class can be used to create instances that can simulate the -behavior of an ``AutomataInstance`` object, which can be helpful in the -context of unit testing. - -Overview --------- - -The main purpose of the ``MockAutomataInstance`` class is to act as a -test-friendly implementation of ``AutomataInstance``. By providing an -implementation of the ``.run()`` method, it allows users to create a -mock ``AutomataInstance`` that can simulate its behavior in unit -tests [1]_. - -Related Symbols ---------------- - -- ``automata.core.agent.coordinator.AutomataInstance`` -- ``automata.config.config_types.AgentConfigName`` -- ``automata.tests.unit.test_automata_agent_builder.test_automata_agent_init`` -- ``automata.core.agent.coordinator.AutomataCoordinator`` -- ``automata.core.agent.agent.AutomataAgent`` - -Example -------- - -The following example demonstrates how to create a -``MockAutomataInstance`` and use it to simulate the behavior of an -``AutomataInstance`` object in a test environment. - -.. code:: python - - from automata.tests.unit.test_automata_coordinator import MockAutomataInstance - from automata.config.config_types import AgentConfigName - - config_name = AgentConfigName.TEST - mock_instance = MockAutomataInstance(config_name=config_name, description="Mock Instance for Testing") - result = mock_instance.run("sample_instruction") - - print(result) # Output: Running sample_instruction on test. - -Limitations ------------ - -The ``MockAutomataInstance`` class is meant for testing purposes only -and should not be used in production code. It is a simplified -implementation and may not accurately represent all the behavior of a -real ``AutomataInstance``. In general, users should work with -``AutomataInstance`` objects directly. - -Follow-up Questions: --------------------- - -- Are there other mock objects that should be included for testing - purposes in the documentation? - -.. [1] - Mock objects are used in testing to simplify working with complex - objects. The provided example uses a mock object which is meant for - testing purposes only and should not be used in production code. diff --git a/automata/docs/tests/unit/mock_tool.rst b/automata/docs/tests/unit/mock_tool.rst deleted file mode 100644 index 77560f28..00000000 --- a/automata/docs/tests/unit/mock_tool.rst +++ /dev/null @@ -1,56 +0,0 @@ -MockTool -======== - -``MockTool`` is a mock implementation of the ``BaseTool`` class used for -testing purposes within the Automata project. It provides two simple -methods, ``_run()`` and ``_arun()``, for synchronous and asynchronous -execution respectively. It is mainly used in unit tests where an -instance of a ``BaseTool`` subclass is required but the actual -functionality is not important. - -Overview --------- - -``MockTool`` inherits from the ``BaseTool`` and provides mock -implementations of the ``_run()`` and ``_arun()`` methods, returning -fixed strings as responses. This class is used in unit tests that -require ``BaseTool`` subclasses but do not need the specific -implementation. - -Related Symbols ---------------- - -- ``automata.core.base.base_tool.BaseTool`` -- ``automata.core.tools.tool.Tool`` -- ``automata.core.tools.tool.InvalidTool`` -- ``automata.core.tools.tool.Toolkit`` -- ``automata.core.tools.tool.tool`` - -Example -------- - -.. code:: python - - from automata.tests.unit.test_base_tool import MockTool - - tool = MockTool(name="MockTool", description="A mock tool for testing purposes") - tool_input = ("test",) - response = tool(tool_input) - print(response) # Outputs: "MockTool response" - -Limitations ------------ - -``MockTool`` is created solely for testing purposes and is not intended -for usage in production code. It has minimal functionality, providing -only simple mock implementations of the ``_run()`` and ``_arun()`` -methods. Consequently, using this class for anything other than testing -will not provide meaningful or correct results. - -Follow-up Questions: --------------------- - -- Are there any specific usage requirements for ``MockTool`` in the - unit tests where it is used? -- Can the ``_run()`` and ``_arun()`` methods be customized to provide - different responses or side effects when testing? If so, how?