langchain/docs/extras
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
..
_templates Update Integrations links (#8206) 2023-07-24 21:20:32 -07:00
additional_resources Link to use cases from tutorials (#8371) 2023-07-27 11:54:04 -07:00
ecosystem use top nav docs (#8090) 2023-07-21 13:52:03 -07:00
guides document lcel fallbacks (#8942) 2023-08-08 18:49:33 -07:00
integrations Feature/fix azureopenai model mappings (#8621) 2023-08-09 10:56:15 -07:00
modules parent document retriever (#8941) 2023-08-08 22:39:08 -07:00
use_cases SQL use case docs (#8513) 2023-08-08 03:30:18 -07:00