microsoft / lida

Automatic Generation of Visualizations and Infographics using Large Language Models
https://microsoft.github.io/lida/
MIT License
2.6k stars 266 forks source link

How can I use deployed caht_GPT_model in lida ? #56

Closed aijazshekh0117 closed 8 months ago

aijazshekh0117 commented 9 months ago

I am using Lida and since I can not use direct Key of openAI model we have deployed it on azure server and I want to use the key which is provided by Azure. How can I use that one? Using below code for testing,

from lida import Manager, llm, TextGenerationConfig import pandas as pd from dotenv import load_dotenv load_dotenv()

lida = Manager(text_gen = llm("openai")) textgen_config = TextGenerationConfig(n=1, temperature=0.5, model="gpt-35-turbo-16k", use_cache=True) summary = lida.summarize("https://raw.githubusercontent.com/uwdata/draco/master/data/cars.csv", summary_method="default", textgen_config=textgen_config)
goals = lida.goals(summary, n=2, textgen_config=textgen_config) for goal in goals: display(goal)

openai.error.AuthenticationError: Incorrect API key provided: ***** . You can find your API key at https://platform.openai.com/account/api-keys.

victordibia commented 9 months ago

Hi,

Please see the tutorial notebook on how to use azure (and other models)


from lida import llm

text_gen = llm(provider="openai", api_base="http://localhost:8000")  
lida = Manager(text_gen=text_gen) 

textgen_config = TextGenerationConfig(n=1, temperature=0.5, model="gpt-3.5-turbo-0301", use_cache=True)

summary = lida.summarize("https://raw.githubusercontent.com/uwdata/draco/master/data/cars.csv", summary_method="default", textgen_config=textgen_config)  
goals = lida.goals(summary, n=2, textgen_config=textgen_config) 

Let me know if this is helpful.