diff --git a/pm4py/algo/querying/llm/connectors/openai.py b/pm4py/algo/querying/llm/connectors/openai.py index 887c6ff7c..b9b4af572 100644 --- a/pm4py/algo/querying/llm/connectors/openai.py +++ b/pm4py/algo/querying/llm/connectors/openai.py @@ -35,9 +35,9 @@ def apply(query: str, parameters: Optional[Dict[Any, Any]] = None) -> str: import openai - openai.api_key = api_key + client = openai.OpenAI(api_key=api_key) message = {"role": "user", "content": query} - response = openai.ChatCompletion.create(model=model, messages=[message]) + response = client.chat.completions.create(model=model, messages=[message]) return response["choices"][0]["message"]["content"]