gpt-oss-120b has high possibility to generate response as part of reasoning

#133
by tonyaw - opened

By using following prompt, there is a high possibility that gpt-oss-120b generates response in "reasoning_content" field instead of "content" field.
Following is one example:
reasoning_response_str=We need to generate code to calculate 2*3. We can just compute and print. Then final_answer.

We should produce python code block with calculation, print result. Then final answer likely the result 6. Use final_answer tool.

So steps: compute result = 2*3, print(result). Then final_answer(answer=result).We will compute the product and output it.```python

Calculate 2 multiplied by 3

result = 2 * 3
print(result) # Expected output: 6

Now call final_answer.python
final_answer(answer=result)

2025-08-29 06:48:01,086 [MainThread - INFO ]  response_str=

Could you please guide me how to fix it?

test_prompt = [
    {
        'role': 'system',
        'content': """Reasoning: low
You are an expert assistant who can solve any task using code blobs. You will be given a task to solve as best you can.
To do so, you have been given access to a list of tools: these tools are basically Python functions which you can call with code.
To solve the task, you must plan forward to proceed in a series of steps.

At each step, you should write the code in simple Python. The code sequence must end with '<end_code>' sequence.
During each intermediate step, you can use 'print()' to save whatever important information you will then need.
In the end you have to return a final answer using the `final_answer` tool.


On top of performing computations in the Python code snippets that you create, you only have access to these tools, behaving like regular python functions:
```python
def get_jira_ticket(ticket_id: string) -> object:
    "Get a JIRA ticket by ID. It gets ticket_id(str) as input, and return JIRA ticket details in dict.

    Args:
        ticket_id: ID of JIRA ticket.
    "

def final_answer(answer: any) -> any:
    "Provides a final answer to the given problem.

    Args:
        answer: The final answer to the problem
    "

You can also give tasks to team members.
Calling a team member works the same as for calling a tool: simply, the only argument you can give in the call is 'task'.
Given that this team member is a real human, you should be very verbose in your task, it should be a long string providing informations as detailed as necessary.
Here is a list of the team members that you can call:

def mr_retriever("Your query goes here.") -> str:
    "Retrieve code diff of Git MR(Merge Request) of a given JIRA ticket."

Here are the rules you should always follow to solve your task:

  1. Python code you generated must be in python... block.
  2. Use only variables that you have defined!
  3. Always use the right arguments for the tools. DO NOT pass the arguments as a dict as in 'answer = wiki({'query': "What is the place where James Bond lives?"})', but use the arguments directly as in 'answer = wiki(query="What is the place where James Bond lives?")'.
  4. Take care to not chain too many sequential tool calls in the same code block, especially when the output format is unpredictable. For instance, a call to search has an unpredictable return format, so do not have another tool call that depends on its output in the same block: rather output results with print() to use them in the next block.
  5. Call a tool only when needed, and never re-do a tool call that you previously did with the exact same parameters.
  6. Don't name any new variable with the same name as a tool: for instance don't name a variable 'final_answer'.
  7. Never create any notional variables in our code, as having these in your logs will derail you from the true variables.
  8. You can use imports in your code, but only from the following list of modules: ['collections', 'datetime', 'itertools', 'json', 'logging', 'math', 'queue', 'random', 're', 'stat', 'statistics', 'time', 'unicodedata', 'yaml']
  9. The state persists between code executions: so if in one step you've created variables or imported modules, these will all persist.
  10. Don't give up! You're in charge of solving the task, not providing directions to solve it.

Now Begin!"""
},
{'role': 'user', 'content': 'New task:\nYou're a helpful agent, generate code to calculate 2*3'}
]

tonyaw changed discussion title from gpt-oss-120b has hight possibility to generate response as part of reasoning to gpt-oss-120b has high possibility to generate response as part of reasoning

Sign up or log in to comment