cloud-sql-postgres-vectorassist

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Usage

使用方法

All scripts can be executed using Node.js. Replace
<param_name>
and
<param_value>
with actual values.
Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'
PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'
Note: The scripts automatically load the environment variables from various .env files. Do not ask the user to set vars unless skill executions fails due to env var absence.
所有脚本均可通过Node.js执行。将
<param_name>
<param_value>
替换为实际值。
Bash:
node <skill_dir>/scripts/<script_name>.js '{"<param_name>": "<param_value>"}'
PowerShell:
node <skill_dir>/scripts/<script_name>.js '{\"<param_name>\": \"<param_value>\"}'
注意:脚本会自动从多个.env文件加载环境变量。除非因缺少环境变量导致技能执行失败,否则无需要求用户设置变量。

Scripts

脚本

apply_spec

apply_spec

This tool automatically executes all the SQL recommendations associated with a specific vector specification (spec_id) or table. It runs the necessary commands in the correct sequence to provision the workload, marking each step as applied once successful. Use this tool when the user has reviewed the generated recommendations from a defined (or modified) spec and is ready to apply the changes directly to their database instance to finalize the vector search setup. This tool can be used as a follow-up action after invoking the 'define_spec' or 'modify_spec' tool.
该工具会自动执行与特定向量规格(spec_id)或表相关的所有SQL建议。它会按正确顺序运行必要的命令来部署工作负载,成功完成每个步骤后会标记为已应用。当用户已查看从已定义(或修改)的规格生成的建议,并准备直接将更改应用到数据库实例以完成向量搜索设置时,可使用此工具。此工具可作为调用
define_spec
modify_spec
工具后的后续操作。

Parameters

参数

NameTypeDescriptionRequiredDefault
spec_idstringThe unique ID of the vector specification to apply.No
table_namestringThe name of the table to apply the vector specification to (in case of a single spec defined on the table).No
column_namestringThe text_column_name or vector_column_name of the spec to identify the exact spec in case there are multiple specs defined on a table.No
schema_namestringThe schema name for the table.No

名称类型描述必填默认值
spec_idstring要应用的向量规格的唯一ID。
table_namestring要应用向量规格的表名(适用于表上仅定义了单个规格的情况)。
column_namestring当表上定义了多个规格时,用于标识具体规格的text_column_name或vector_column_name。
schema_namestring表所属的模式名。

define_spec

define_spec

This tool defines a new vector specification by capturing the user's intent and requirements for a vector search workload. This generates a complete, ordered set of SQL recommendations required to set up the database, embeddings, and vector indexes. While highly customizable, any optional parameters left unspecified will use internally determined defaults optimized for the specific workload. Use this tool at the very beginning of the vector setup process when a user first wants to configure a table for vector search, generate embeddings, or create a new vector index.
该工具通过捕捉用户对向量搜索工作负载的需求和要求,定义新的向量规格。它会生成一套完整、有序的SQL建议,用于设置数据库、嵌入模型和向量索引。虽然高度可自定义,但任何未指定的可选参数都将使用针对特定工作负载优化的内部默认值。当用户首次想要为表配置向量搜索、生成嵌入向量或创建新的向量索引时,可在向量设置流程的最开始使用此工具。

Parameters

参数

NameTypeDescriptionRequiredDefault
table_namestringTable name on which vector workload needs to be set up.Yes
schema_namestringSchema containing the given table.No
spec_idstringUnique ID for the vector spec. Auto-generated, if not specified.No
vector_column_namestringColumn name for the column with vector embeddings.No
text_column_namestringColumn name for the column with text on which vector search needs to be set up.No
vector_index_typestringType of the vector index to be created (Allowed inputs: 'hnsw', 'ivfflat', 'scann').No
embeddings_availablebooleanBoolean parameter to know if vector embeddings are already available in the table.No
num_vectorsintegerNumber of vectors expected in the dataset.No
dimensionalityintegerIf vectors are already generated, set to dimension of vectors. If not, set to dimensionality of the embedding_model.No
embedding_modelstringOptional parameter: Model to be used for generating embeddings. If not provided, it has an internally selected default value.No
prefilter_column_namesarrayColumns based on which prefiltering will happen in vector search queries.No
distance_funcstringDistance function to be used for comparing vectors (Allowed inputs: 'cosine', 'ip', 'l2', 'l1').No
quantizationstringQuantization to be used for creating the vector indexes (Allowed inputs: 'none', 'halfvec', 'bit').No
memory_budget_kbintegerMaximum size in KB that the index can consume in memory while building.No
target_recallfloatThe recall that the user would like to target with the given index for standard vector queries.No
target_top_kintegerThe top-K values that need to be retrieved for the given query.No
tune_vector_indexbooleanBoolean parameter to specify if the auto tuning is required for the index.No

名称类型描述必填默认值
table_namestring需要设置向量工作负载的表名。
schema_namestring包含该表的模式。
spec_idstring向量规格的唯一ID。若未指定,将自动生成。
vector_column_namestring存储向量嵌入的列名。
text_column_namestring需要设置向量搜索的文本列名。
vector_index_typestring要创建的向量索引类型(允许输入:'hnsw'、'ivfflat'、'scann')。
embeddings_availableboolean用于判断表中是否已存在向量嵌入的布尔参数。
num_vectorsinteger数据集中预期的向量数量。
dimensionalityinteger若向量已生成,设置为向量的维度;若未生成,设置为embedding_model的维度。
embedding_modelstring可选参数:用于生成嵌入向量的模型。若未提供,将使用内部选定的默认值。
prefilter_column_namesarray向量搜索查询中用于预过滤的列。
distance_funcstring用于比较向量的距离函数(允许输入:'cosine'、'ip'、'l2'、'l1')。
quantizationstring用于创建向量索引的量化方式(允许输入:'none'、'halfvec'、'bit')。
memory_budget_kbinteger索引构建时可占用的最大内存大小(KB)。
target_recallfloat用户希望该索引在标准向量查询中达到的召回率。
target_top_kinteger查询需要返回的Top-K值。
tune_vector_indexboolean指定是否需要对索引进行自动调优的布尔参数。

execute_sql

execute_sql

Use this tool to execute a single SQL statement.
使用此工具执行单个SQL语句。

Parameters

参数

NameTypeDescriptionRequiredDefault
sqlstringThe sql to execute.Yes

名称类型描述必填默认值
sqlstring要执行的SQL语句。

generate_query

generate_query

This tool generates optimized SQL queries for vector search by leveraging the metadata and vector specifications defined in a specific spec_id. It may return a single query or a sequence of multiple SQL queries that can be executed sequentially. Use this tool when a user wants to perform semantic or similarity searches on their data. It serves as the primary actionable tool to invoke for generating the executable SQL required to retrieve relevant results based on vector similarity. The 'execute_sql' tool can be used as a follow-up action after invoking this tool.
该工具利用特定spec_id中定义的元数据和向量规格,生成优化的向量搜索SQL查询。它可能返回单个查询或多个可按顺序执行的SQL查询序列。当用户想要对数据执行语义搜索或相似度搜索时,可使用此工具。这是生成基于向量相似度检索相关结果所需可执行SQL的主要工具。调用此工具后,可使用
execute_sql
工具作为后续操作。

Parameters

参数

NameTypeDescriptionRequiredDefault
spec_idstringGenerate the vector query corresponding to this vector spec.No
table_namestringGenerate the vector query corresponding to this table (in case of a single spec defined on the table).No
schema_namestringSchema name for the table related to the vector query generation.No
column_namestringtext_column_name or vector_column_name of the spec to identify the exact spec in case there are multiple specs defined on a table.No
search_textstringText search for which query needs to be generated. Embeddings are generated using the model defined in the vector spec.No
search_vectorstringVector for which query needs to be generated. Only one of search_text or search_vector must be populated.No
output_column_namesarrayColumn names to retrieve in the output search query. Defaults to retrieving all columns.No
top_kintegerNumber of nearest neighbors to be returned in the vector search query. Defaults to 10.No
filter_expressionsarrayAny filter expressions to be applied on the vector search query.No
target_recallfloatThe recall that the user would like to target with the given query. Overrides the spec-level target_recall.No
iterative_index_searchbooleanPerform iterative index search for filtered queries to ensure enough results are returned.No

名称类型描述必填默认值
spec_idstring生成与此向量规格对应的向量查询。
table_namestring生成与此表对应的向量查询(适用于表上仅定义了单个规格的情况)。
schema_namestring与向量查询生成相关的表所属的模式名。
column_namestring当表上定义了多个规格时,用于标识具体规格的text_column_name或vector_column_name。
search_textstring需要生成查询的文本搜索内容。将使用向量规格中定义的模型生成嵌入向量。
search_vectorstring需要生成查询的向量。search_text和search_vector必须且只能填写其中一个。
output_column_namesarray搜索查询结果中需要返回的列名。默认返回所有列。
top_kinteger向量搜索查询中需要返回的最近邻数量。默认值为10。
filter_expressionsarray要应用于向量搜索查询的过滤表达式。
target_recallfloat用户希望该查询达到的召回率。将覆盖规格级别的target_recall。
iterative_index_searchboolean对过滤后的查询执行迭代索引搜索,以确保返回足够的结果。

modify_spec

modify_spec

This tool modifies an existing vector specification (identified by a required spec_id) with new parameters or overrides. Upon modification, it automatically recalculates and refreshes the list of generated SQL recommendations to match the updated requirements. This tool provides a way to modify column(s) in the vector spec before applying and taking action on the recommendations. While highly customizable, any optional parameters left unspecified will use internally determined defaults optimized for the specific workload. Use this tool to modify configurations established via 'define_spec' tool such as adjusting target recall, embedding models, or quantization settings, etc.
该工具使用新参数或覆盖现有参数来修改现有向量规格(由必填的spec_id标识)。修改后,它会自动重新计算并刷新生成的SQL建议列表,以匹配更新后的需求。此工具提供了在应用建议并采取行动前修改向量规格中列的方法。虽然高度可自定义,但任何未指定的可选参数都将使用针对特定工作负载优化的内部默认值。可使用此工具修改通过
define_spec
工具建立的配置,例如调整目标召回率、嵌入模型或量化设置等。

Parameters

参数

NameTypeDescriptionRequiredDefault
spec_idstringUnique ID for the vector spec you want to modify.Yes
table_namestringModify the table name on which vector workload needs to be set up.No
schema_namestringModify the schema containing the given table.No
vector_column_namestringModify the column name for the column with vector embeddings.No
text_column_namestringModify the column name for the column with text on which vector search needs to be set up.No
vector_index_typestringModify the type of the vector index to be created (Allowed inputs: 'hnsw', 'ivfflat', 'scann').No
embeddings_availablebooleanModify whether vector embeddings are already available in the table.No
num_vectorsintegerModify the number of vectors expected in the dataset.No
dimensionalityintegerModify the dimensionality of the vectors or embedding model.No
embedding_modelstringModify the model used for generating embeddings.No
prefilter_column_namesarrayModify the column(s) based on which prefiltering will happen in vector search queries.No
distance_funcstringModify the distance function to be used for comparing vectors (Allowed inputs: 'cosine', 'ip', 'l2', 'l1').No
quantizationstringModify the quantization to be used for creating the vector indexes (Allowed inputs: 'none', 'halfvec', 'bit').No
memory_budget_kbintegerModify the maximum size that the index can consume in memory while building.No
target_recallfloatModify the recall that the user would like to target with the given index.No
target_top_kintegerModify the Top-K matching values that need to be retrieved for the given query.No
tune_vector_indexbooleanModify whether to tune vector index build and search parameters.No

名称类型描述必填默认值
spec_idstring要修改的向量规格的唯一ID。
table_namestring修改需要设置向量工作负载的表名。
schema_namestring修改包含该表的模式。
vector_column_namestring修改存储向量嵌入的列名。
text_column_namestring修改需要设置向量搜索的文本列名。
vector_index_typestring修改要创建的向量索引类型(允许输入:'hnsw'、'ivfflat'、'scann')。
embeddings_availableboolean修改表中是否已存在向量嵌入。
num_vectorsinteger修改数据集中预期的向量数量。
dimensionalityinteger修改向量或嵌入模型的维度。
embedding_modelstring修改用于生成嵌入向量的模型。
prefilter_column_namesarray修改向量搜索查询中用于预过滤的列。
distance_funcstring修改用于比较向量的距离函数(允许输入:'cosine'、'ip'、'l2'、'l1')。
quantizationstring修改用于创建向量索引的量化方式(允许输入:'none'、'halfvec'、'bit')。
memory_budget_kbinteger修改索引构建时可占用的最大内存大小。
target_recallfloat修改用户希望该索引达到的召回率。
target_top_kinteger修改查询需要返回的Top-K匹配值。
tune_vector_indexboolean修改是否需要调优向量索引的构建和搜索参数。