Blocks Catalog
Below is a list of Blocks available for registration in
prefect-openai
.
To register blocks in this module to view and edit them on Prefect Cloud:
prefect block register -m prefect_openai
load
method on Blocks, you must already have a block document saved through code or saved through the UI.
Credentials Module
Credentials used to authenticate with OpenAI.
To load the OpenAICredentials:
from prefect import flow
from prefect_openai.credentials import OpenAICredentials
@flow
def my_flow():
my_block = OpenAICredentials.load("MY_BLOCK_NAME")
my_flow()
Completion Module
A block that contains config for an OpenAI Completion Model. Learn more in the OpenAPI Text Completion docs.
To load the CompletionModel:
from prefect import flow
from prefect_openai.completion import CompletionModel
@flow
def my_flow():
my_block = CompletionModel.load("MY_BLOCK_NAME")
my_flow()
Image Module
A block that contains config for an OpenAI Image Model. Learn more in the OpenAPI Image generation docs.
To load the ImageModel:
from prefect import flow
from prefect_openai.image import ImageModel
@flow
def my_flow():
my_block = ImageModel.load("MY_BLOCK_NAME")
my_flow()