pm4py.llm.openai_query#

pm4py.llm.openai_query(prompt: str, api_key: Optional[str] = None, openai_model: Optional[str] = None, **kwargs) str[source]#

Executes the provided prompt, obtaining the answer from the OpenAI APIs.

Parameters:
  • prompt (str) – prompt that should be executed

  • api_key – OpenAI API key

  • openai_model – OpenAI model to be used (default: gpt-3.5-turbo)

Return type:

str

import pm4py

resp = pm4py.llm.openai_query('what is the result of 3+3?', api_key="sk-382393", openai_model="gpt-3.5-turbo")
print(resp)