langchain/libs/standard-tests/langchain_tests/integration_tests
ccurme 6e63ccba84
openai[minor]: release 0.3 (#29100)
## Goal

Solve the following problems with `langchain-openai`:

- Structured output with `o1` [breaks out of the
box](https://langchain.slack.com/archives/C050X0VTN56/p1735232400232099).
- `with_structured_output` by default does not use OpenAI’s [structured
output
feature](https://platform.openai.com/docs/guides/structured-outputs).
- We override API defaults for temperature and other parameters.

## Breaking changes:

- Default method for structured output is changing to OpenAI’s dedicated
[structured output
feature](https://platform.openai.com/docs/guides/structured-outputs).
For schemas specified via TypedDict or JSON schema, strict schema
validation is disabled by default but can be enabled by specifying
`strict=True`.
- To recover previous default, pass `method="function_calling"` into
`with_structured_output`.
- Models that don’t support `method="json_schema"` (e.g., `gpt-4` and
`gpt-3.5-turbo`, currently the default model for ChatOpenAI) will raise
an error unless `method` is explicitly specified.
- To recover previous default, pass `method="function_calling"` into
`with_structured_output`.
- Schemas specified via Pydantic `BaseModel` that have fields with
non-null defaults or metadata (like min/max constraints) will raise an
error.
- To recover previous default, pass `method="function_calling"` into
`with_structured_output`.
- `strict` now defaults to False for `method="json_schema"` when schemas
are specified via TypedDict or JSON schema.
- To recover previous behavior, use `with_structured_output(schema,
strict=True)`
- Schemas specified via Pydantic V1 will raise a warning (and use
`method="function_calling"`) unless `method` is explicitly specified.
- To remove the warning, pass `method="function_calling"` into
`with_structured_output`.
- Streaming with default structured output method / Pydantic schema no
longer generates intermediate streamed chunks.
- To recover previous behavior, pass `method="function_calling"` into
`with_structured_output`.
- We no longer override default temperature (was 0.7 in LangChain, now
will follow OpenAI, currently 1.0).
- To recover previous behavior, initialize `ChatOpenAI` or
`AzureChatOpenAI` with `temperature=0.7`.
- Note: conceptually there is a difference between forcing a tool call
and forcing a response format. Tool calls may have more concise
arguments vs. generating content adhering to a schema. Prompts may need
to be adjusted to recover desired behavior.

---------

Co-authored-by: Jacob Lee <jacoblee93@gmail.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2025-01-10 10:50:32 -05:00
..
__init__.py multiple: combine sync/async vector store standard test suites (#28580) 2024-12-06 14:55:06 -05:00
base_store.py standard-tests: show right classes in api docs (#28591) 2024-12-06 14:48:13 -08:00
cache.py standard-tests: show right classes in api docs (#28591) 2024-12-06 14:48:13 -08:00
chat_models.py openai[minor]: release 0.3 (#29100) 2025-01-10 10:50:32 -05:00
embeddings.py tests[patch]: run standard tests for embeddings and populate embeddings API ref (#28545) 2024-12-05 19:39:03 +00:00
indexer.py standard-tests: show right classes in api docs (#28591) 2024-12-06 14:48:13 -08:00
retrievers.py standard-tests: retriever docstrings (#28596) 2024-12-07 00:32:19 +00:00
tools.py standard-tests: root docstrings (#28595) 2024-12-06 15:14:52 -08:00
vectorstores.py standard-tests: sync/async vectorstore tests conditional (#28636) 2024-12-09 18:02:55 +00:00