mirror of
https://github.com/hwchase17/langchain.git
synced 2026-06-09 10:17:00 +00:00
core,integrations[minor]: Dont error on fields in model_kwargs (#27110)
Given the current erroring behavior, every time we've moved a kwarg from model_kwargs and made it its own field that was a breaking change. Updating this behavior to support the old instantiations / serializations. Assuming build_extra_kwargs was not something that itself is being used externally and needs to be kept backwards compatible
This commit is contained in:
@@ -30,9 +30,12 @@ def test_openai_model_kwargs() -> None:
|
||||
assert llm.model_kwargs == {"foo": "bar"}
|
||||
|
||||
|
||||
def test_openai_invalid_model_kwargs() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
OpenAI(model_kwargs={"model_name": "foo"})
|
||||
def test_openai_fields_in_model_kwargs() -> None:
|
||||
"""Test that for backwards compatibility fields can be passed in as model_kwargs."""
|
||||
llm = OpenAI(model_kwargs={"model_name": "foo"})
|
||||
assert llm.model_name == "foo"
|
||||
llm = OpenAI(model_kwargs={"model": "foo"})
|
||||
assert llm.model_name == "foo"
|
||||
|
||||
|
||||
def test_openai_incorrect_field() -> None:
|
||||
|
||||
Reference in New Issue
Block a user