Files
genai-toolbox/docs/en/resources/sources/http.md
Wenxin Du eadb678a7b feat: Support env replacement for tool.yaml (#462)
Environment variable replacement is needed so that users don't have to
hardcode their secrets in configuring `tools.yaml`.
Both formats `$ENV_NAME` and `${ENV_NAME}` are standard ways to declare
an environment variable.
However, some database statement placeholders that are already using the
`$ENV_NAME` format.
Therefore, we only support env var declaration using `${ENV_NAME}` to
disambiguate it from other usages.

Fixes issue: https://github.com/googleapis/genai-toolbox/issues/431
2025-04-23 07:33:02 -04:00

2.1 KiB

title, linkTitle, type, weight, description
title linkTitle type weight description
HTTP HTTP docs 1 The HTTP source enables the Toolbox to retrieve data from a remote server using HTTP requests.

About

The HTTP Source allows Toolbox to retrieve data from arbitrary HTTP endpoints. This enables Generative AI applications to access data from web APIs and other HTTP-accessible resources.

Example

sources:
  my-http-source:
    kind: http
    baseUrl: https://api.example.com/data
    timeout: 10s # default to 30s
    headers:
      Authorization: Bearer ${API_KEY}
      Content-Type: application/json
    queryParams:
      param1: value1
      param2: value2

{{< notice tip >}} Use environment variable replacement with the format ${ENV_NAME} instead of hardcoding your secrets into the configuration file. {{< /notice >}}

Reference

field type required description
kind string true Must be "http".
baseUrl string true The base URL for the HTTP requests (e.g., https://api.example.com).
timeout string false The timeout for HTTP requests (e.g., "5s", "1m", refer to ParseDuration for more examples). Defaults to 30s.
headers map[string]string false Default headers to include in the HTTP requests.
queryParams map[string]string false Default query parameters to include in the HTTP requests.