Skip to content

Commit

Permalink
Merge pull request #456 from jbgriesner/fix/update-open-ai-v1-migration
Browse files Browse the repository at this point in the history
Adapt openai calls to v1 migration
  • Loading branch information
fit-alessandro-berti authored Nov 20, 2023
2 parents 1d058fc + b6b4070 commit 698d53d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pm4py/algo/querying/llm/connectors/openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit 698d53d

Please sign in to comment.