CYarros10 opened a new pull request, #41908: URL: https://github.com/apache/airflow/pull/41908
The [CountTokens API](https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/count-tokens?hl=en) calculates the number of input tokens before sending a request to the Gemini API. Use the CountTokens API to prevent requests from exceeding the model context window, and estimate potential costs based on billable characters. Can be used as part of a larger LLM-based DAG: Training Dataset Lands --> GCSObjectExistenceSensor --> [SupervisedFineTuningTrainOperator](https://github.com/apache/airflow/blob/0f5c25b416f23c6fdc2ab20cba6a147eccaabe2d/airflow/providers/google/cloud/operators/vertex_ai/generative_model.py#L577) --> Use CountTokensOperator as a pre-check to ensure prompts will run successfully and within budget --> [GenerativeModelGenerateContentOperator](https://github.com/apache/airflow/blob/0f5c25b416f23c6fdc2ab20cba6a147eccaabe2d/airflow/providers/google/cloud/operators/vertex_ai/generative_model.py#L502) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
