From 8f81703d76b8ed82df7b8c9e38c118c078fb288f Mon Sep 17 00:00:00 2001 From: Isak Nyberg <36712644+IsakNyberg@users.noreply.github.com> Date: Sun, 12 Nov 2023 21:01:19 +0100 Subject: [PATCH] Add new models to openai callback (#13244) **Description:** Adding the new models to the openai callback function, info taken from [model announcement](https://platform.openai.com/docs/models) and [pricing](https://openai.com/pricing) A short description for a short PR :) --- libs/langchain/langchain/callbacks/openai_info.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/libs/langchain/langchain/callbacks/openai_info.py b/libs/langchain/langchain/callbacks/openai_info.py index d4744d1f6a..f9d49e4188 100644 --- a/libs/langchain/langchain/callbacks/openai_info.py +++ b/libs/langchain/langchain/callbacks/openai_info.py @@ -12,6 +12,8 @@ MODEL_COST_PER_1K_TOKENS = { "gpt-4-32k": 0.06, "gpt-4-32k-0314": 0.06, "gpt-4-32k-0613": 0.06, + "gpt-4-vision-preview": 0.01, + "gpt-4-1106-preview": 0.01, # GPT-4 output "gpt-4-completion": 0.06, "gpt-4-0314-completion": 0.06, @@ -19,10 +21,13 @@ MODEL_COST_PER_1K_TOKENS = { "gpt-4-32k-completion": 0.12, "gpt-4-32k-0314-completion": 0.12, "gpt-4-32k-0613-completion": 0.12, + "gpt-4-vision-preview-completion": 0.03, + "gpt-4-1106-preview-completion": 0.03, # GPT-3.5 input "gpt-3.5-turbo": 0.0015, "gpt-3.5-turbo-0301": 0.0015, "gpt-3.5-turbo-0613": 0.0015, + "gpt-3.5-turbo-1106": 0.001, "gpt-3.5-turbo-instruct": 0.0015, "gpt-3.5-turbo-16k": 0.003, "gpt-3.5-turbo-16k-0613": 0.003, @@ -30,6 +35,7 @@ MODEL_COST_PER_1K_TOKENS = { "gpt-3.5-turbo-completion": 0.002, "gpt-3.5-turbo-0301-completion": 0.002, "gpt-3.5-turbo-0613-completion": 0.002, + "gpt-3.5-turbo-1106-completion": 0.002, "gpt-3.5-turbo-instruct-completion": 0.002, "gpt-3.5-turbo-16k-completion": 0.004, "gpt-3.5-turbo-16k-0613-completion": 0.004,