forked from langchain-ai/langchain
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allowing additional params for OpenAIEmbeddings. (langchain-ai#7752)
(langchain-ai#7654) --------- Co-authored-by: Bagatur <[email protected]>
- Loading branch information
Showing
11 changed files
with
110 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,6 +362,7 @@ extended_testing = [ | |
"openai", | ||
"sympy", | ||
"rapidfuzz", | ||
"openai", | ||
"rank_bm25", | ||
] | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
from langchain.embeddings.openai import OpenAIEmbeddings | ||
|
||
os.environ["OPENAI_API_KEY"] = "foo" | ||
|
||
|
||
@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") | ||
assert llm.model_kwargs == {"foo": "bar"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import os | ||
|
||
import pytest | ||
|
||
from langchain.llms.openai import OpenAI | ||
|
||
os.environ["OPENAI_API_KEY"] = "foo" | ||
|
||
|
||
@pytest.mark.requires("openai") | ||
def test_openai_model_param() -> None: | ||
llm = OpenAI(model="foo") | ||
assert llm.model_name == "foo" | ||
llm = OpenAI(model_name="foo") | ||
assert llm.model_name == "foo" | ||
|
||
|
||
@pytest.mark.requires("openai") | ||
def test_openai_invalid_model_kwargs() -> None: | ||
with pytest.raises(ValueError): | ||
OpenAI(model_kwargs={"model_name": "foo"}) | ||
|
||
|
||
@pytest.mark.requires("openai") | ||
def test_openai_incorrect_field() -> None: | ||
with pytest.warns(match="not default parameter"): | ||
llm = OpenAI(foo="bar") | ||
assert llm.model_kwargs == {"foo": "bar"} |