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
This commit is contained in:
Luiz Ferreira
2024-02-08 00:08:26 -03:00
committed by GitHub
parent f92738a6f6
commit 34d2daffb3
3 changed files with 12 additions and 20 deletions

View File

@@ -1,11 +1,7 @@
import os
import pytest
from langchain_community.embeddings.openai import OpenAIEmbeddings
os.environ["OPENAI_API_KEY"] = "foo"
@pytest.mark.requires("openai")
def test_openai_invalid_model_kwargs() -> None:
@@ -16,5 +12,5 @@ def test_openai_invalid_model_kwargs() -> None:
@pytest.mark.requires("openai")
def test_openai_incorrect_field() -> None:
with pytest.warns(match="not default parameter"):
llm = OpenAIEmbeddings(foo="bar")
llm = OpenAIEmbeddings(foo="bar", openai_api_key="foo")
assert llm.model_kwargs == {"foo": "bar"}