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:
- Open the official quickstart Colab linked from
adalflow.sylph.ai.
- Set
OPENAI_API_KEY and GROQ_API_KEY.
- 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.
Bug description
The official AdalFlow quickstart Colab notebook (
adalflow_quick_start.ipynb) fails when callingtrain()on the Object Count task pipeline. Theo3-miniteacher 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_penaltyfor reasoning models likeo3-mini. AdalFlow's generator passes it by default.Steps to reproduce:
adalflow.sylph.ai.OPENAI_API_KEYandGROQ_API_KEY.train().Expected behavior: Training runs and reports validation/test accuracy improvements.
Actual behavior: Every call to the teacher generator fails with the
frequency_penaltyerror. 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 valueat
adalflow/core/generator.pyline 276 in_get_default_mapping. This downstream crash happens because every model call errors out, leavingoutput_mappingunassigned.What version are you seeing the problem on?
How to reproduce the bug
Error messages and logs
(repeated for every prediction sample, ~200 times across the validation and test loops, then the run crashes)
Environment
More info
The downstream
UnboundLocalErrorin_get_default_mappingmay be worth handling separately — when every API call fails,output_mappingis left unbound, producing a confusing traceback that hides the real cause (thefrequency_penaltyrejection). Surfacing the API error earlier would help users diagnose this faster.Happy to test a fix and submit a PR if helpful.