Registry / serialization / openresponses-types

openresponses-types

JSON →
library2.3.0.post1pypypi✓ verified 79d ago

The `openresponses-types` library provides a Python SDK for the OpenResponses specification, offering standardized data types and models for structured interactions, particularly for AI agents. It leverages Pydantic for robust data validation, serialization, and deserialization of response and prompt structures. The current version is 2.3.0.post1, with releases aligning with updates to the underlying OpenResponses specification.

pip install openresponses-types
INSTALL
IMPORT
SIG · OPENRESPONSES-TYPE
O
openresponses-types
serializationpythonv2.3.0.post1
Install
2.8s avg
Import
Disk
25MB
Pass rate
6/ 10
Env Coverage6 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.3.0.post1 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
glibc
py 3.10
✕ build_error
✕ build_error
py 3.11
✓ —
✓ 3s
py 3.12
✓ —
✓ 2.55s
py 3.13
✓ —
✓ 2.75s
py 3.9
✕ build_error
✕ build_error
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CreateResponseBody
from openresponses_types import CreateResponseBody
from openresponses_types import OpenResponse

This quickstart demonstrates how to create an `AgentResponse` containing a `ChatMLMessage`, embed it within an `OpenResponse`, and then serialize and deserialize the entire structure using Pydantic's V2 methods.

from openresponses.types import AgentResponse, OpenResponse from openresponses.types.model import ChatMLMessage # Create an AgentResponse agent_msg = ChatMLMessage(role="assistant", content="Hello, how can I help you?") agent_response = AgentResponse( model_name="gpt-4", messages=[agent_msg] ) # Create an OpenResponse containing the agent's response open_response = OpenResponse( response=agent_response, prompt_hash="example_hash_123" ) # Print the OpenResponse object (serialized to JSON) print("OpenResponse object created:") print(open_response.model_dump_json(indent=2)) # Example of deserialization from JSON string json_data = open_response.model_dump_json() reconstructed_response = OpenResponse.model_validate_json(json_data) print("\nOpenResponse object deserialized:") print(reconstructed_response.model_dump_json(indent=2))
Debug
Known issues
gotchaThe PyPI package name (`openresponses-types`) is different from the top-level Python package name you import (`openresponses`). Always use `from openresponses.types import ...`.
fix
Ensure your imports start with `from openresponses.types` or `from openresponses.types.model` etc., not `openresponses_types`.
affects: All versions
breakingThis library explicitly requires Pydantic V2. Projects using Pydantic V1 will encounter conflicts and `pydantic.ValidationError` or `AttributeError` if Pydantic V1 methods are used.
fix
Upgrade Pydantic to version 2 or greater (`pip install 'pydantic>=2.0.0'`) and update your Pydantic model usage (e.g., `model_dump_json()` instead of `json()`, `model_validate()` instead of direct class instantiation from dict).
affects: All versions (>=1.0.0)
gotchaThe `OpenResponse` specification is strict. Any data provided that does not conform to the defined schemas will result in `pydantic.ValidationError`.
fix
Consult the OpenResponses specification and ensure all fields, types, and constraints (e.g., enum values, regex patterns) are strictly followed when constructing objects or deserializing data.
affects: All versions
Upgrade
Version history
2.3.0.post1latest on PyPI · released Jan 22, 2026
Audit
Dependencies
openresponses-pythonrequired`openresponses-types` is a meta-package that depends on `openresponses-python` for the actual implementation.
pydantic>=2.0.0requiredCore dependency for data modeling, validation, and serialization. Requires Pydantic V2.
Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources