How to Use OpenAI with LangChain: ChatOpenAI, Agents and Structured Output

LangChain is the most widely used Python framework for building applications on top of language models, and OpenAI is the provider most people connect to it first. The pairing has changed noticeably with LangChain 1.0: agents are now built with a single create_agent function, models are created with a unified interface, and the OpenAI integration … Read more

OpenAI Structured Outputs Guide: JSON Schema and Pydantic

OpenAI Structured Outputs guarantees that the model’s response matches a JSON schema you define — not just valid JSON, but schema-valid JSON with exactly the fields and types you specified. Before structured outputs, developers used JSON mode (syntactically valid JSON but without schema enforcement) or function calling workarounds that produced inconsistent results. Structured outputs with … Read more