langchain/libs/community/tests/unit_tests/embeddings/test_openai.py
Luiz Ferreira 34d2daffb3
community[patch]: Fix chat openai unit test (#17124)
- **Description:** 
Actually the test named `test_openai_apredict` isn't testing the
apredict method from ChatOpenAI.
  - **Twitter handle:**
  https://twitter.com/OAlmofadas
2024-02-07 22:08:26 -05:00

17 lines
497 B
Python

import pytest
from langchain_community.embeddings.openai import OpenAIEmbeddings
@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"):
llm = OpenAIEmbeddings(foo="bar", openai_api_key="foo")
assert llm.model_kwargs == {"foo": "bar"}