From bac9fb9a7c321fa4468d4587b49e2bd7e4afe91b Mon Sep 17 00:00:00 2001 From: Isak Nyberg <36712644+IsakNyberg@users.noreply.github.com> Date: Fri, 12 Apr 2024 00:02:39 +0200 Subject: [PATCH] community: add gpt-4 pricing in callback (#20292) Added the pricing for `gpt-4-turbo` and `gpt-4-turbo-2024-04-09` in the callback method. related to issue #17173 https://openai.com/pricing#language-models --- libs/community/langchain_community/callbacks/openai_info.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/community/langchain_community/callbacks/openai_info.py b/libs/community/langchain_community/callbacks/openai_info.py index 6fe210c9f5..849f1e2532 100644 --- a/libs/community/langchain_community/callbacks/openai_info.py +++ b/libs/community/langchain_community/callbacks/openai_info.py @@ -17,6 +17,8 @@ MODEL_COST_PER_1K_TOKENS = { "gpt-4-1106-preview": 0.01, "gpt-4-0125-preview": 0.01, "gpt-4-turbo-preview": 0.01, + "gpt-4-turbo": 0.01, + "gpt-4-turbo-2024-04-09": 0.01, # GPT-4 output "gpt-4-completion": 0.06, "gpt-4-0314-completion": 0.06, @@ -28,6 +30,8 @@ MODEL_COST_PER_1K_TOKENS = { "gpt-4-1106-preview-completion": 0.03, "gpt-4-0125-preview-completion": 0.03, "gpt-4-turbo-preview-completion": 0.03, + "gpt-4-turbo-completion": 0.03, + "gpt-4-turbo-2024-04-09-completion": 0.03, # GPT-3.5 input # gpt-3.5-turbo points at gpt-3.5-turbo-0613 until Feb 16, 2024. # Switches to gpt-3.5-turbo-0125 after.