pm4py.llm.openai_query#

pm4py.llm.openai_query(prompt: str, api_key: str | None = None, openai_model: str | None = None, api_url: str | None = 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)

  • api_url – OpenAI API URL

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)