Generates a HTML from a given prompt.

Parameters

These are the parameters for OpenAI. Please set the authentication parameters for other models as appropriate from the function definitions above.

prompt
string
required

Prompt

api_key
string
required

API key to use the LLM model

model
string

LLM model to use

Example

from morph_lib.ai.openai.code_generation import text_to_html
import os

@morph.func
def func_name(context):
    prompt = context.vars["prompt"]
    fig = text_to_html(
		prompt,
		os.environ["OPENAI_API_KEY"],
		"gpt-4o",
	)
	code = fig.code
	print(code)

	return fig.content