Skip to content

Commit ef14270

Browse files
Merge pull request #14448 from vvidovic/propagate_metadata_to_vertexai_labels_docs
Describing the `labels` field use in the Vertex AI
2 parents 2563c0a + e6a6300 commit ef14270

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/my-website/docs/providers/vertex.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2758,6 +2758,44 @@ curl http://localhost:4000/v1/fine_tuning/jobs \
27582758
</Tabs>
27592759

27602760

2761+
## Labels
2762+
2763+
2764+
Google enables you to add custom metadata to its `generateContent` and `streamGenerateContent` calls.
2765+
This mechanism is useful in Vertex AI because it allows costs and usage tracking over multiple
2766+
different applications or users.
2767+
2768+
2769+
### Usage
2770+
2771+
You can use that feature through LiteLLM by sending `labels` or `metadata` field in your requests.
2772+
2773+
If the client sets the `labels` field in the request to the LiteLLM,
2774+
the LiteLLM will pass the `labels` field to the Vertex AI backend.
2775+
2776+
If the client sets the `metadata` field in the request to the LiteLLM and the `labels` field is not set,
2777+
the LiteLLM will create the `labels` field filled with `metadata` key/value pairs for all string values and
2778+
pass it to the Vertex AI backend.
2779+
2780+
2781+
Here is an example JSON request demonstrating the labels usage:
2782+
2783+
```json
2784+
{
2785+
"model": "gemini-2.0-flash-lite",
2786+
"messages": [
2787+
{ "role": "user", "content": "respond in 20 words. who are you?" }
2788+
],
2789+
"labels": {
2790+
"client_app": "acme_comp_financial_app",
2791+
"department": "finance",
2792+
"project": "acme_ai"
2793+
}
2794+
}
2795+
```
2796+
2797+
2798+
27612799
## Extra
27622800

27632801
### Using `GOOGLE_APPLICATION_CREDENTIALS`

0 commit comments

Comments
 (0)