Teradata Package for LangChain Function Reference - set_vectordistance_search_params - Teradata® Package for LangChain - Look here for syntax, methods and examples for the functions included in the Teradata langchain-teradata package.

Teradata® Package for LangChain Function Reference

Deployment
VantageCloud
Edition
Enterprise
Product
Teradata® Package for LangChain
Release Number
20.00.00.01
Published
December 2025
ft:locale
en-US
ft:lastEdition
2025-12-19
dita:id
Langchain-Teradata_FxRef_Lake
Product Category
Teradata Vantage
libs.teradata.langchain_teradata.TeradataVectorStore.set_vectordistance_search_params = set_vectordistance_search_params(self, **kwargs)
DESCRIPTION:
    Sets the search parameters for VECTORDISTANCE search algorithm.
 
PARAMETERS:
    search_threshold:
        Optional Argument.
        Threshold value to consider matching tables/views while searching.
        A higher threshold value limits responses to the top matches only.
        Types: float
 
    metric:
        Optional Argument.
        Specifies the metric to be used for calculating the distance
        between the vectors.
        Default Value: COSINE
        Permitted Values: EUCLIDEAN, COSINE, DOTPRODUCT
        Types: str
 
    search_algorithm:
        Optional Argument.
        Specifies the algorithm to be used for searching the
        tables and views relevant to the question.
        Default Value: VECTORDISTANCE
        Permitted Values: VECTORDISTANCE, KMEANS, HNSW
        Types: str
 
    top_k:
        Optional Argument.
        Specifies the number of top clusters to be considered while searching.
        Default Value: 10
        Permitted Values: [1, 1024]
        Types: int
 
    rerank_weight:
        Optional Argument.
        Specifies the weight to be used for reranking the search results.
        Applicable range is 0.0 to 1.0.
        Default Value: 0.2
        Types: float
 
    relevance_top_k:
        Optional Argument.
        Specifies the number of top similarity matches to be considered for reranking.
        Applicable range is 1 to 1024.
        Default Value: max(top_k*2, 60)
        Permitted Values: [1, 1024]
        Types: int
 
    relevance_search_threshold:
        Optional Argument.
        Specifies the threshold value to consider matching tables/views while reranking.
        A higher threshold value limits responses to the top matches only.
        Types: float
 
    maximal_marginal_relevance:
        Optional Argument.
        Specifies whether to use Maximal Marginal Relevance (MMR) for retrieving documents.
        Types: bool
 
    lambda_multiplier:
        Optional Argument.
        Specifies lambda multiplier to control the trade-off between relevance and diversity when selecting documents.
        Permitted Values: 0.0 to 1.0
        Types: float
 
RETURNS:
    None.
 
RAISES:
    TeradataMlException.
 
EXAMPLES:
    # Load necessary imports.
    >>> from langchain_teradata import TeradataVectorStore
    >>> from teradatagenai import load_data
 
    # Load data into the vector store.
    >>> load_data("amazon", "amazon_reviews_25")
 
    # Note this step is not needed if vector store already exists.
    >>> vs = TeradataVectorStore.from_datasets(name = "tdvs_vectordistance",
                                               data="amazon_reviews_25",
                                               key_columns=['rev_id', 'aid'],
                                               data_columns=['rev_text'],
                                               embedding = "amazon.titan-embed-text-v1",
                                               )
 
    # Set the VECTORDISTANCE search parameters.
    >>> vs.set_vectordistance_search_params(search_threshold = 0.1,
                                            rerank_weight = 0.4)