- Issue created by @majorrobot
- @majorrobot opened merge request.
- πΊπΈUnited States majorrobot
This MR is ready. We already had a basic MVP prompt builder, but I've added a couple of things:
* Updates the system role passed to the Provider, with
You are an API that attempts to parse HTML content and find the important parts of a web page.
* Since we can't do Structured JSON calls with Gemini yet, I passed the schema with the system role instructionYou will return this as a JSON object with this schema: ' . $schema)
* Given a PHP object (like a bundle, say), thecreateSchema()
method can now generate jsonSchema on the fly. This is thanks to evaisse/php-json-schema-generator. This feels like a big win.With these updates, Gemini can look at html and return an object along the requested schema with no specific instructions about the page. That is exciting and pretty
awesome
.I've gotta credit https://www.raymondcamden.com/2024/11/27/using-generative-ai-to-parse-we... for helping me understand how to work with Gemini.
- πΊπΈUnited States majorrobot
Iβve hardcoded a PHP object that represents a bundle from the Department of Education's LINCS website, as an example.
To test locally, try:
ddev drush php-eval "print_r(\Drupal::service('ai_migration.ai_migrator')->convert('https://lincs.ed.gov/professional-development/resource-collections/prle-8850'));"
Other pages you could try:
- πΊπΈUnited States dmundra Eugene, OR
Looking good @majorrobot. Thank you for the details and it makes sense.
-
dmundra β
committed 07770eb4 on 1.0.x authored by
majorrobot β
Issue #3537886: Update prompt builder and build schema on the fly from...
-
dmundra β
committed 07770eb4 on 1.0.x authored by
majorrobot β