Returns a dictionary of HTTP headers for tracking API requests. These headers are used to identify HTTP calls made by ADK towards Vertex AI LLM APIs.
()
| 18 | |
| 19 | |
| 20 | def get_tracking_headers() -> dict[str, str]: |
| 21 | """Returns a dictionary of HTTP headers for tracking API requests. |
| 22 | |
| 23 | These headers are used to identify HTTP calls made by ADK towards |
| 24 | Vertex AI LLM APIs. |
| 25 | """ |
| 26 | labels = get_client_labels() |
| 27 | header_value = " ".join(labels) |
| 28 | return { |
| 29 | "x-goog-api-client": header_value, |
| 30 | "user-agent": header_value, |
| 31 | } |
| 32 | |
| 33 | |
| 34 | def merge_tracking_headers(headers: dict[str, str] | None) -> dict[str, str]: |