tools package¶
Submodules¶
tools.build123d_retriever module¶
- class tools.build123d_retriever.Build123dRetriever(db_file: str = 'build123d_vec.db', table: str = 'build123d_objects', embedding_model: Embeddings = None, reranking_model: Rerank = None, embedding_config: Dict = None, rerank_config: Dict = None, k: int = 10, k_rerank: int = 10)[source]¶
Bases:
object
- extract_all_objects(module_info_json: Dict) List[Dict] [source]¶
Extract objects with type categorization from raw JSON.
- get_complete_info(query_text: str, k: int = None, k_rerank: int = None, with_docstring: bool = False, threshold: float = 0.8, distance_metrics: Literal['l2', 'cosine'] = 'cosine') List[Dict] [source]¶
Get complete information about the queried objects in parallel.
- Parameters:
query_text (str) – The query text.
k (int) – The number of results to return. Defaults to 5.
- Returns:
A list of dictionaries containing complete information about the objects.
- Return type:
List[Dict]
- query(query_text: str, k: int = 10, k_rerank: int = 10, distance_metric: Literal['l2', 'cosine'] = 'cosine') List[Dict] [source]¶
Query the database with a sentence or description in parallel.
- Parameters:
query_text (str) – The query text.
k (int) – The number of results to return. Defaults to 5.
- Returns:
A list of metadata dictionaries for the most relevant objects.
- Return type:
List[Dict]
tools.code_dochelper module¶
- class tools.code_dochelper.CodeDocHelper[source]¶
Bases:
object
- dict_to_markdown(data, show_docstring=True)[source]¶
Convert a dictionary containing module, class, function, or variable information into a Markdown-formatted string.
Parameters: data (dict): A dictionary containing module, class, function, or variable information. show_docstring (bool): If True, include docstrings in the output.
Returns: str: A Markdown-formatted string.
- get_class_info(class_path, with_docstring=False)[source]¶
Retrieve the signature, methods, variables, and optionally the docstring of a class.
Parameters: class_path (str): The full import path to the class (e.g., “build123d.Box”). with_docstring (bool): If True, include the docstring in the output.
Returns: dict: A dictionary containing the class name, signature, flattened methods, variables, and docstring (optional).
- get_function_info(function_path, with_docstring=False)[source]¶
Retrieve the signature and optionally the docstring of a function or class method.
Parameters: function_path (str): The full import path to the function (e.g., “build123d.Box.bounding_box”). with_docstring (bool): If True, include the docstring in the output.
Returns: dict: A dictionary containing the function name, signature, and docstring (optional).
- get_info(path, with_docstring=True)[source]¶
Retrieve information about a module, class, function, or variable.
- get_module_info(module_name, with_docstring=False)[source]¶
Retrieve the classes, functions, variables, and optionally the docstring of a module.
Parameters: module_name (str): The name of the module. with_docstring (bool): If True, include the docstring in the output.
Returns: dict: A dictionary containing the module name, classes, functions, variables, and docstring (optional).
tools.web_reader module¶
- tools.web_reader.fetch_content(url, return_format: Literal['text', 'markdown', 'html', 'screenshot'] = 'markdown', disable_gfm: Literal[False, True, 'table'] = False, bypass_cache=False, with_generated_alt=False, remove_images=False, timeout=None, json_response=True, with_links_summary=False, with_images_summary=False)[source]¶
Fetch content from a specified URL using the r.jina.ai API.
- Parameters:
url – The URL to fetch content from.
return_format – The format of the returned content, options are ‘text’, ‘markdown’, ‘html’, ‘screenshot’.
json_response – Boolean flag to toggle JSON response format.
bypass_cache – Boolean flag to bypass cache.
disable_gfm – Boolean flag to disable Github Flavored Markdown or ‘table’ mode.
remove_images – Boolean flag to remove all images from the response.
timeout – Timeout in seconds for waiting the webpage to load.
with_generated_alt – Boolean flag to include generated alt text for images.
with_links_summary – Boolean flag to include a summary of all links at the end.
with_images_summary – Boolean flag to include a summary of all images at the end.
- Returns:
The fetched content in the specified format.