Skip to content

Conversation

@ryunsong-contentful
Copy link
Contributor

@ryunsong-contentful ryunsong-contentful commented Nov 21, 2025

Purpose

  • Only test with single CT for now and build out a quick steel thread
  • Create a first iteration of the ai document parser
  • AI document parser uses the output of the AI CT parser, and then the google doc contents to produce a JSON output that can be consumed by the CMA (next PR) to produce entries
  • There will be many follow ups to improve the prompting, typing, handling multiple content types, improving the AI logic, UI improvements
Screenshot 2025-11-21 at 2 12 35 PM
{
  "sys": {
    "id": "3t6sXmBn9YLe8viPVHLRrU",
    "type": "AppActionCall",
    "createdAt": "2025-11-21T21:08:46.395Z",
    "updatedAt": "2025-11-21T21:09:17.392Z",
    "createdBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "7FJf3IvgmQotV5As5zpGhc"
      }
    },
    "updatedBy": {
      "sys": {
        "type": "Link",
        "linkType": "User",
        "id": "7FJf3IvgmQotV5As5zpGhc"
      }
    },
    "space": {
      "sys": {
        "type": "Link",
        "linkType": "Space",
        "id": "9pm311s1i5qt"
      }
    },
    "environment": {
      "sys": {
        "type": "Link",
        "linkType": "Environment",
        "id": "master"
      }
    },
    "action": {
      "sys": {
        "type": "Link",
        "linkType": "AppAction",
        "id": "3nLAuoEuepbJMvdgp1qX6g"
      }
    },
    "appDefinition": {
      "sys": {
        "type": "Link",
        "linkType": "AppDefinition",
        "id": "653vTnuQw3j5onU1tUoH6t"
      }
    },
    "category": {
      "sys": {
        "type": "Link",
        "linkType": "AppActionCategory",
        "id": "Custom"
      }
    },
    "appActionCallResponse": {
      "sys": {
        "type": "Link",
        "linkType": "AppActionCallResponse",
        "id": "3t6sXmBn9YLe8viPVHLRrU"
      }
    },
    "status": "succeeded",
    "result": {
      "success": true,
      "response": {
        "contentTypeParserAgentResult": {
          "contentTypes": [
            {
              "fieldCount": 5,
              "purpose": "The Content Outline is intended for planning and organizing content pieces, ensuring alignment with SEO strategies and content goals.",
              "keyFields": [
                "topic",
                "seoid",
                "publishDate",
                "keywords",
                "contentExamples"
              ],
              "name": "Content Outline",
              "description": "This content type represents a structured outline for content creation, focusing on key topics and SEO elements.",
              "id": "1menTXkrAw48Uz45olsuTY",
              "recommendations": [
                "Ensure the 'Topic' field is always filled to maintain focus on the content's main subject.",
                "Use the 'SEO ID' to link content with SEO strategies, even though it's optional.",
                "Regularly update 'Keywords' to reflect current trends and improve searchability."
              ]
            }
          ],
          "summary": "The Content Outline content type is designed to facilitate content planning and SEO alignment, with fields for topics, SEO identifiers, and keywords. It supports content strategists in organizing and optimizing content pieces.",
          "complexity": "simple"
        },
        "entriesReadyForCreation": [
          {
            "contentTypeId": "1menTXkrAw48Uz45olsuTY",
            "fields": {
              "publishDate": {
                "en-US": "2025-05-16"
              },
              "topic": {
                "en-US": "Extra money and help if you get Universal Credit"
              },
              "contentExamples": {
                "en-US": [
                  "Passported benefits",
                  "Advance payment for Universal Credit",
                  "Benefits for disabilities",
                  "Help with essential bills",
                  "Help with housing costs",
                  "Childcare support",
                  "Health cost assistance"
                ]
              },
              "seoid": {
                "en-US": "extra-money-help-universal-credit"
              },
              "keywords": {
                "en-US": [
                  "Universal Credit",
                  "extra help",
                  "benefits",
                  "support"
                ]
              }
            }
          },
          {
            "contentTypeId": "1menTXkrAw48Uz45olsuTY",
            "fields": {
              "topic": {
                "en-US": "Get help with essential bills"
              },
              "contentExamples": {
                "en-US": [
                  "Cold Weather Payment",
                  "Winter Fuel Payment",
                  "Warm Home Discount",
                  "WaterSure scheme"
                ]
              },
              "seoid": {
                "en-US": "help-essential-bills"
              },
              "keywords": {
                "en-US": [
                  "energy costs",
                  "council tax",
                  "water bills",
                  "phone bills"
                ]
              }
            }
          },
          {
            "contentTypeId": "1menTXkrAw48Uz45olsuTY",
            "fields": {
              "topic": {
                "en-US": "Get help with housing costs"
              },
              "contentExamples": {
                "en-US": [
                  "Discretionary Housing Payment",
                  "Housing Benefit",
                  "Support for mortgage interest"
                ]
              },
              "seoid": {
                "en-US": "help-housing-costs"
              },
              "keywords": {
                "en-US": [
                  "housing costs",
                  "Universal Credit",
                  "Discretionary Housing Payment"
                ]
              }
            }
          },
          {
            "contentTypeId": "1menTXkrAw48Uz45olsuTY",
            "fields": {
              "topic": {
                "en-US": "Get help with childcare costs"
              },
              "contentExamples": {
                "en-US": [
                  "Free childcare for children aged 2 to 4",
                  "Flying Start scheme",
                  "Tax-Free Childcare"
                ]
              },
              "seoid": {
                "en-US": "help-childcare-costs"
              },
              "keywords": {
                "en-US": [
                  "childcare support",
                  "Universal Credit",
                  "free childcare"
                ]
              }
            }
          },
          {
            "contentTypeId": "1menTXkrAw48Uz45olsuTY",
            "fields": {
              "topic": {
                "en-US": "Get help with health costs"
              },
              "contentExamples": {
                "en-US": [
                  "Help with prescriptions",
                  "Dental treatment assistance",
                  "Sight tests"
                ]
              },
              "seoid": {
                "en-US": "help-health-costs"
              },
              "keywords": {
                "en-US": [
                  "NHS charges",
                  "health costs",
                  "prescriptions"
                ]
              }
            }
          }
        ]
      }
    }
  }
}

@ryunsong-contentful ryunsong-contentful requested a review from a team as a code owner November 21, 2025 21:12
Comment on lines +91 to +112
// Create a simplified view of content types for the prompt
const contentTypeDefinitions = contentTypes.map((ct) => ({
id: ct.sys.id,
name: ct.name,
description: ct.description,
fields:
ct.fields?.map((field) => ({
id: field.id,
name: field.name,
type: field.type,
required: field.required,
localized: field.localized,
validations: field.validations,
})) || [],
}));

return `Extract structured entries from the following document based on the provided Contentful content type definitions.
AVAILABLE CONTENT TYPES: ${contentTypeList}
TOTAL CONTENT TYPES: ${contentTypes.length}
TOTAL FIELDS ACROSS ALL TYPES: ${totalFields}
LOCALE TO USE: ${locale}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's integrate the content type parser data here next

Comment on lines +10 to +18
export const EntryToCreateSchema = z.object({
contentTypeId: z.string().describe('The ID of the content type for this entry'),
fields: z
.record(z.string(), LocalizedFieldSchema)
.describe(
'Fields with localized values, e.g., { "title": { "en-US": "My Title" }, "body": { "en-US": "Content..." } }'
),
});

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing the sys object?

@ryunsong-contentful ryunsong-contentful merged commit 449ba7a into master Nov 21, 2025
15 checks passed
@ryunsong-contentful ryunsong-contentful deleted the INTEG-3263-steel branch November 21, 2025 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants