Skip to Content
DocumentationBuilt-In ToolsLlm ModuleAIGenerateDocument

AIGenerateDocument

The AIGenerateDocument tool uses AI to generate structured documents based on your prompts. It combines the power of large language models with document validation to create properly formatted, type-safe documents automatically.

Documents generated with AIGenerateDocument are validated against your document schema and displayed as interactive forms in Loopstack Studio.

Basic Usage

Simple Document Generation

transitions: - id: generate_summary from: start to: summary_created call: - tool: AIGenerateDocument args: prompt: | Create meeting notes for a team standup on January 15th {{ rawNotes }} responseDocument: MeetingNotesDocument

Use separate messages

transitions: - id: generate_with_context from: processing to: complete call: - tool: AIGenerateDocument args: messages: - role: system content: "You are a professional meeting notes assistant" - role: user content: "Summarize the key decisions from today's meeting" - role: user content: "Notes: {{ rawNotes }}" responseDocument: MeetingNotesDocument

Use Workflow Message History

transitions: - id: generate_with_context from: processing to: complete call: - tool: CreateChatMessage args: role: user content: | Create meeting notes for a team standup on January 15th {{ rawNotes }} - tool: AIGenerateDocument args: responseDocument: MeetingNotesDocument messagesSearchTag: message # search for all messages in the workflow's document history

Configuration Options

LLM Settings

transitions: - id: generate_with_model from: start to: generated call: - tool: AIGenerateDocument args: llm: provider: openai model: gpt-4 prompt: "Generate a project task list" responseDocument: TaskDocument

Parameters

  • prompt: A string prompt for the AI (use this for simple requests)
  • messages: An array of messages for more complex conversations
  • messagesSearchTag: Reference previously tagged messages in the workflow
  • responseDocument: The document class to generate (required)
  • llm: Optional LLM configuration
    • model: The AI model to use
    • provider: The AI provider (e.g., β€œopenai”, β€œanthropic”)
Last updated on