langchain/docs/extras/integrations/chat
Jerzy Czopek 539672a7fd
Feature/fix azureopenai model mappings (#8621)
This pull request aims to ensure that the `OpenAICallbackHandler` can
properly calculate the total cost for Azure OpenAI chat models. The
following changes have resolved this issue:

- The `model_name` has been added to the ChatResult llm_output. Without
this, the default values of `gpt-35-turbo` were applied. This was
causing the total cost for Azure OpenAI's GPT-4 to be significantly
inaccurate.
- A new parameter `model_version` has been added to `AzureChatOpenAI`.
Azure does not include the model version in the response. With the
addition of `model_name`, this is not a significant issue for GPT-4
models, but it's an issue for GPT-3.5-Turbo. Version 0301 (default) of
GPT-3.5-Turbo on Azure has a flat rate of 0.002 per 1k tokens for both
prompt and completion. However, version 0613 introduced a split in
pricing for prompt and completion tokens.
- The `OpenAICallbackHandler` implementation has been updated with the
proper model names, versions, and cost per 1k tokens.

Unit tests have been added to ensure the functionality works as
expected; the Azure ChatOpenAI notebook has been updated with examples.

Maintainers: @hwchase17, @baskaryan

Twitter handle: @jjczopek

---------

Co-authored-by: Jerzy Czopek <jerzy.czopek@avanade.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2023-08-09 10:56:15 -07:00
..
anthropic_functions.ipynb add anthropic functions wrapper (#8475) 2023-07-30 07:23:46 -07:00
anthropic.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
anyscale.ipynb Create ChatAnyscale (#8770) 2023-08-07 13:21:05 -07:00
azure_chat_openai.ipynb Feature/fix azureopenai model mappings (#8621) 2023-08-09 10:56:15 -07:00
azureml_chat_endpoint.ipynb Add LLaMa Formatter and AzureML Chat Endpoint (#8382) 2023-07-31 16:26:25 -07:00
google_vertex_ai_palm.ipynb Updated docs on Vertex AI going GA (#8531) 2023-07-31 17:15:04 -07:00
index.mdx mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
jinachat.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
llama_api.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
openai.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00
promptlayer_chatopenai.ipynb mv module integrations docs (#8101) 2023-07-23 23:23:16 -07:00