Closed Yanni8 closed 1 month ago
π€
Hey there, @Yanni8! Good to see you again. Always a pleasure to cross paths with familiar faces. Let's dive into this issue you're encountering.
Based on the information you've provided, it seems like the issue is related to the model_name
attribute in the BaseOpenAI
class. By default, this attribute is set to "gpt-3.5-turbo-instruct"
. If you're using the GPT-4 model with Azure API, you should ensure that you're setting the model_name
attribute to "gpt-4"
when creating the BaseOpenAI
instance. Here's an example of how you can do this:
openai_instance = BaseOpenAI(model_name="gpt-4", ...)
Replace ...
with other parameters you need to pass to the BaseOpenAI
constructor.
This should ensure that the correct model name is used, and the price calculation should be correct. You can find more details about this in the LangChain codebase.
Additionally, there have been similar issues reported in the LangChain repository. For instance, this issue was resolved by including the model
parameter in the AzureChatOpenAI
class initialization. This issue was resolved by adding the new models to the MODEL_COST_PER_1K_TOKENS
dictionary in the openai_info.py
file with their respective costs per 1,000 tokens.
I hope this helps! If you have any other questions or need further clarification, feel free to ask.
Best, Dosu
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.
Help me be more useful! Please leave a π if this is helpful and π if it is irrelevant.
If you want to continue the conversation, start your reply with @dosu-bot.
@dosu-bot, it seems that the cost of Azure gpt-35-turbo version 1106 is missing from the openai_info.py file.
# Azure GPT-35 input
"gpt-35-turbo": 0.0015, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0301": 0.0015, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0613": 0.0015,
"gpt-35-turbo-instruct": 0.0015,
"gpt-35-turbo-16k": 0.003,
"gpt-35-turbo-16k-0613": 0.003,
# Azure GPT-35 output
"gpt-35-turbo-completion": 0.002, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0301-completion": 0.002, # Azure OpenAI version of ChatGPT
"gpt-35-turbo-0613-completion": 0.002,
"gpt-35-turbo-instruct-completion": 0.002,
"gpt-35-turbo-16k-completion": 0.004,
"gpt-35-turbo-16k-0613-completion": 0.004,
@hwchase17 any update on this issue?
Having the same issue with Meta-Llama-3-70B-Instruct
!
{"cost":0.0,"total_tokens":0}
System Info
Langchain: v0.0.350 OS: Linux
Who can help?
@agola11
Information
Related Components
Reproduction
The problem occurs when you use Azure with an GPT 4 Model because the Azure API will always respond with
gpt-4
as the Model name. You can also see this in the official Microsoft documentation. https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/gpt-with-vision#output. It will therefore calculate the wrong price β if you use Turbo will the price will bex3
as it actually should be.Code to Reproduce:
Expected behavior
It should return the correct price.