A usable agent-style API that accepts a textual LLM prompt (such as those found at AWS Startups Prompt Library and produces
JSON output containing a name and description.
For example, the output should resemble:
{
"name": "AWS DevOps Assistant for Startups",
"description": "A comprehensive guide for early-stage startup founders to implement AWS best practices and DevOps principles."
}- Create a Cloudflare AI Worker application.
- Copy the worker.js code into the application.
- Define one or more API keys in the
apiKeysarray. - Deploy the worker.
Making API calls to the deployed AI Worker will now return a response.
curl -i -H "Authorization: <your api key>" -d @full_aws_deployment_agent.prompt https://prompt-summarizer.<your-domain>.workers.dev/
- This worker uses a small (aka free or less-expensive and quick) model to summarize the prompts. Context limits may apply to large prompts and will require truncation.
- Small models (like llama-3.2-3b-instruct used here) do not generally support Structured Output or JSON Mode via JSON schema validation. While this implementation tends to adhere pretty well, JSON results are not enforced or guaranteed.