### Install SemTools for Development Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Install the SemTools project locally for development purposes, making it available as a command-line tool. ```bash cargo install --path . ``` -------------------------------- ### Install Required Libraries Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_mcp.md Install the necessary libraries for LlamaIndex and semtools integration. This includes the Anthropic LLM integration and the MCP tool. ```bash pip install llama-index-llms-anthropic llama-index-tools-mcp ``` -------------------------------- ### Install Semtools Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_mcp.md Installs the semtools package using cargo. ```bash cargo install semtools ``` -------------------------------- ### Install NetworkX Package Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Use pip3 to install the networkx package. Note that system-wide installations might be managed externally, and using a virtual environment is recommended. ```bash pip3 install networkx ``` -------------------------------- ### SemTools Unified Configuration File Example Source: https://github.com/run-llama/semtools/blob/main/README.md An example JSON configuration file for SemTools, showing settings for parsing and asking tools. This file can be specified using the `-c` or `--config` flag. ```json { "parse": { "api_key": "your_llama_cloud_api_key_here", "num_ongoing_requests": 10, "base_url": "https://api.cloud.llamaindex.ai", "parse_kwargs": { "tier": "agentic", "version": "latest", "disable_cache": false }, "check_interval": 5, "max_timeout": 3600, "max_retries": 10, "retry_delay_ms": 1000, "backoff_multiplier": 2.0 }, "ask": { "api_key": "your_openai_api_key_here", "base_url": null, "model": "gpt-4o-mini", "max_iterations": 20, "api_mode": "responses" // Can be responses or chat } } ``` -------------------------------- ### Install SemTools via Cargo Source: https://github.com/run-llama/semtools/blob/main/README.md Install the SemTools crate using cargo. You can install the entire crate or select features like 'parse'. Ensure Rust and Cargo are installed. ```bash cargo install semtools ``` ```bash cargo install semtools --no-default-features --features=parse ``` -------------------------------- ### Install SemTools via npm Source: https://github.com/run-llama/semtools/blob/main/README.md Install the SemTools CLI globally using npm. This method may build Rust binaries locally if prebuilt binaries are unavailable, requiring Rust and Cargo. ```bash npm i -g @llamaindex/semtools ``` -------------------------------- ### Workspace Example with Parse Source: https://github.com/run-llama/semtools/blob/main/examples/example_CLAUDE.md Illustrates initializing a workspace named 'my-workspace2' and setting the environment variable to activate it, preparing for subsequent parse and search operations within that workspace. ```bash # A workspace example if you are using with parse # create a workspace semtools workspace use my-workspace2 export SEMTOOLS_WORKSPACE=my-workspace2 ``` -------------------------------- ### Install fastmcp Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_mcp.md Installs the fastmcp Python package. ```bash pip install fastmcp ``` -------------------------------- ### Install scikit-learn using pip Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Attempts to install the 'scikit-learn' library using 'pip'. This is a common step for enabling machine learning functionalities in Python. ```bash pip install scikit-learn ``` -------------------------------- ### Install scikit-learn using python -m pip Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Installs the 'scikit-learn' library by invoking 'pip' as a module through the Python interpreter. This can resolve issues with 'pip' not being found in the system's PATH. ```bash python -m pip install scikit-learn ``` -------------------------------- ### Integration Test Directory Structure Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Example of how integration tests should be organized within the `tests/` directory of the project. Each file typically corresponds to a specific component or feature. ```bash # Add integration tests in tests/ directory tests/ ├── parse_integration.rs └── search_integration.rs ``` -------------------------------- ### Pipeline with Content Search Source: https://github.com/run-llama/semtools/blob/main/examples/example_CLAUDE.md Finds all markdown files, parses them using `semtools parse`, and then semantically searches for 'installation' using `semtools search`. ```bash # Pipeline with content search (note the 'cat') find . -name "*.md" | xargs semtools parse | xargs semtools search "installation" ``` -------------------------------- ### Install Python dependencies for analysis Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Use this command to install necessary Python libraries for the abstract similarity analysis script, including numpy, scikit-learn, matplotlib, seaborn, and scipy. ```bash pip install numpy scikit-learn matplotlib seaborn scipy ``` -------------------------------- ### Install Python dependencies using python3 -m pip Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Alternative method to install Python dependencies using the python3 module to invoke pip. This is useful if pip is not directly available in the PATH. ```bash python3 -m pip install numpy scikit-learn matplotlib seaborn scipy ``` -------------------------------- ### Agent Execution Output Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_mcp.md Example output from the agent script, showing the sequence of bash commands executed by the agent to find, parse, and search through PDF documents. ```bash $ python ./agent.py Calling tool execute_bash({'command': 'find . -name "*.pdf" | head -10'}) Calling tool execute_bash({'command': 'find . -name "*.pdf" | wc -l'}) Calling tool execute_bash({'command': 'find . -name "*.pdf" | xargs semtools parse'}) Calling tool execute_bash({'command': 'find /Users/loganmarkewich/.parse -name "*.md" | xargs semtools search "large language model, LLM, evaluation, benchmark" --top-k 10 --n-lines 5'}) ``` -------------------------------- ### Extract all titles chronologically to a file Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Finds all .txt files, sorts them, greps for lines starting with 'TITLE:', and redirects the output to a temporary file for further analysis. ```bash find /Users/loganmarkewich/semtools/benchmarks/arxiv/arxiv_dataset_1000 _papers/by_date -name "*.txt" | sort | xargs grep -H "^TITLE:" > /tmp/all_titles_chronolo… ``` -------------------------------- ### Rust Function with Doc Comments and Error Handling Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Example of a well-documented Rust function using `anyhow::Result` for error handling. Doc comments explain the function's purpose, parameters, and return value. ```rust // Good: Clear function with documentation /// Searches for semantically similar text in the given documents pub fn search_documents( query: &str, documents: &[Document], threshold: f64, ) -> Result> { // Implementation } ``` -------------------------------- ### Combine Search with Grep for Pre-filtering Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/search_CLAUDE.md Pre-filter files using 'grep' for exact matches before performing a 'search'. This example uses 'grep -i' for case-insensitive matching and then searches for a specific phrase with a maximum distance threshold. ```bash grep -i "error" some_folder/*.txt | search "network error" --max-distance 0.3 --n-lines 7 ``` -------------------------------- ### Extract All Titles and Dates Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Use this command to extract all lines starting with 'TITLE:' from text files in the 'full_text' directory. It's a preliminary step to gather data for analysis. ```bash grep "^TITLE:" full_text/*.txt | head -20 ``` -------------------------------- ### Find and grep titles chronologically Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Finds all .txt files in a directory, sorts them, and then greps for lines starting with 'TITLE:'. Useful for initial exploration of paper titles. ```bash find /Users/loganmarkewich/semtools/benchmarks/arxiv/arxiv_dataset_1000 _papers/by_date -name "*.txt" | sort | head -20 | xargs grep -H "^TITLE:" | head -20 ``` -------------------------------- ### Extract author information from initial papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/3.txt Iterates through the first 10 unique paper filenames found containing 'meta-learning'. For each file, it prints a header and then extracts the first 20 lines, searching for lines that start with an uppercase letter followed by lowercase letters, likely indicating author or title information. ```bash Bash(for file in $(grep -i "meta-learning" full_text/*.txt | cut -d: -f1 | sort | uniq | head -10); do echo "=== $file ==="; head -20 "$file" | grep -E "^[A-Z].*[a-z…) ``` -------------------------------- ### Search for Specific Optimization Topics Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/3.txt Refine searches with more specific terms like 'neural network optimization' or 'gradient descent optimization' to get more targeted results. The '--top-k' and '--n-lines' parameters control the number of results and the amount of context shown. ```bash search "neural network optimization" full_text/*.txt --top-k 5 --n-lines 8 ``` ```bash search "gradient descent optimization" full_text/*.txt --top-k 5 --n-lines 8 ``` ```bash search "hyperparameter optimization" full_text/*.txt --top-k 5 --n-lines 8 ``` -------------------------------- ### Create or Select a Workspace Source: https://github.com/run-llama/semtools/blob/main/examples/example_CLAUDE.md Demonstrates how to use `semtools workspace use` to create or select a workspace, and the subsequent environment variable export to activate it. ```bash # Create or select a workspace # Workspaces are stored in ~/.semtools/workspaces/ semtools workspace use my-workspace > Workspace 'my-workspace' configured. > To activate it, run: > export SEMTOOLS_WORKSPACE=my-workspace > > Or add this to your shell profile (.bashrc, .zshrc, etc.) # Activate the workspace export SEMTOOLS_WORKSPACE=my-workspace # All search commands will now use the workspace for caching embeddings # The initial command is used to initialize the workspace semtools search "some keywords" ./some_large_dir/*.txt --n-lines 5 --top-k 10 # If documents change, they are automatically re-embedded and cached echo "some new content" > ./some_large_dir/some_file.txt semtools search "some keywords" ./some_large_dir/*.txt --n-lines 5 --top-k 10 ``` -------------------------------- ### Search CLI Help Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/search_CLAUDE.md Displays help information for the 'search' CLI tool, outlining its usage, arguments, and options for performing semantic keyword searches. ```bash search --help A CLI tool for fast semantic keyword search Usage: search [OPTIONS] [FILES]... Arguments: Query to search for (positional argument) [FILES]... Files or directories to search Options: -n, --n-lines How many lines before/after to return as context [default: 3] --top-k The top-k files or texts to return (ignored if max_distance is set) [default: 3] -m, --max-distance Return all results with distance below this threshold (0.0+) -i, --ignore-case Perform case-insensitive search (default is false) -h, --help Print help -V, --version Print version ``` -------------------------------- ### SemTools Ask CLI Help Source: https://github.com/run-llama/semtools/blob/main/README.md Displays help for the `semtools ask` command, detailing its arguments and options for document-based question-answering. ```bash $ semtools ask --help A CLI tool for document-based question-answering Usage: semtools ask [OPTIONS] [FILES]... Arguments: Query to prompt the agent with [FILES]... Files to search, optional if using stdin Options: -c, --config Path to the config file. Defaults to ~/.semtools_config.json --api-key OpenAI API key (overrides config file and env var) --base-url OpenAI base URL (overrides config file) -m, --model Model to use for the agent (overrides config file) --api-mode API mode to use: 'chat' or 'responses' (overrides config file) -j, --json Output results in JSON or text format -h, --help Print help ``` -------------------------------- ### SemTools Workspace CLI Help Source: https://github.com/run-llama/semtools/blob/main/README.md Provides help for the `semtools workspace` command, listing available subcommands for managing workspaces. ```bash $ semtools workspace --help Manage semtools workspaces Usage: semtools workspace [OPTIONS] Commands: use Use or create a workspace (prints export command to run) status Show active workspace and basic stats prune Remove stale or missing files from store help Print this message or the help of the given subcommand(s) Options: -j, --json Output results in JSON format -h, --help Print help ``` -------------------------------- ### SemTools Search CLI Help Source: https://github.com/run-llama/semtools/blob/main/README.md Shows help for the `semtools search` command, detailing its arguments and options for performing semantic keyword searches. ```bash $ semtools search --help A CLI tool for fast semantic keyword search Usage: semtools search [OPTIONS] [FILES]... Arguments: Query to search for (positional argument) [FILES]... Files to search, optional if using stdin Options: -n, --n-lines How many lines before/after to return as context [default: 3] --top-k The top-k files or texts to return (ignored if max_distance is set) [default: 3] -m, --max-distance Return all results with distance below this threshold (0.0+) -i, --ignore-case Perform case-insensitive search (default is false) -j, --json Output results in JSON format -h, --help Print help ``` -------------------------------- ### Environment Variables for API Keys Source: https://github.com/run-llama/semtools/blob/main/README.md Demonstrates how to set API keys for the parse and ask tools using environment variables. These can supplement or override configuration file settings. ```bash # For parse tool export LLAMA_CLOUD_API_KEY="your_llama_cloud_api_key_here" # For ask tool export OPENAI_API_KEY="your_openai_api_key_here" ``` -------------------------------- ### Get titles of relevant papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/1.txt Use the `head` command to extract the first line of a file, which is assumed to contain the title when searching for specific papers. ```bash head -1 full_text/2506.22084v1.txt ``` ```bash head -1 full_text/2505.20280v1.txt ``` ```bash head -1 full_text/2507.21589v1.txt ``` ```bash head -1 full_text/2508.10899v1.txt ``` ```bash head -1 full_text/2506.10140v1.txt ``` -------------------------------- ### Launch fastmcp Server Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_mcp.md Launches the configured fastmcp server using the streamable-http transport. ```bash fastmcp server.py:mcp --transport streamable-http ``` -------------------------------- ### SemTools Parse CLI Help Source: https://github.com/run-llama/semtools/blob/main/README.md Displays help information for the `semtools parse` command, outlining its usage, arguments, and options for document parsing. ```bash $ semtools parse --help A CLI tool for parsing documents using various backends Usage: semtools parse [OPTIONS] ... Arguments: ... Files to parse Options: -c, --config Path to the config file. Defaults to ~/.semtools_config.json -b, --backend The backend type to use for parsing. Defaults to `llama-parse` [default: llama-parse] -v, --verbose Verbose output while parsing -h, --help Print help ``` -------------------------------- ### Count papers for authors A-E with multiple papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Iterates through author directories starting with letters A through E, counting papers for each. Authors with more than one paper are listed. ```bash for author in $(ls by_author | grep -E "^[A-E]"); do count=$(ls by_author/$author/*.txt 2>/dev/null | wc -l); if [ $count -gt 1 ]; then echo "$author: $count pa… ``` -------------------------------- ### Configure Semtools Ask Subcommand Source: https://github.com/run-llama/semtools/blob/main/README.md Override default LLM model and provide API key for the 'ask' subcommand. Ensure your OpenAI API key is kept secure. ```bash semtools ask "What is this about?" docs/*.txt --model gpt-4o --api-key sk-... ``` -------------------------------- ### List Author Papers Bash Command Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/4.txt Lists all text files in a specified author's directory. Useful for getting an overview of an author's publications. ```bash for file in /Users/loganmarkewich/semtools/benchmarks/arxiv/arxiv_dataset_1000_papers/by_author/Yang_Yang/*.txt; do echo "=== $(basename $file) ==="; head -10 "$file" done ``` -------------------------------- ### Clone SemTools Repository Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Clone the SemTools repository and navigate into the project directory to begin development. ```bash git clone https://github.com/run-llama/semtools cd semtools ``` -------------------------------- ### List directory contents Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Use 'List' to view the contents of a directory. Use 'ctrl+r' to expand the listing. ```bash List(~/semtools/benchmarks/arxiv/arxiv_dataset_1000_papers) ``` ```bash List(by_category) ``` -------------------------------- ### Search CLI Common Usage Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/search_CLAUDE.md Demonstrates a common usage pattern for the 'search' CLI tool, including custom context lines and distance thresholds for semantic searches. ```bash # Search with custom context and thresholds or distance thresholds search "machine learning" *.txt --n-lines 6 --max-distance 0.4 --ignore-case ``` -------------------------------- ### Extract Abstracts from August Papers using Grep Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Uses 'grep' to extract lines starting with 'Abstract' and the subsequent 10 lines from August papers. 'head -500' limits the output to the first 500 matching lines. ```bash grep -A 10 "^Abstract" /Users/loganmarkewich/semtools/benchmarks/arxiv/arxiv_dataset_1000_papers/by_date/2025-08/*.txt | head -500 ``` -------------------------------- ### Advanced SemTools pipeline with grep and search Source: https://github.com/run-llama/semtools/blob/main/README.md Demonstrates a complex pipeline involving parsing, piping to grep for pre-filtering, and then performing a semantic search with distance thresholding. ```bash semtools parse *.pdf | xargs cat | grep -i "error" | semtools search "network error" --max-distance 0.3 ``` -------------------------------- ### Extract Abstracts from June Papers using Grep Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Employs 'grep' to extract lines starting with 'Abstract' and the following 10 lines from June papers. 'head -500' limits the output to the first 500 matching lines. ```bash grep -A 10 "^Abstract" /Users/loganmarkewich/semtools/benchmarks/arxiv/arxiv_dataset_1000_papers/by_date/2025-06/*.txt | head -500 ``` -------------------------------- ### Search for paper titles containing 'TITLE:' in August 2025 Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/3.txt This command searches for lines starting with 'TITLE:' within August 2025 papers. It's useful for extracting or analyzing paper titles directly. The '--top-k' and '--n-lines' parameters can be adjusted. ```bash search "TITLE:" by_date/2025-08/*.txt --top-k 15 --n-lines 1 ``` -------------------------------- ### Execute Simple Collaboration Analysis Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Run the simple collaboration analysis script using python3. ```bash python3 /tmp/simple_collaboration_analysis.py ``` -------------------------------- ### List authors in by_author directory Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Lists the first 20 author directories within the 'by_author' directory. ```bash ls by_author | head -20 ``` -------------------------------- ### Extract unique paper filenames containing 'meta-learning' Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/3.txt Filters text files for lines containing 'meta-learning', extracts the filename (part before the first colon), sorts the filenames, and then removes duplicates to get a unique list of papers. This is useful for subsequent processing of each paper. ```bash Bash(grep -i "meta-learning" full_text/*.txt | cut -d: -f1 | sort | uniq) ``` -------------------------------- ### Configure fastmcp Server for Bash Commands Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_mcp.md Sets up a fastmcp server with a tool to execute bash commands. This approach is not recommended for production due to security implications. ```python import subprocess from fastmcp import FastMCP mcp = FastMCP("My MCP Server") @mcp.tool def execute_bash(command: str) -> str: """Useful for executing bash commands on your machine.""" return subprocess.run(command, shell=True, capture_output=True, text=True, timeout=60).stdout ``` -------------------------------- ### Find first occurrences of 'reinforcement learning' in titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Prints a header and then searches a chronological title file for the term 'reinforcement' (case-insensitive), displaying the first 3 matches. ```bash echo "=== REINFORCEMENT LEARNING ===" && grep -i "reinforcement" /tmp/all_titles_chronological.txt | head -3 ``` -------------------------------- ### Pipeline find, parse, and search with SemTools Source: https://github.com/run-llama/semtools/blob/main/README.md Use `find` to locate files, pipe to `xargs semtools parse` to process them, and then pipe to `xargs semtools search` to perform semantic search. ```bash find . -name "*.md" | xargs semtools parse | xargs semtools search "installation" ``` -------------------------------- ### Ask questions with SemTools AI agent Source: https://github.com/run-llama/semtools/blob/main/README.md Utilize the `semtools ask` command to query documents using an AI agent. It defaults to OpenAI but can be configured for any OpenAI-Compatible API. Requires an OpenAI API key. ```bash semtools ask "What are the main findings?" papers/*.txt ``` ```bash semtools ask "Some question?" *.txt ``` -------------------------------- ### Search for multimodal model mentions Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/1.txt Find papers mentioning 'multimodal model' and display the first 10 results, showing context lines. ```bash find by_date/ -name "*.txt" | xargs grep -i "multimodal.*model" | head -10) ``` -------------------------------- ### Manage SemTools workspace: Use and activate Source: https://github.com/run-llama/semtools/blob/main/README.md Commands to select and activate a workspace for SemTools. Workspaces cache embeddings for faster search over large document collections. Activation involves setting the SEMTOOLS_WORKSPACE environment variable. ```bash semtools workspace use my-workspace ``` ```bash export SEMTOOLS_WORKSPACE=my-workspace ``` -------------------------------- ### Search for Machine Learning Optimization Papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/3.txt Use the 'search' command with a general query to find papers on machine learning optimization. Adjust '--top-k' for the number of results and '--n-lines' for context. ```bash search "machine learning optimization" full_text/*.txt --top-k 10 --n-lines 5 ``` -------------------------------- ### Find first occurrences of 'vision-language model' in titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Prints a header and then searches a chronological title file for 'vision-language', 'vision language', or 'vlm' (case-insensitive), displaying the first 3 matches. ```bash echo "=== VISION-LANGUAGE MODEL ===" && grep -i -E "(vision-language|vision language|vlm)" /tmp/all_titles_chronological.txt | head -3 ``` -------------------------------- ### Run Abstract Similarity Analysis Script Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt Command to execute the Python script 'analyze_abstracts.py' for processing and analyzing paper abstracts. ```bash python analyze_abstracts.py ``` -------------------------------- ### Search ArXiv papers for 'attention mechanisms' Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/1.txt Use the `search` command to find papers discussing a specific topic. Specify the search term, the directory to search in, and optionally parameters like `--top-k` for the number of results and `--n-lines` for context. ```bash search "attention mechanisms" full_text/*.txt --top-k 10 --n-lines 5 ``` -------------------------------- ### Rust Error Handling with Context Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Demonstrates proper error handling in Rust using the `context` method from the `anyhow` crate to add descriptive messages to errors. ```rust // Good: Error handling let config = LlamaParseConfig::from_config_file(&config_path) .context("Failed to load configuration")?; ``` -------------------------------- ### Combine parsing and search with SemTools Source: https://github.com/run-llama/semtools/blob/main/README.md Chain `semtools parse` with `xargs` and `semtools search` to parse files and then perform a semantic search on the parsed content. ```bash semtools parse my_docs/*.pdf | xargs search "API endpoints" ``` -------------------------------- ### Search for 'quantum computing' themes in August 2025 papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/3.txt This command searches for papers related to 'quantum computing' from August 2025. It helps identify emerging topics in advanced computing fields. Adjust '--top-k' and '--n-lines' as needed. ```bash search "quantum computing" by_date/2025-08/*.txt --top-k 5 --n-lines 3 ``` -------------------------------- ### Search for 'emerging' themes in August 2025 papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/3.txt Use the 'search' command to find occurrences of a keyword within papers from a specific month and year. This helps in identifying general emerging themes. Adjust '--top-k' for the number of results and '--n-lines' for context lines. ```bash search "emerging" by_date/2025-08/*.txt --top-k 10 --n-lines 5 ``` -------------------------------- ### Basic Search for Computer Vision Applications Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/5.txt Use this command to perform a broad search for papers on computer vision applications. Adjust `--top-k` and `--max-distance` for result refinement. ```bash search "computer vision applications" full_text/*.txt --top-k 10 --max-distance 0.4 ``` -------------------------------- ### Combine parsing with SemTools ask agent Source: https://github.com/run-llama/semtools/blob/main/README.md Pipe the output of `semtools parse` to `xargs` and then to `semtools ask` to summarize parsed documents. ```bash semtools parse research_papers/*.pdf | xargs ask "Summarize the key methodologies" ``` -------------------------------- ### Find first occurrences of 'federated learning' in titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Prints a header and then searches a chronological title file for the term 'federated' (case-insensitive), displaying the first 3 matches. ```bash echo "=== FEDERATED LEARNING ===" && grep -i "federated" /tmp/all_titles_chronological.txt | head -3 ``` -------------------------------- ### Read paper by 'Baotian_Hu' Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Reads the first 20 lines of a specific paper by 'Baotian_Hu'. ```bash Read(by_author/Baotian_Hu/2506.09790v1_fulltext.txt) ``` -------------------------------- ### Build SemTools Project Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Compile the SemTools project using Cargo, the Rust build tool and package manager. ```bash cargo build ``` -------------------------------- ### Search for Specific Optimization Algorithms Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/3.txt Search for papers related to specific optimization algorithms like 'Adam optimizer' or techniques such as 'neural architecture search' and 'Bayesian optimization'. Use '--top-k' and '--n-lines' to manage results. ```bash search "Adam optimizer" full_text/*.txt --top-k 3 --n-lines 5 ``` ```bash search "neural architecture search" full_text/*.txt --top-k 3 --n-lines 5 ``` ```bash search "Bayesian optimization" full_text/*.txt --top-k 5 --n-lines 5 ``` -------------------------------- ### Search Arxiv for 'Eric Xing' in cs.CL Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Searches the cs.CL category for papers mentioning 'Eric Xing', retrieving the top 3 results with 3 lines of context. ```bash search "Eric Xing" by_category/cs.CL/*.txt --top-k 3 --n-lines 3 ``` -------------------------------- ### List directory contents (by_date) Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Lists the contents of the 'by_date' directory, showing chronological organization of papers. This helps in understanding data structure. ```bash List(by_date) ``` -------------------------------- ### Search for exact term 'meta-learning' Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/3.txt Uses grep to perform a case-insensitive search for the exact term 'meta-learning' within text files, limiting the output to the first 20 matches. This helps in identifying papers that specifically mention the term. ```bash Bash(grep -i "meta-learning" full_text/*.txt | head -20) ``` -------------------------------- ### List directory contents Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/1.txt List the contents of a directory, useful for exploring dataset structure. ```bash List(~/semtools/benchmarks/arxiv/arxiv_dataset_1000_papers) ``` ```bash List(by_date) ``` -------------------------------- ### Read Paper Abstract Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/5.txt Use the `Read` command to fetch the content of a specific paper, useful for examining abstracts and context. Specify the file path and optionally the number of lines to read. ```bash Read(full_text/2508.00917v1.txt) ``` ```bash Read(full_text/2508.10528v1.txt) ``` ```bash Read(full_text/2506.22174v1.txt) ``` -------------------------------- ### Search from Stdin Source: https://github.com/run-llama/semtools/blob/main/examples/example_CLAUDE.md Demonstrates searching for 'content' within text piped to `semtools search` via standard input. ```bash # Search from stdin echo "some text content" | semtools search "content" ``` -------------------------------- ### Arxiv Paper File Sample Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/plain_CLAUDE.md A sample of the full text content from an Arxiv paper, including title, authors, affiliations, abstract, and introduction. Useful for understanding the data format. ```text TITLE: Quantization vs Pruning: Insights from the Strong Lottery Ticket Hypothesis Quantization vs Pruning: Insights from the Strong Lottery Ticket Hypothesis Aakash Kumar Department of Physical Sciences, IISER Kolkata, West Bengal, India 741246 ak20ms209@iiserkol.ac.in & Emanuele Natale Université Coté d’Azur, CNRS, Inria, I3S, France emanuele.natale@univ-cotedazur.fr Abstract Quantization is an essential technique for making neural networks more efficient, yet our theoretical understanding of it remains limited. Previous works demonstrated that extremely low-precision networks, such as binary networks, can be constructed by pruning large, randomly-initialized networks, and showed that the ratio between the size of the original and the pruned networks is at most polylogarithmic. The specific pruning method they employed inspired a line of theoretical work known as the Strong Lottery Ticket Hypothesis (SLTH), which leverages insights from the Random Subset Sum Problem. However, these results primarily address the continuous setting and cannot be applied to extend SLTH results to the quantized setting. In this work, we build on foundational results by Borgs et al. on the Number Partitioning Problem to derive new theoretical results for the Random Subset Sum Problem in a quantized setting. Using these results, we then extend the SLTH framework to finite-precision networks. While prior work on SLTH showed that pruning allows approximation of a certain class of neural networks, we demonstrate that, in the quantized setting, the analogous class of target discrete neural networks can be represented exactly, and we prove optimal bounds on the necessary overparameterization of the initial network as a function of the precision of the target network. 1 Introduction Deep neural networks (DNNs) have become ubiquitous in modern machine-learning systems, yet their ever-growing size quickly collides with the energy, memory, and latency constraints of real-world hardware. Quantization—representing weights with a small number of bits—is arguably the most hardware-friendly compression technique, and recent empirical work shows that aggressive quantization can preserve accuracy even down to the few bits regime. Unfortunately, our theoretical understanding of why and when such extreme precision reduction is possible still lags far behind in practice. ... ``` -------------------------------- ### Pipeline Find with Xargs and Search Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/search_CLAUDE.md Use 'find' to locate files and 'xargs' to pass them as arguments to the 'search' command. This enables searching within files identified by 'find', with options for context lines and distance. ```bash find . -name "*.md" | xargs search "installation" --n-lines 10 --max-distance 0.5 ``` -------------------------------- ### Search Arxiv for Institutions in cs.CV and cs.CL Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Searches the cs.CV and cs.CL categories for papers mentioning specific universities and companies, retrieving the top 8 results with 2 lines of context. ```bash search "University of Washington\|Stanford University\|Google\|Microsoft\|OpenAI" by_category/cs.CV/*.txt by_category/cs.CL/*.txt --top-k 8 --n-lines 2 ``` -------------------------------- ### Run Linting and Formatting Checks Source: https://github.com/run-llama/semtools/blob/main/CONTRIBUTING.md Ensure code quality and consistency by running clippy for linting and fmt for formatting. These checks are part of the pull request validation process. ```bash cargo clippy cargo fmt ``` -------------------------------- ### Search for 'GAN', 'GPT', or 'BERT' in Titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Filters titles for terms like 'GAN', 'GPT', or 'BERT' (case-insensitive) and sorts them numerically. This command is useful for tracking the emergence of specific influential models or architectures. ```bash grep "^TITLE:" full_text/*.txt | sed 's/full_text\/\([0-9]*\)\.[0-9]*v[0-9]*\.txt:TITLE: /\1: /' | grep -i -E "(GAN|GPT|BERT)" | sort -n ``` -------------------------------- ### Set Llama Cloud API Key Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_coding_agents.md Configure your environment by exporting your Llama Cloud API key. This is necessary for Semtools to authenticate with the Llama API. ```bash export LLAMA_CLOUD_API_KEY=your_api_key ``` -------------------------------- ### Ask questions based on stdin content with SemTools Source: https://github.com/run-llama/semtools/blob/main/README.md Feed content directly into `semtools ask` via standard input using `cat` and a pipe. ```bash cat README.md | semtools ask "How do I install SemTools?" ``` -------------------------------- ### Execute Python Script for Simple Topic Analysis Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/5.txt This bash command runs a Python script that analyzes topic shifts for authors who published in multiple months. It provides feedback on the analysis progress. ```bash python3 simple_topic_analysis.py ``` -------------------------------- ### Read file content Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Use 'Read' to display the content of a specified file. Reads up to 50 lines. ```bash Read(by_category/cs.CV/2507.22264v1_fulltext.txt) ``` ```bash Read(by_category/cs.CL/2506.22385v1_fulltext.txt) ``` -------------------------------- ### Update and re-embed documents in SemTools workspace Source: https://github.com/run-llama/semtools/blob/main/README.md Demonstrates how changing a document (e.g., adding content) triggers automatic re-embedding and caching when performing a search in an activated workspace. ```bash echo "some new content" > ./some_large_dir/some_file.txt semtools search "some keywords" ./some_large_dir/*.txt --n-lines 5 --top-k 10 ``` -------------------------------- ### Combine Parse, Grep, and Search Source: https://github.com/run-llama/semtools/blob/main/examples/example_CLAUDE.md Combines `semtools parse`, `grep` for exact-match pre-filtering, and `semtools search` with a distance threshold to find 'network error' in parsed PDF documents. ```bash # Combine with grep for exact-match pre-filtering and distance thresholding semtools parse *.pdf | xargs cat | grep -i "error" | semtools search "network error" --max-distance 0.3 ``` -------------------------------- ### Execute simple abstract analysis script Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/4.txt This command executes the simple Python script for abstract analysis after navigating to the specified directory. It loads and processes papers from June and August. ```bash cd "/Users/loganmarkewich/semtools/benchmarks/arxiv/arxiv_dataset_1000_papers" && python3 simple_abstract_analysis.py ``` -------------------------------- ### Search Arxiv for 'Eric P. Xing' or 'Eric Xing' in cs.CL Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/5.txt Searches the cs.CL category for papers mentioning 'Eric P. Xing' or 'Eric Xing', retrieving the top 5 results with 3 lines of context. ```bash search "Eric P. Xing\|Eric Xing" by_category/cs.CL/*.txt --top-k 5 \ --n-lines 3 ``` -------------------------------- ### Find first occurrences of 'GAN' or 'generative adversarial' in titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Prints a header and then searches a chronological title file for 'gan' or 'generative adversarial' (case-insensitive), displaying the first 3 matches. ```bash echo "=== GAN/GENERATIVE ADVERSARIAL ===" && grep -i -E "(gan|generative adversarial)" /tmp/all_titles_chronological.txt | head -3 ``` -------------------------------- ### Claude Code Interaction Trace Source: https://github.com/run-llama/semtools/blob/main/examples/use_with_coding_agents.md This trace shows a simulated interaction with Claude Code, demonstrating its ability to understand a task, explore a directory, parse PDFs, and search for information using semtools commands. ```bash ╭────────────────────────────────────────────────────────────────╮ │ ✻ Welcome to Claude Code! │ │ │ │ /help for help, /status for your current setup │ │ │ │ cwd: /Users/loganmarkewich/filesystem-index/acl_papers_2023 │ ╰────────────────────────────────────────────────────────────────╯ > Currently you are in a directory full of PDF files containing papers from ACL 2023. Can you summarize the findings from these papers that discuss LLMs and evals? ⏺ I'll help you summarize findings from ACL 2023 papers about LLMs and evaluations. Let me first explore the directory structure and then search for relevant papers. ⏺ Update Todos ⎿  ☐ Explore directory structure to understand the PDF files ☐ Parse PDF files to make them searchable ☐ Search for papers discussing LLMs and evaluations ☐ Analyze and summarize key findings ⏺ List(~/filesystem-index/acl_papers_2023) ⎿  Listed 914 paths (ctrl+r to expand) ⏺ Update Todos ⎿  ☒ Explore directory structure to understand the PDF files ☐ Parse PDF files to make them searchable ☐ Search for papers discussing LLMs and evaluations ☐ Analyze and summarize key findings ⏺ I can see there are 910 ACL 2023 papers in PDF format. Now I'll parse all these PDFs to make them searchable, then look for papers discussing LLMs and evaluations. ⏺ Bash(semtools parse *.pdf) ⎿  /Users/loganmarkewich/.parse/2023.acl-long.0.pdf.md /Users/loganmarkewich/.parse/2023.acl-long.1.pdf.md /Users/loganmarkewich/.parse/2023.acl-long.10.pdf.md … +556 lines (ctrl+r to expand) ⏺ Update Todos ⎿  ☒ Explore directory structure to understand the PDF files ☒ Parse PDF files to make them searchable ☐ Search for papers discussing LLMs and evaluations ☐ Analyze and summarize key findings ⏺ Great! Now I have parsed all the PDFs. Let me search for papers related to LLMs and evaluations using the search tool. ⏺ Bash(semtools parse *.pdf | xargs cat | semtools search "large language model, evaluation, assessment, benchmark" --n-lines 5 --max-distance 0.4) ⎿  :447094::447105 (0.16900031210055844) 447095: for Computational Linguistics. 447096: … +415 lines (ctrl+r to expand) ⏺ Now let me search for more specific terms to get a broader view of LLM evaluation research: ⏺ Bash(semtools parse *.pdf | xargs cat | semtools search "GPT, BERT, language model evaluation, performance evaluation, model comparison" --n-lines 5 --max-distance 0.35) ⎿  :244769::244780 (0.2719643874147169) 244770: 244771: - Reference-free and reference-based human evaluation results have a near-zero correlation.
… +630 lines (ctrl+r to expand) ⏺ Now let me search for specific types of evaluation studies and findings: ⏺ Bash(semtools parse *.pdf | xargs cat | semtools search "robustness, bias, fairness, hallucination, reliability" --n-lines 4 --max-distance 0.3) ⎿  Using cached result for: 2023.acl-long.0.pdf Using cached result for: 2023.acl-long.1.pdf Using cached result for: 2023.acl-long.10.pdf … +639 lines (ctrl+r to expand) ⏺ Now let me focus on a few specific papers to get key titles and detailed findings: ⏺ Update Todos ⎿  ☒ Explore directory structure to understand the PDF files ☒ Parse PDF files to make them searchable ☒ Search for papers discussing LLMs and evaluations ☐ Analyze and summarize key findings ⏺ Let me search for paper titles and abstracts to get a better understanding of the specific papers discussing LLM evaluation: ⏺ Bash(semtools parse *.pdf | xargs cat | semtools search "Abstract" --n-lines 10 | grep -A 10 -B 2 -i "large language model\|evaluation\|benchmark\|GPT\|BERT") ⎿  :94456::94477 (0.00000000009809730805202874) 94457: Plan-and-Solve Prompting: Improving Zero-Shot Chain-of-Thought 94458: Reasoning by Large Language Models … +628 lines (ctrl+r to expand) ⏺ Update Todos ⎿  ☒ Explore directory structure to understand the PDF files ``` -------------------------------- ### Find first occurrences of 'LLM' or 'large language model' in titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Prints a header and then searches a chronological title file for 'llm' or 'large language model' (case-insensitive), displaying the first 3 matches. ```bash echo "=== LLM/LARGE LANGUAGE MODEL ===" && grep -i -E "(llm|large language model)" /tmp/all_titles_chronological.txt | head -3 ``` -------------------------------- ### Read Paper Abstract (Command) Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/1.txt Initiates reading the abstract of a specified paper file. Reads a default number of lines. ```command Read(full_text/2505.20291v1.txt) ``` ```command Read(full_text/2505.20292v4.txt) ``` ```command Read(full_text/2506.09736v1.txt) ``` ```command Read(full_text/2506.10116v1.txt) ``` ```command Read(full_text/2507.09617v1.txt) ``` ```command Read(full_text/2508.21720v1.txt) ``` -------------------------------- ### Search for Object Detection Papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/a_search_and_filter/5.txt Use this command to find papers specifically on object detection, a key area within computer vision. Adjust `--top-k` as needed. ```bash search "object detection" full_text/*.txt --top-k 5 ``` -------------------------------- ### Search for 'generative AI' themes in August 2025 papers Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/3.txt Use this command to search for 'generative AI' related content in August 2025 papers. This helps in identifying trends in AI content creation. Adjust '--top-k' and '--n-lines' for specific results. ```bash search "generative AI" by_date/2025-08/*.txt --top-k 8 --n-lines 3 ``` -------------------------------- ### Search for 'LLM' or 'language model' in Titles Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/c_temporal_analysis/2.txt Filters titles for 'LLM' or 'language model' (case-insensitive) and displays the first 15 results sorted numerically. This is useful for tracking the discourse around large language models. ```bash grep "^TITLE:" full_text/*.txt | sed 's/full_text\/\([0-9]*\)\.[0-9]*v[0-9]*\.txt:TITLE: /\1: /' | grep -i -E "(LLM|language model)" | sort -n | head -15 ``` -------------------------------- ### Find papers with similar abstracts to a target paper Source: https://github.com/run-llama/semtools/blob/main/benchmarks/arxiv/answers/b_cross_reference_and_relationships/1.txt Use this command to initiate a search for papers with abstracts semantically similar to a specified paper. The tool first locates and reads the target paper's abstract before performing the search. ```bash > Find papers with similar abstracts to paper 2506.09738v1 ```