Skip to content

Commit

Permalink
Internal change
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 705154677
  • Loading branch information
Langfun Authors committed Dec 11, 2024
1 parent db16016 commit 2f069a0
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions langfun/core/llms/vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

# https://cloud.google.com/vertex-ai/generative-ai/pricing
# describes that the average number of characters per token is about 4.
AVGERAGE_CHARS_PER_TOEKN = 4
AVGERAGE_CHARS_PER_TOKEN = 4


# Price in US dollars,
Expand Down Expand Up @@ -102,6 +102,18 @@
cost_per_1k_input_chars=0.000125,
cost_per_1k_output_chars=0.000375,
),
# TODO(sharatsharat): Update costs when published
'gemini-exp-1206': pg.Dict(
rpm=20,
cost_per_1k_input_chars=0.000,
cost_per_1k_output_chars=0.000,
),
# TODO(sharatsharat): Update costs when published
'gemini-2.0-flash-exp': pg.Dict(
rpm=20,
cost_per_1k_input_chars=0.000,
cost_per_1k_output_chars=0.000,
),
# TODO(chengrun): Set a more appropriate rpm for endpoint.
'vertexai-endpoint': pg.Dict(
rpm=20,
Expand Down Expand Up @@ -215,7 +227,7 @@ def estimate_cost(
return (
cost_per_1k_input_chars * num_input_tokens
+ cost_per_1k_output_chars * num_output_tokens
) * AVGERAGE_CHARS_PER_TOEKN / 1000
) * AVGERAGE_CHARS_PER_TOKEN / 1000

@functools.cached_property
def _session(self):
Expand Down

0 comments on commit 2f069a0

Please sign in to comment.