DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to get reliable JSON and tool calls from a model in a backend service with AI Engineer Notebooks

Make a model return valid structured output and handle tool-call errors in a service.

Short answer: Run 01-model-apis/00-prompting-basics.ipynb to see how output-format specs change the result; then open 01-model-apis/01-structured-output.ipynb and find where the JSON breaks for your task; Work through 01-model-apis/02-tool-calling.ipynb, including the error paths. All steps.

Authorization notice. AI Engineer Notebooks is dual-use. Only use it on software, sites and systems you own or have explicit permission to test.

Who it is forA backend engineer adding an LLM step to an existing service that needs typed data back from the model.

The problemModel output that is almost JSON breaks parsers, and tool calls fail in ways the service does not handle.

The outcomeA tested integration that parses structured output, calls tools, and handles the error paths.

What you need first

  • A Google account to open Colab notebooks
  • A free Groq API key from console.groq.com (no credit card needed)
  • The key saved as a Colab secret, as the setup notebook describes
  • Basic Python and comfort reading API responses

Steps

  1. Run 01-model-apis/00-prompting-basics.ipynb to see how output-format specs change the result.
  2. Open 01-model-apis/01-structured-output.ipynb and find where the JSON breaks for your task.
  3. Work through 01-model-apis/02-tool-calling.ipynb, including the error paths.
  4. Add the reliability patterns from 08-operations/02-reliability-and-fallbacks.ipynb, such as retries and output validation.
  5. Run the golden set from 04-evals/01-golden-sets.ipynb to confirm the parser handles real inputs.

Prompt for your agent

Using the repo calmrocks/ai-engineer-notebooks, work through 01-model-apis/01-structured-output.ipynb and 01-model-apis/02-tool-calling.ipynb for <placeholder service task>. Expected output: a parser that returns valid objects for every test input and a log of tool-call errors handled. Verify that malformed model output is caught and retried rather than passed on.

Caveat. The notebooks run on Colab with the Groq API, so moving the code into your own service is a separate step the README does not cover.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for calmrocks/ai-engineer-notebooks and "Get reliable JSON and tool calls from a model in a backend service"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer