diff --git a/docs/source/docs_utils/notebook.py b/docs/source/docs_utils/notebook.py index 8a5a5195..4a697ac8 100644 --- a/docs/source/docs_utils/notebook.py +++ b/docs/source/docs_utils/notebook.py @@ -136,15 +136,11 @@ def link_to_doc_page( if page_type == "class": dotpath = "autointent" + (("." + dotpath) if dotpath != "" else "") path = "/".join(dotpath.split(".")) - return f"../autoapi/{path}/{obj}.html" + ( - f"#{dotpath}.{obj}" if obj is not None else "" - ) + return f"../autoapi/{path}/{obj}.html" + (f"#{dotpath}.{obj}" if obj is not None else "") if page_type == "method": dotpath = "autointent" + (("." + dotpath) if dotpath != "" else "") path = "/".join(dotpath.split(".")) - return f"../autoapi/{path}.html" + ( - f"#{dotpath}.{obj}" if obj is not None else "" - ) + return f"../autoapi/{path}.html" + (f"#{dotpath}.{obj}" if obj is not None else "") if page_type == "tutorial": return f"../tutorials/tutorials.{dotpath}.py" if page_type == "rst": diff --git a/tutorials/auto_configuration/python_api.py b/tutorials/auto_configuration/python_api.py index 4bad8633..03673dc8 100644 --- a/tutorials/auto_configuration/python_api.py +++ b/tutorials/auto_configuration/python_api.py @@ -90,5 +90,29 @@ """ ## Vector Index Settings -%mddoclink(class,context.vector_index_client,VectorIndex) is one of the key utilities of AutoIntent. It affects both the quality of the resulting classifier and the efficiency of the auto configuration process. +%mddoclink(class,context.vector_index_client,VectorIndex) is one of the key utilities of AutoIntent. During the auto-configuration process, lots of retrieval is used. By modifying vector index settings you can select whether to save built vector index into file system and where to save it. + +Default options are the following: +""" + +# %% +from autointent.configs import VectorIndexConfig + +vector_index_config = VectorIndexConfig( + db_dir=None, + save_db=False +) + +# %% [markdown] """ +- `db_dir=None` tells AutoIntent to store intermediate files in a current working directory +- `save_db=False` tells AutoIntent to clear all the files after auto configuration is finished + +These settings can be applied in a familiar way: +""" + +# %% +custom_pipeline.set_config(vector_index_config) + +# %% [markdown] + diff --git a/tutorials/auto_configuration/search_space_configuration.py b/tutorials/auto_configuration/search_space_configuration.py index 0f49670e..8e4ad392 100644 --- a/tutorials/auto_configuration/search_space_configuration.py +++ b/tutorials/auto_configuration/search_space_configuration.py @@ -24,10 +24,7 @@ knn_module = { "module_type": "knn", "k": [1, 5, 10, 50], - "embedder_name": [ - "avsolatorio/GIST-small-Embedding-v0", - "infgrad/stella-base-en-v2" - ] + "embedder_name": ["avsolatorio/GIST-small-Embedding-v0", "infgrad/stella-base-en-v2"], } # %% [markdown] @@ -62,7 +59,7 @@ "search_space": [ knn_module, linear_module, - ] + ], } # %% [markdown] @@ -81,48 +78,28 @@ { "module_type": "vector_db", "k": [10], - "embedder_name": [ - "avsolatorio/GIST-small-Embedding-v0", - "infgrad/stella-base-en-v2" - ] + "embedder_name": ["avsolatorio/GIST-small-Embedding-v0", "infgrad/stella-base-en-v2"], } - ] + ], }, { "node_type": "scoring", "metric": "scoring_roc_auc", "search_space": [ + {"module_type": "knn", "k": [1, 3, 5, 10], "weights": ["uniform", "distance", "closest"]}, + {"module_type": "linear"}, { - "module_type": "knn", + "module_type": "dnnc", + "cross_encoder_name": ["BAAI/bge-reranker-base", "cross-encoder/ms-marco-MiniLM-L-6-v2"], "k": [1, 3, 5, 10], - "weights": ["uniform", "distance", "closest"] - }, - { - "module_type": "linear" }, - { - "module_type": "dnnc", - "cross_encoder_name": [ - "BAAI/bge-reranker-base", - "cross-encoder/ms-marco-MiniLM-L-6-v2" - ], - "k": [1, 3, 5, 10] - } - ] + ], }, { "node_type": "prediction", "metric": "prediction_accuracy", - "search_space": [ - { - "module_type": "threshold", - "thresh": [0.5] - }, - { - "module_type": "argmax" - } - ] - } + "search_space": [{"module_type": "threshold", "thresh": [0.5]}, {"module_type": "argmax"}], + }, ] # %% [markdown]