Skip to content

Quickstart Colab fails with frequency_penalty error on OpenAI Responses API (o3-mini teacher model) #481

@Omarhus01

Description

@Omarhus01

Bug description

The official AdalFlow quickstart Colab notebook (adalflow_quick_start.ipynb) fails when calling train() on the Object Count task pipeline. The o3-mini teacher generator hits an error on every call:

Responses.create() got an unexpected keyword argument 'frequency_penalty'

This appears to be caused by OpenAI's Responses API not accepting frequency_penalty for reasoning models like o3-mini. AdalFlow's generator passes it by default.

Steps to reproduce:

  1. Open the official quickstart Colab linked from adalflow.sylph.ai.
  2. Set OPENAI_API_KEY and GROQ_API_KEY.
  3. Run all cells up to and including train().

Expected behavior: Training runs and reports validation/test accuracy improvements.

Actual behavior: Every call to the teacher generator fails with the frequency_penalty error. Initial validation and test scores both come out as 0.0. Training crashes with:

UnboundLocalError: cannot access local variable 'output_mapping' where it is not associated with a value

at adalflow/core/generator.py line 276 in _get_default_mapping. This downstream crash happens because every model call errors out, leaving output_mapping unassigned.

What version are you seeing the problem on?

Latest from pip (`pip install -U adalflow[groq]`), installed fresh on April 29, 2026.

How to reproduce the bug

Run the official quickstart Colab end-to-end with default settings:
https://colab.research.google.com/github/SylphAI-Inc/AdalFlow/blob/main/notebooks/adalflow_quick_start.ipynb

The error appears once execution reaches the cell containing `train()`.

Error messages and logs

ERROR:adalflow.core.generator:Error calling the model: Responses.create() got an unexpected keyword argument 'frequency_penalty'

(repeated for every prediction sample, ~200 times across the validation and test loops, then the run crashes)

UnboundLocalError                         Traceback (most recent call last)
/tmp/ipykernel_3422/2222181158.py in <cell line: 0>()
----> 1 train()

/usr/local/lib/python3.12/dist-packages/adalflow/core/generator.py in _get_default_mapping(output)
    274             del output_mapping["raw_response"]
    275 
--> 276         return output_mapping, output_fields
    277 
    278     def set_mock_output(

UnboundLocalError: cannot access local variable 'output_mapping' where it is not associated with a value

Environment

  • OS: Google Colab (Linux runtime, Python 3.12)
  • adalflow version: latest from pip as of 2026-04-29
  • OpenAI model in use: o3-mini (teacher generator)
  • Groq model in use: default from quickstart

More info

The downstream UnboundLocalError in _get_default_mapping may be worth handling separately — when every API call fails, output_mapping is left unbound, producing a confusing traceback that hides the real cause (the frequency_penalty rejection). Surfacing the API error earlier would help users diagnose this faster.

Happy to test a fix and submit a PR if helpful.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working, either in /adalflow, /tutorials, or /use cases...

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions