Skip to content

Commit

Permalink
add model alias
Browse files Browse the repository at this point in the history
  • Loading branch information
lingyielia committed Jul 5, 2024
1 parent 6ba4119 commit 3632a6f
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 15 deletions.
39 changes: 27 additions & 12 deletions vizro-ai/docs/pages/user-guides/customize-vizro-ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,35 @@
## Supported models
Vizro-AI currently supports [OpenAI models](https://platform.openai.com/docs/models) as follows, although we are working on supporting more vendors:

- `gpt-3.5-turbo` (default model)
- `gpt-4-turbo` (recommended for best model performance)
- `gpt-3.5-turbo-0125`
- `gpt-3.5-turbo-1106`
- `gpt-4-0613`
- `gpt-4-1106-preview`
- `gpt-3.5-turbo-0613` (to be deprecated on June 13, 2024)
=== "OpenAI"

- gpt-3.5-turbo `default`
- gpt-4-turbo
- gpt-4o
- gpt-4
- gpt-4-0613
- gpt-4-1106-preview
- gpt-4-turbo-2024-04-09
- gpt-4-turbo-preview
- gpt-4-0125-preview
- gpt-3.5-turbo-1106
- gpt-3.5-turbo-0125
- gpt-4o-2024-05-13

=== "Anthropic"

:octicons-hourglass-24: In development

=== "MistralAI"

:octicons-hourglass-24: In development


These models offer different levels of performance and cost to Vizro-AI users:

* The **gpt-3.5** model series have lower price point and higher speeds for providing answers, but do not offer sophisticated charting.
* The **gpt-3.5** model series have lower price points and fast speeds for providing answers, but do not offer sophisticated charting.

* Consider upgrading to the **gpt-4** models for more demanding tasks. While they are part of a more capable GPT model series, their response time is slower than gpt-3.5 models, and they come at a higher cost.
* Consider upgrading to the **gpt-4** and **gpt-4o** model series for more demanding tasks. While they are part of a more capable GPT model series, they come at a higher cost.

Refer to the [OpenAI documentation for more about model capabilities](https://platform.openai.com/docs/models/overview) and [pricing](https://openai.com/pricing).

Expand All @@ -36,10 +51,10 @@ The example below uses the OpenAI model name in a string form:
```py linenums="1"
from vizro_ai import VizroAI

vizro_ai = VizroAI(model="gpt-3.5-turbo-0125")
vizro_ai = VizroAI(model="gpt-4-turbo")
```

The example below customizes the `ChatOpenAI` instance further beyond the chosen default from the string instantiation. We pass the `"gpt-3.5-turbo-0125"` model from OpenAI as `model_name` for `ChatOpenAI`, which offers improved response accuracy, we also want to increase maximum number of retries.
The example below customizes the `ChatOpenAI` instance further beyond the chosen default from the string instantiation. We pass the `"gpt-4-turbo"` model from OpenAI as `model_name` for `ChatOpenAI`, which offers improved response accuracy, we also want to increase maximum number of retries.
It's important to mention that any parameter that could be used in the `openai.create` call is also usable in `ChatOpenAI`. For more customization options for `ChatOpenAI`, refer to the [LangChain ChatOpenAI docs](https://api.python.langchain.com/en/latest/chat_models/langchain_openai.chat_models.base.ChatOpenAI.html)

<!-- vale off -->
Expand All @@ -57,7 +72,7 @@ To ensure a deterministic answer to our queries, we've set the temperature to 0.
df = px.data.gapminder()

llm = ChatOpenAI(
model_name="gpt-3.5-turbo-0125",
model_name="gpt-4-turbo",
temperature=0,
max_retries=5,
)
Expand Down
11 changes: 8 additions & 3 deletions vizro-ai/src/vizro_ai/chains/_llm_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@
SUPPORTED_MODELS = {
"OpenAI": [
"gpt-4-0613",
"gpt-3.5-turbo-1106",
"gpt-4",
"gpt-4-1106-preview",
"gpt-4-turbo",
"gpt-4-turbo-2024-04-09",
"gpt-4-turbo-preview",
"gpt-4-0125-preview",
"gpt-3.5-turbo-1106",
"gpt-3.5-turbo-0125",
"gpt-3.5-turbo",
"gpt-4-turbo",
"gpt-4o-2024-05-13",
"gpt-4o",
]
}
Expand Down Expand Up @@ -47,7 +52,7 @@ def _get_llm_model(model: Optional[Union[ChatOpenAI, str]] = None) -> BaseChatMo
return DEFAULT_WRAPPER_MAP.get(vendor)(model_name=model, temperature=DEFAULT_TEMPERATURE)

raise ValueError(
f"Model {model} not found! List of available model can be found at https://vizro.readthedocs.io/projects/vizro-ai/en/latest/pages/explanation/faq/#which-llms-are-supported-by-vizro-ai"
f"Model {model} not found! List of available model can be found at https://vizro.readthedocs.io/projects/vizro-ai/en/latest/pages/user-guides/customize-vizro-ai/#supported-models"
)


Expand Down

0 comments on commit 3632a6f

Please sign in to comment.