RicZhou-MS / Text2SQL

generate SQL for user question based on DB table definition
MIT License
1 stars 0 forks source link

ChatCompletion is deprecated #1

Open thracian2015 opened 1 week ago

thracian2015 commented 1 week ago

Great sample, Ric! Given that ChatCompletion has been deprecated in Python openai, Ask_Azure_OpenAI should be rewritten to:

def Ask_Azure_OpenAI(): client = AzureOpenAI ( azure_endpoint = GlobalContext.OPENAI_BASE, api_key=GlobalContext.OPENAI_API_KEY,
api_version="2024-02-15-preview"
)

response = client.chat.completions.create(
    model = "<your deployment name>",
#engine=st.session_state.gpt_engine,
messages = Get_ChatCompletion_message(),
temperature=0.7,
max_tokens=800,
top_p=0.95,
frequency_penalty=0,
presence_penalty=0,
stop=None)
return response
cressrat commented 1 week ago

Dumb comment, but Chat gpt 4o suddenly began to repeat it's first answer, there is no completion. You used to be able to click on "Run" and it would complete the rest of the answer. But now it merely repeats the partial answer it provided the first time. This continues ad-infinum until the browser window goes blank(!) The session remains logged in, clicking in the address bar and pressing "enter" refreshes the window, and Chat gpt 4o is back, but the conversation is gone. As of 6July2024 around 2200pst.

thracian2015 commented 1 week ago

@cressrat are you referring to the Azure portal? This sample works for me.