{"library":"openresponses-types","title":"OpenResponses Types","description":"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.","language":"python","status":"active","last_verified":"Fri Apr 17","install":{"commands":["pip install openresponses-types"],"cli":null},"imports":["from openresponses.types import OpenResponse","from openresponses.types import AgentResponse","from openresponses.types import HumanResponse","from openresponses.types.model import ChatMLMessage","from openresponses.types.action import Action"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from openresponses.types import AgentResponse, OpenResponse\nfrom openresponses.types.model import ChatMLMessage\n\n# Create an AgentResponse\nagent_msg = ChatMLMessage(role=\"assistant\", content=\"Hello, how can I help you?\")\nagent_response = AgentResponse(\n    model_name=\"gpt-4\",\n    messages=[agent_msg]\n)\n\n# Create an OpenResponse containing the agent's response\nopen_response = OpenResponse(\n    response=agent_response,\n    prompt_hash=\"example_hash_123\"\n)\n\n# Print the OpenResponse object (serialized to JSON)\nprint(\"OpenResponse object created:\")\nprint(open_response.model_dump_json(indent=2))\n\n# Example of deserialization from JSON string\njson_data = open_response.model_dump_json()\nreconstructed_response = OpenResponse.model_validate_json(json_data)\nprint(\"\\nOpenResponse object deserialized:\")\nprint(reconstructed_response.model_dump_json(indent=2))\n","lang":"python","description":"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.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}