Skip to content

Conversation

bigint
Copy link
Contributor

@bigint bigint commented Aug 13, 2025

Imported Field from Pydantic and replaced mutable default containers with default_factory to ensure each model instance gets its own list or dictionary

@Sahil3378
Copy link

import json

Your JSON data (as a string for example purposes)

data = """
{
"id": "response_id",
"object": "response",
"created_at": 1751884892,
"status": "completed",
"model": "gpt-oss-120b",
"output": [
{
"id": "msg_id",
"type": "message",
"status": "completed",
"role": "assistant",
"content": [
{
"type": "output_text",
"text": "Hello! How can I help you today?",
"annotations": []
}
],
"parallel_tool_calls": true,
"reasoning": {
"effort": "medium",
"summary": null
}
}
],
"temperature": 1,
"usage": {
"input_tokens": 294,
"output_tokens": 2520,
"total_tokens": 2814
}
}
"""

Parse JSON string into Python dictionary

parsed = json.loads(data)

Extract text from the first output's content

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants