
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
fastvs
Advanced tools
FastVS (Fast Vector Search) is a Python library designed for exact vector search in dataframes or tables. It provides functionality to work with both PyArrow Tables and Pandas DataFrames, allowing users to perform nearest neighbor searches using various distance metrics. It is most optimized for PyArrow Tables, as it uses the Rust Arrow library under the hood for zero-copy and vectorized computation.
FastVS can be installed using pip:
pip install fastvs
FastVS offers the following main functions:
search_arrowSearches a PyArrow Table for the k nearest neighbors of a query point.
table (pyarrow.Table): The table to search.column_name (str): This column should be a list or np array type column, where each element is a vector of floats.query_point (list or np array): The query point.k (int): The number of nearest neighbors to return.metric (str): The metric to use for the search (e.g., "euclidean", "manhattan", "cosine_similarity", "inner_product").import pyarrow as pa
from fastvs import search_arrow
indices, distances = search_arrow(your_pyarrow_table, "your_column", [1.0, 2.0], 5, "cosine_similarity")
search_pandasSearches a Pandas DataFrame for the k nearest neighbors of a query point. This function uses search_table under the hood. Note that this function is slower than search_arrow due to the copying of data from the DataFrame to the Arrow table format.
df (pandas.DataFrame): The DataFrame to search.column_name (str): The column name to search. This column should be a list or np array type column, where each element is a vector of floats.query_point (list or np array): The query point.k (int): The number of nearest neighbors to return.metric (str): The metric to use for the search.import pandas as pd
from fastvs import search_pandas
df = pd.read_csv("your_dataset.csv")
indices, distances = search_pandas(df, "your_column", [1.0, 2.0], 5, "cosine_similarity")
apply_distance_arrowApplies a distance function to a PyArrow table and returns an array of distances.
table (pyarrow.Table): The table to search.column_name (str): The column name to search. This column should be a list or np array type column, where each element is a vector of floats.query_point (list or np array): The query point.metric (str): The metric to use for the search.import pyarrow as pa
from fastvs import apply_distance_arrow
table = pa.Table.from_pandas(your_dataframe)
distances = apply_distance_arrow(table, "your_column", [1.0, 2.0], "euclidean")
apply_distance_pandasApplies a distance function to a Pandas DataFrame and returns a Series of distances. Uses apply_distance_arrow under the hood.
df (pandas.DataFrame): The DataFrame to search.column_name (str): The column name to search. This column should be a list or np array type column, where each element is a vector of floats.query_point (list or np array): The query point.metric (str): The metric to use for the search.import pandas as pd
from fastvs import apply_distance_pandas
df = pd.read_csv("your_dataset.csv")
distances = apply_distance_pandas(df, "your_column", [1.0, 2.0], "euclidean")
FastVS supports various distance metrics, including:
The Euclidean distance between two points $P$ and $Q$ in $N$-dimensional space, with $P = (p_1, p_2, ..., p_N)$ and $Q = (q_1, q_2, ..., q_N)$, is defined as:
d(P, Q) = \sqrt{\sum_{i=1}^{N} (p_i - q_i)^2}
The Manhattan distance (also known as L1 norm) between two points $P$ and $Q$ in $N$-dimensional space is the sum of the absolute differences of their Cartesian coordinates:
d(P, Q) = \sum_{i=1}^{N} |p_i - q_i|
Cosine similarity measures the cosine of the angle between two vectors$P$and$Q$in an$N$-dimensional space. It is defined as:
\text{Cosine Similarity}(P, Q) = \frac{P \cdot Q}{\|P\| \|Q\|}
where$P \cdot Q$is the dot product of vectors $P$ and $Q$, and $|P|$ and $|Q|$ are the magnitudes (Euclidean norms) of vectors $P$ and $Q$, respectively.
The inner product (or dot product) between two vectors$P$and$Q$in an$N$-dimensional space is defined as the sum of the products of their corresponding components:
\text{Inner Product}(P, Q) = P \cdot Q = \sum_{i=1}^{N} p_i q_i
Contributions to FastVS are welcome! Please submit your pull requests to the repository or open an issue for any bugs or feature requests.
To Dos:
FastVS is released under the MIT License. See the LICENSE file in the repository for more details.
FAQs
Unknown package
We found that fastvs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.