Skip to main content
Version: V1.1.0

Tencent Hunyuan

Tencent Hunyuan is a general-purpose large language model developed by Tencent. It performs well on content generation, math and logic, code generation, and multi-turn dialogue. The embedding API (GetEmbedding) converts input text into 1024-dimensional vectors, which you can use for RAG, agent memory, and other applications that rely on semantic understanding.

tip

Using Tencent Hunyuan service requires you to follow Tencent Cloud's pricing rules and may incur corresponding fees. Before proceeding, please visit their official website or refer to relevant documentation to confirm and accept their pricing standards. If you do not agree, please do not proceed.

Dependencies and authentication

  • Install the pyseekdb package.
  • Create a Tencent Hunyuan API key for authentication.

Example: create a Tencent Hunyuan embedding function

Import and initialize TencentHunyuanEmbeddingFunction. Authentication is usually provided via environment variables.

  • Basic usage

    Initialization without arguments uses the default environment variable HUNYUAN_API_KEY for the API key.

    from pyseekdb.utils.embedding_functions import TencentHunyuanEmbeddingFunction

    ef = TencentHunyuanEmbeddingFunction()
  • Custom configuration

    You can override the environment variable name and set optional parameters such as timeout. When using separate secret ID and secret key, use secret_id_env and secret_key_env to specify their environment variable names.

    from pyseekdb.utils.embedding_functions import TencentHunyuanEmbeddingFunction

    ef = TencentHunyuanEmbeddingFunction(
    api_key_env="HUNYUAN_API_KEY",
    timeout=30
    )

Parameters:

  • model_name: Tencent Hunyuan embedding model name.
  • api_key_env: Environment variable name for the API key (default: HUNYUAN_API_KEY).
  • timeout: Request timeout (seconds), optional.