mckinsey / vizro

Vizro is a toolkit for creating modular data visualization applications.
https://vizro.readthedocs.io/en/stable/
Apache License 2.0
2.49k stars 112 forks source link

Feat/add azure openai #301

Closed Anna-Xiong closed 3 months ago

Anna-Xiong commented 5 months ago

Description

  1. Method 1, update llm_to_use and let user configure langchain wrapper themseleves

Here is how one can change to AzureOpenAI using approach added in docs:

# Import Azure OpenAI and VizroAI
from langchain_openai import AzureOpenAI
from vizro_ai import VizroAI

# Create an instance of Azure OpenAI
# Replace the deployment name with your own
llm = AzureOpenAI(
    deployment_name="td2",
    model_name="gpt-3.5-turbo-instruct",
)

# Update llm_to_use to Azure OpenAI
vizro_ai = VizroAI()
vizro_ai.llm= llm

2.Alternatively we can change vizro_ai.chains._llm_models to include wrapper of AzureOpenAI, instead of letting user change llm_to_use attribute.

Screenshot

Notice

huong-li-nguyen commented 4 months ago

Is this PR still relevant?

maxschulz-COL commented 4 months ago

Is this PR still relevant?

Yes, it just is on hold for some other refactoring

Anna-Xiong commented 3 months ago

closed as the the new vizro class refactoring changes how to add open ai, this is the new pr to address this issue https://github.com/mckinsey/vizro/pull/443