2023-07-18 19:14:51 +00:00
|
|
|
import pytest
|
|
|
|
|
2023-12-11 21:53:30 +00:00
|
|
|
from langchain_community.embeddings.openai import OpenAIEmbeddings
|
2023-07-18 19:14:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.requires("openai")
|
|
|
|
def test_openai_invalid_model_kwargs() -> None:
|
|
|
|
with pytest.raises(ValueError):
|
|
|
|
OpenAIEmbeddings(model_kwargs={"model": "foo"})
|
|
|
|
|
|
|
|
|
|
|
|
@pytest.mark.requires("openai")
|
|
|
|
def test_openai_incorrect_field() -> None:
|
|
|
|
with pytest.warns(match="not default parameter"):
|
2024-02-08 03:08:26 +00:00
|
|
|
llm = OpenAIEmbeddings(foo="bar", openai_api_key="foo")
|
2023-07-18 19:14:51 +00:00
|
|
|
assert llm.model_kwargs == {"foo": "bar"}
|