Class Story

Story object which contains a prompt and story and can generate a title and an image

Constructors

  • Creates a new Story instance

    Parameters

    • openai: OpenAI

      The authenticated OpenAI client

    • storyParams: StoryParams

      Story parameters including prompt, story content, and temperature

    • chatModel: string = DEFAULT_MODEL

      Optional, the model to use. Defaults to gpt-5-mini. Note: gpt-5-mini only supports temperature=1 (default)

    • logger: ILogger = console

      Optional logger instance for debugging. Defaults to console

    Returns Story

Properties

chat: ChatAssistant
content: string
creationPrompt: ChatCompletionMessageParam[]
logger: ILogger = console

Optional logger instance for debugging. Defaults to console

openai: OpenAI

The authenticated OpenAI client

prompt: string
temperature: number

Methods

  • Generates an image for the story using DALL-E

    Parameters

    • size: ImageSize = "1024x1024"

      Optional, the size of the image. Defaults to "1024x1024"

    • model: Model = "dall-e-3"

      Optional, the DALL-E model to use. Defaults to "dall-e-3"

    Returns Promise<string>

    A Promise that resolves to the URL of the generated image

  • Generates a title for the story

    Returns Promise<string>

    A Promise that resolves to the generated title

  • Utility method which allows a Story object to be generated from a prompt with a story

    Parameters

    • prompt: string

      The prompt to generate the story from

    • openai: OpenAI

      The authenticated OpenAI client

    • chatModel: string = DEFAULT_MODEL

      Optional, the model to use. Defaults to gpt-5-mini. Note: gpt-5-mini only supports temperature=1 (default)

    • logger: ILogger = console

      Optional logger instance for debugging. Defaults to console

    Returns Promise<Story>

    A Promise that resolves to a Story instance